Configuring a DHCP server to serve multiple subnets on the same VLAN

22,637

If you want your DHCP server to receive client requests from other networks, you will need to set up a DHCP relay in each such network, and each relay will need to be configured to forward client requests to your DHCP server. I believe that the ISC DHCP package is capable of providing relay service, but I have never used it in that capacity. Many routers can also be configured to act as DHCP relays on networks they're attached to.

In your case, it seems logical to configure a DHCP relay on 100.100.68.1, since it's a router. However, any server (with a static IP) on the 100.100.68.0/24 network could just as easily fill that role.

(By the way, DHCP servers never broadcast, they always send direct (unicast) messages.)

Share:
22,637

Related videos on Youtube

Ben Webber
Author by

Ben Webber

Updated on September 17, 2022

Comments

  • Ben Webber
    Ben Webber almost 2 years

    I have a VLAN composed of multiple subnets, and I would like to use DHCP to centralize IP address designation.

    The DHCP server (100.100.25.88) is a Debian machine on the subnet 100.100.25.64/27. I would like to assign IP addresses to machines in the subnet 100.100.68.0/24. The ultimate goal is to enable PXE booting on all machines in the 100.100.68.0/24 subnet.

    Below is my dhcpd.conf file,

    # DHCP Configuration file
    use-host-decl-names on;
    ddns-update-style interim;
    ignore client-updates;
    next-server 100.100.25.88;
    
    # Subnet of DHCP server
    subnet 100.100.25.64 netmask 255.255.255.224 {
            option subnet-mask              255.255.255.224;
            range dynamic-bootp             100.100.25.66 100.100.25.94;
            default-lease-time              21600;
            max-lease-time                  43200;
            option domain-name-servers      100.100.25.69, 100.100.44.21;
            option routers                  100.100.25.65;
            filename "pxelinux.0";
    }
    
    # Subnet of client machines
    subnet 100.100.68.0 netmask 255.255.255.0 {
            range dynamic-bootp             100.100.68.10 100.100.68.200;
            option subnet-mask              255.255.255.0;
            default-lease-time              21600;
            max-lease-time                  43200;
            option domain-name-servers      100.100.25.69, 100.100.44.21;
            option routers                  100.100.68.1;
            option broadcast-address        100.100.68.255;
            filename "pxelinux.0";
            allow unknown-clients;
    }
    

    The way I understand DHCP, the DHCP server should be broadcasting packets to broadcast address specified for the second subnet, 100.100.68.255. No clients are able to retrieve an IP address, though. Is this an error in my DHCP configuration, or possibly because the router does not enable DHCP relays?

    Thanks!

    • Steven Monday
      Steven Monday over 13 years
      Surely, in your second paragraph, you meant to say 100.100.68.0/24, not 100.100.68.0/255!
    • Ben Webber
      Ben Webber over 13 years
      I did indeed, whoops!
  • Ben Webber
    Ben Webber over 13 years
    Thanks for your quick response, Steven. So, were I to point the ip helper-address on the Cisco router at 100.100.68.1 to my DHCP server, DHCP requests on the 100.100.68.0/24 subnet would be filled properly?
  • Steven Monday
    Steven Monday over 13 years
    @Ben: Provided that everything is configured correctly, yes, I believe so. Just be aware that, by default, ip helper-address forwards broadcasts for a number of ports/protocols, in addition to DHCP.
  • Ruisu
    Ruisu almost 13 years
    How does DHCP decide which scope to use when handing out an IP address? DHCP receives the broadcast request for an IP and DHCP replies via unicast with an IP from one of its scopes. How does it decide which scope to pull the IP from?
  • bgmCoder
    bgmCoder over 10 years
    I asked a similar question (different scope) here, if anyone is interested and if it helps anyone: serverfault.com/questions/575897/…