[CentOS] DHCP static hosts and subnet configuration

Fri Oct 17 18:52:43 UTC 2008
Filipe Brandenburger <filbranden at gmail.com>

Hi,

On Thu, Oct 16, 2008 at 15:51, Marcus Moeller <mm at gcug.de> wrote:
> This is definitely not what I am trying to do. I try to line out the
> setup again:
>
> Subnet A (192.168.2.x) <-> DHCP Server with 2 NICs <-> Subnet B (10.1.0.0)
>
> Clients on Subnet A should get a static IP from the host declaration.
> Clients on Subnet B should obtain dynamic IP addresses from a range.
>
> The two subnets are not physically connected but a Client should be
> able to connect to Subnet A or to Subnet B as well.

I'm no DHCP expert, but I believe that to accomplish what you are
trying to do you have to run two separate dhcpd instances, one for
each interface. You can do that by passing a parameter to dhcpd of
which interface it should bind to. You will also need separate config
files, lease files, pid files, etc. (it might be a PITA, but it's the
only way I see that it can be done on the same host.)

See "man dhcpd" for the details, but I think it would be something like:

# dhcpd -cf /etc/dhcpd-subnetA.conf -lf
/var/lib/dhcpd/dhcpd-subnetA.leases -pf /var/run/dhcpd-subnetA.pid
eth0
# dhcpd -cf /etc/dhcpd-subnetB.conf -lf
/var/lib/dhcpd/dhcpd-subnetB.leases -pf /var/run/dhcpd-subnetB.pid
eth1

And then you will still have to deal with startup and shutdown,
initscripts, SELinux, managing both processes, ...

If you really want to go that route, you might consider running two
VMs on that hardware, one for each network, it might prove to be
simpler than running two instances of dhcpd in one host at the end.

Otherwise, you could just assign static IPs on both networks for hosts
that can connect to both, as you said that works, you only have to
keep track of the fixed addresses then...

HTH,
Filipe