0

I've an Ubuntu box. When I connect to a wifi network, I get the IP address for wlan interface using dhclient. The problem is, I don't to use the DNS servers provided by the DHCP lease. How can I do that? I tried entering static dns servers for my eht0 and reloading its configuration, but the DHCP provided DNSes win anyway.

1
  • Why don't you use NetworkManager ?
    – Rabin
    Commented Dec 30, 2014 at 15:01

1 Answer 1

2

According to http://www.cyberciti.biz/faq/dhclient-etcresolvconf-hooks/ you can put one of these lines in /etc/dhclient.conf or /etc/dhcp/dhclient.conf :

supersede domain-name-servers 202.54.1.2, 199.2.3.4;

OR

prepend domain-name-servers 1.2.3.4, 1.2.3.5;

-replacing the IPs with your desired DNS servers. (Duh...) :)

1
  • You can also see the most relevant options via man dhclient.conf in a terminal. For this answer, search (/) for supersede.
    – milli
    Commented Dec 31, 2014 at 17:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .