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.
-
Why don't you use NetworkManager ?– RabinCommented Dec 30, 2014 at 15:01
Add a comment
|
1 Answer
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...) :)
-
You can also see the most relevant options via
man dhclient.conf
in a terminal. For this answer, search (/) for supersede.– milliCommented Dec 31, 2014 at 17:20