Tuesday, January 25, 2011

Linux DHCP 2 networks

I have 2 networks (192.168.1.0/24 & 192.168.2.0/24), and 1 DHCP server.
I need to serve DHCP for 2 networks, but it doesn't work. Second network (192.168.2.0/24) (PC & Notebook) always gets IP from 192.168.1.0/24 range despite that it has 2 ranges. How I should to configure it?

Router OS: Ubuntu Server 10.04
Client OS: Ubuntu 10.04

See UML

  • The problem with two subnets is, how the dhcp server should decide which one to provide. I would give defined host entries for you computers:

    host notebook {
        hardware ethernet 00:AB:CD:EF:GG:GG;
        fixed-address 192.168.2.10;
    }
    
    Chris S : No, the DHCP server will give an address that corresponds with the NIC where the request was received. This applies by extension to DHCP Proxies, using the NIC where the original DHCP Discover was received.
    From TooAngel
  • Is the DHCP server dual-homed (has an IP address on both networks)? Your DHCP server should have an interface listening on each subnet: one listening to the 192.168.1.0/24 network and the other listening to the 192.168.2.0/24 network. The startup for dhcpd should be configured to listen on each interface.

    Dhcpd also has the option to create a shared network containing both subnets, but I think this will essentially pool your addresses and you won't be able to control which machines receive addresses for a particular subnet.

    Chris S : +1, You can also use a DHCP proxy if the server isn't on the subnet you want to serve, but it's generally not the best idea.

0 comments:

Post a Comment