DHCP server serves client with expected IP address and network, but unexpected gateway ("option routers")

Solution Verified - Updated -

Issue

  • When requesting an IP address through DHCP, the DHCP client gets an IP address in expected subnet but the gateway from another subnet definition

    • Excerpt of the DHCP server configuration (/etc/dhcp/dhcpd.conf)

      subnet 10.0.1.0 netmask 255.255.255.0 {
          option subnet-mask 255.255.255.0;
          option routers 10.0.1.1;
          range 10.0.1.100 10.0.1.200;
          class "pxeclients" {
              match if substring(option vendor-class-identifier, 0,9) = "PXEClient";
              next-server 10.0.0.254;
              filename "pxelinux.0";
          }
      }
      
      subnet 10.0.99.0 netmask 255.255.255.0 {
          option subnet-mask 255.255.255.0;
          option routers 10.0.99.1;
          range 10.0.99.100 10.0.99.200;
          class "pxeclients" {
              match if substring(option vendor-class-identifier, 0,9) = "PXEClient";
              next-server 10.0.0.254;
              filename "pxelinux.0";
          }
      }
      

    With this configuration, DHCP clients in network 10.0.99.0/24 are supposed to get 10.0.99.1 as the default gateway.

    • DHCP client in network 10.0.99.0/24 booting with iPXE or PXE shows the following configuration (example, could be another output)

      Configuring (net1 52:54:00:34:c6:5a) ............. ok
      net1: 10.0.99.100/255.255.255.0 gw 10.0.1.1
      [...]
      

    Here we can see that the DHCP client in network 10.0.99.0/24 got an expected IP address, but wrong gateway (it got the gateway from another subnet).

    • Network capture on the DHCP server using tshark shows the following DHCP reply

      Frame 5: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
      [...]
      Bootstrap Protocol
          Message type: Boot Reply (2)
          [...]
          Your (client) IP address: 10.0.99.100 (10.0.99.100)
          Next server IP address: 10.0.0.254 (10.0.0.254)
          Relay agent IP address: 0.0.0.0 (0.0.0.0)
          [...]
          Option: (3) Router
              Length: 4
              Router: 10.0.1.1 (10.0.1.1)
          [...]
      
  • DHCP clients requesting an IP address through using the dhclient utility get the expected gateway

Environment

  • Red Hat Enterprise Linux
    • dhcp-server
    • multihomed DHCP server

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content