Multi-homed, multi-DHCP client (GNU/Linux)
Posted: Thu Jun 05, 2014 5:05 pm
I've had the problem that when I have a machine connected to more than 1 physical network, where each one has its own DHCP, there are problems:
It would be great to have the name-resolution (/etc/resolv.conf) settings combined, by merging the information gathered from each network - but by default, one DHCP-client just overwrites the other network's settings.
Here's a quick HowTo what worked for me on Debian Squeeze (6.0.2):
1) Setup your network interfaces as usual:
Let's assume we have "eth0" and "eth1" for each network. Both networks have their own DHCP server running.
In /etc/network/interfaces, configure eth0 and eth1 to receive their settings automatically:
2) Configure dhclient *not* to update DNS settings:
On Debian-based systems, the default DHCP client implementation is the "isc-dhcp-client".
Edit its config file in /etc/dhcp/dhclient.conf. The default settings look like this:
The important options are "domain-name-servers" and "domain-search": Disable them, by commenting them out.
The resulting config block looks like this:
3) Configure a DNS-forwarding:
Now, when dhclient updates the DHCP leases, it will not use DNS information provided by the DHCP server.
That's good (so there's no interference of DHCPs providing either the one or the other DNS), but now you need DNS-forwarding.
Install "bind9" DNS server package:
Save a copy of /etc/bind/named.conf.options and enter the DNS of your individual networks in the "forwarders {}" section.
For example, if eth0 network is "192.168.100.x/24", and eth1 network is "192.168.200.x/24", which both have their own DNS, at let's say "192.168{100,200}.2", the named.conf.options would look like this:
Depending on your access patterns, you might want to arrange the lookup-order of the DNS entries so that more-frequently requested domain hostnames are resolved first.
As I've said: I think there's a better way to do it (maybe using resolvconf?), but I haven't figured it out yet.
Good luck!
Links:
It would be great to have the name-resolution (/etc/resolv.conf) settings combined, by merging the information gathered from each network - but by default, one DHCP-client just overwrites the other network's settings.
Here's a quick HowTo what worked for me on Debian Squeeze (6.0.2):
1) Setup your network interfaces as usual:
Let's assume we have "eth0" and "eth1" for each network. Both networks have their own DHCP server running.
In /etc/network/interfaces, configure eth0 and eth1 to receive their settings automatically:
Code: Select all
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
On Debian-based systems, the default DHCP client implementation is the "isc-dhcp-client".
Edit its config file in /etc/dhcp/dhclient.conf. The default settings look like this:
Code: Select all
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
The resulting config block looks like this:
Code: Select all
request subnet-mask, broadcast-address, time-offset, routers, domain-name,
# domain-name-servers, domain-search,
host-name, netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
Now, when dhclient updates the DHCP leases, it will not use DNS information provided by the DHCP server.
That's good (so there's no interference of DHCPs providing either the one or the other DNS), but now you need DNS-forwarding.
Install "bind9" DNS server package:
Code: Select all
$ apt-get install bind9
For example, if eth0 network is "192.168.100.x/24", and eth1 network is "192.168.200.x/24", which both have their own DNS, at let's say "192.168{100,200}.2", the named.conf.options would look like this:
Code: Select all
options {
directory "/var/cache/bind";
// LAN area DNS servers to use:
forwarders {
192.168.100.2;
192.168.200.2;
};
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
As I've said: I think there's a better way to do it (maybe using resolvconf?), but I haven't figured it out yet.
Good luck!
Links: