• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Adding a DNS entry into the net config file in Linux

KAMAZON

Golden Member
guys i'm hitting my head on the wall here. Does ANYONE know how to specify the DNS servers in the net file in linux??

This is what I have in /etc/conf.d/net

plug_timeout="6"
config_wlan0=( "192.168.1.99/24" )
routes_wlan0=("default via 192.168.1.1" )
dns_domain_wlan0=( "66.75.164.90" )
and one more line which I forgot what it was (lol)

 
I have no idea what distro uses /etc/conf.d/net, but DNS entries eventually need to end up in /etc/resolv.conf for them to actually be used. But if your DHCP server isn't handing out the DNS entries properly you should probably fix that instead of papering over the real problem.
 
You could always check the lease file for dhclient.
Don't know where your distro stores it, but on my Debian boxes, it's in /var/run
It's specified on the command line, so if your distro does likewise, finding it shouldn't be hard.
dhclient -e -pf /var/run/dhclient.eth1.pid -lf /var/run/dhclient.eth1.leases eth1
Check that file for lines like this:
option domain-name-servers x.x.x.x;
 
echo "search substitute.yourdomain.net" > /etc/resolv.conf
echo "nameserver 192.168.0.1" >> /etc/resolv.conf
echo "nameserver 192.168.1.1" >> /etc/resolv.conf

This will work irregardless of your distro.


dns_domain_wlan0=( "66.75.164.90" )

This is for Gentoo? That would be your domain name, not dns server.
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?******printable&part=1&chap=8

I don't know why, unfortunately, it's not pulling dns information from your dhcp server.
 
I'll assume you're using Gentoo. Check out /etc/conf.d/net.example for examples.

You could either set the DNS servers using dns_servers_wlan0=( "x.x.x.x x.x.x.x" ), or you could set dhcp_wlan0="nodns" (to prevent resolv.conf from being overwritten) and manually add the information to /etc/resolv.conf (see drag's example).
 
Thanks a lot for the help guys, I'll give you guys a quick update.


I updated the /etc/resolv.conf file with my name servers and it worked just fine after that. However, I hosed my system and reinstalled gentoo (sayabon I think is the right spelling of my distro). This time instead of letting DHCP configure my settings, I figured I'll manually put in my network settings during install. Big mistake, something is overwriting my /etc/resolv.conf file everytime I run /etc/init.d/net.wlan0 stop then start. Is there a resource out there that tells me exactly all the things that are going on when I stop the service? This is my first time really using linux and I am very intrested in it, but have a lot of reading to do.

I can again hit websites through the IP but not through their name. C'est la vie!
 
I donno. Gentoo is realy funky about things like this. I don't like it and I don't think that it's a very good distributio to learn on.

You'd probably be better off with Ubuntu, but that's just my opinion. If you like Gentoo then stick with it.

As for what is overwriting the /etc/resolv.conf, I don't know for sure. Sometimes if your machine gets configured with Dhcp it will store that information in a file and then use that for future configurations.

For very Gentoo specific questions like this one your definately better off asking them in Gentoo's forums. That way you will have people that are there to help out with Gentoo-specific problems and give accurate answers on what to do. If it's a bug then you can find Gentoo developers their also.

Check out Forums.gentoo.org

This forum is better for more general linux questions and stuff that isn't distro-specific.
(network configuration files are one of those things that tend to be distro-specific)
 
dhclient is always going to overwrite resolv.conf, unless you specify otherwise.There wouldn't be much point to DHCP if it didn't.

You can use strace or ktrace, depending on the OS, to see everything that's going on.

If you can hit them via the IP make sure the permissions on resolv.conf are 644:

% sudo chmod 644 /etc/resolv.conf
 
Back
Top