Permanently removes the name server from /etc/resolv.conf

advertisements

When my Ubuntu 10.10-64bit machine starts up the top of /etc/resolv.conf is:

# Generated by NetworkManager
domain Dynex
search Dynex
nameserver 192.168.2.1

With this configuration my DNS is very slow, presumably b/c the router itself isn't actually a DNS server, so name resolution has to time out on that address before trying the following nameservers from my ISP. If I comment out the nameserver for the router, name resolution is fast.

I also use a Cisco VPN that modifies /etc/resolv.conf on connecting and restores the "original" config on disconnection - that is, if the router nameserver was commented out before connecting, it's still commented out after disconnecting.

Problem is, /etc/resolv.conf gets rewritten at next startup so that the router nameserver reappears as the first entry. The machine is a dual-boot system that gets restarted often, so I need some way to permanently block the router address from /etc/resolv.conf, or I suppose a way to automate removing it, in a way that still allows the VPN to work properly.

Thanks!


Just ran into this problem myself(well sort of-I ended up with retarded search lines for my router like yours, but my actual DNS address was there...). I think this fixes it: Right-click on the network-manager icon. Click "edit connections". select the connection you are using under wired/wireless connections(usually auto-something), click edit button on the right and then when the new dialog window opens select the ipv4 settings tab. Now click where it says "method" and select "Automatic (DHCP) addresses only". Now go to the field titled "DNS Servers" and enter DNS server address(es) from your ISP. (In what you list above you only have 192.168.2.1 listed and you state that this is the address of your router... You can google for the DNS server address for your ISP or you might be able to find it in the router/dsl/cable modem you got from your ISP or go under windows and find that info in the connection properties....

Hope this helps....