Monday, June 24, 2013

How to configuer DHCP Servers with Multiple NIC ?

Edit your /etc/sysconfig/network-scripts/ifcfg-eth* files and specify 
which ones should be using DHCP.
Well.... It totally depends on what you need to do :) 
Here's a simple config that services one nic but not the other (sanitized) 
ddns-update-style interim; 
ddns-updates off; 
subnet xxx.194.0 netmask 255.255.255.128 { 
range xxx.194.40 198.209.194.79; 
default-lease-time 86400; 
max-lease-time 86400; 
option routers xxx..194.126; 
option ip-forwarding off; 
option broadcast-address xxx.194.127; 
option subnet-mask 255.255.255.128; 
option domain-name-servers xxx.101.8, xxx.1.29; 

subnet 10.0.0.0 netmask 255.0.0.0 { 

When a DHCP client broadcasts a request, it does so to 255.255.255.255. If your DHCP server has more than on NIC you have to add a route for 255.255.255.255 for the interface you want to send the reply. If you don't, the request is sent to the default gateway. 
From this point I'll assume eth0 is the NIC of choice for your DHCP interface 
This could be as easy as 
route add -host 255.255.255.255 dev eth0 
but that won't survive a reboot. 
You will want to add a permanent route - so you will want to include that route add command to /etc/rc.local 
Hi - 
If I recall correctly, dhcpd doesn't deal with "interfaces" directly, but rather, resolves which interface it is dealing with based on which subnet is bound to which NIC. It makes perfect sense really, as a DHCP server could serve multiple networks on as many as one or infinite networks. 
Just be wary of which IP is bound to which interfaces, and don't think of dhcpd as serving on a particular NIC, but rather a particular subnet. 



0 comments:

Post a Comment

 
Design by BABU | Dedicated to grandfather | welcome to BABU-UNIX-FORUM