GNU/Linux: Set manual DNS, but use rest from DHCP
Posted: Fri Oct 30, 2015 7:47 pm
Here is how you configure a Debian/Ubuntu based DHCP client in a way that it receives all information from a DHCP server, but uses different DNS servers.
This can be useful in cases where multiple local DNS are used, but the DHCP server can't be configured to handle that properly (e.g. DHCP is router or Windows, etc).
1) Edit dhclient.conf:
Change "mydomain.local" to match your desired domain suffix.
And the domain-name-server IP to point to your desired DNS.
I've left localhost "127.0.0.1", because that's a very popular case for this.
3) Restart the network interface:
For example for "eth0":
Links:
Configuring Static DNS with DHCP on Debian/Ubuntu (by Raam Dev)
This can be useful in cases where multiple local DNS are used, but the DHCP server can't be configured to handle that properly (e.g. DHCP is router or Windows, etc).
1) Edit dhclient.conf:
- Debian: /etc/dhclient.conf
- Ubuntu: /etc/dhcp3/dhclient.conf
Code: Select all
supersede domain-name "mydomain.local";
prepend domain-name-servers 127.0.0.1;
And the domain-name-server IP to point to your desired DNS.
I've left localhost "127.0.0.1", because that's a very popular case for this.
3) Restart the network interface:
For example for "eth0":
Code: Select all
$ ifdown eth0
$ ifup eth0
Configuring Static DNS with DHCP on Debian/Ubuntu (by Raam Dev)