Blacklist a DNS server supplied via DHCP

3

1

The DHCP server on a network I use specifies a DNS server that I do not want to use. Is there a way to continue to use DHCP but to modify the provided information or to "blacklist" one (of the three provided) DNS servers?

The client in question is running Ubuntu 10.04. Networking is managed by NetworkManager but I'm not wedded to that. In fact, I don't like it and wouldn't mind a reason to use something else.

Thanks, Matt.

mpm

Posted 2010-07-02T04:22:32.237

Reputation: 133

Answers

1

You can manually set your DNS server to whatever you want.

System > Preferences > Network Connections

Click on the network connection in the list and click edit. Then click on the IPv4 Settings tab (if you are using IPv4).

In the drop down list select Automatic (DHCP) addresses only.

Then you can fill in the DNS servers you would like to use in the field below. I think this modifies /etc/resolv.conf.

You'll have to reboot for changes to take effect.

James T

Posted 2010-07-02T04:22:32.237

Reputation: 8 515

NetworkManager overwrites resolv.conf every time it starts up. – mpm – 2010-07-02T14:27:46.340

@mpm That is true. If you use the gui tools to change it from "Automatic (DHCP)" to "Automatic (DHCP) addresses only" as described in my solution, then network manager will only use DHCP for your IP address and will overwrite resolv.conf with the DNS servers that you give it. You should not directly modify resolv.conf. Use the gui tool. – James T – 2010-07-02T17:48:49.830

Thanks, James. What I really want is a way to use 2 out of the three nameservers from dhcp but specifying them directly is a good enough workaround for the time being. Again, thanks for your help. – mpm – 2010-07-03T00:47:33.730

@mpm glad i could help... even if it wasn't a perfect fix. – James T – 2010-07-03T07:10:38.623

0

I have a similar problem, DHCP gives me three nameservers, but the first one doesn't work, and IT refuses to fix it.

Obviously editing /etc/resolv.conf is going to be overwritten, having a static setup means things won't get updated when I bring my laptop elsewhere, and prepending servers means my local addresses won't be resolved.

The only solution I can think of so far, is to use iptables to make connections to the defective server get routed to the next (working) server in the list...

(Would post as a comment, but the idiotic reputation rules doesn't give me that option. Sorry for messing up the structure.)

user894010

Posted 2010-07-02T04:22:32.237

Reputation: