12

A secondary network was configured on an interface of a Cisco 2621 router and the ip helper-address commands put in place but no clients of that secondary network could pull DHCP addresses. We swapped the primary network and the secondary network and everything started working just fine. Swapped it back and same problem as before.

Can anyone explain why this is so? Is there a way to make the forwarding of DHCP requests work for a interfaces secondary network or can it only work on the primary network?

  • I love seeing all these router solutions. The method that has been around for over two decades is to simply configure the dhcp server with a shared dhcp pool in linux / any major IPAM DHCP, or an extended DHCP pool on Microsoft's DHCP server. – user30086 Aug 29 '16 at 16:05
  • Here is a link for Microsoft's extended "Superscope". Example 3 is the most common... technet.microsoft.com/en-us/library/dd759168(v=ws.11).aspx – user30086 Aug 29 '16 at 16:09
13

Cisco routers will use the primary subnet configured on the interface for identifying forwarded DHCP requests.

The only other option is the DHCP smart relay feature, which allows a router to use the secondary subnet, but only after multiple DHCP offers for the primary subnet are not seen.

9

You have two options.

Option One: Configure DHCP smart relay (see more on this in the answers from Dave and Mierdin):

ip dhcp smart-relay

Option Two: Set up a shared-network statement in your dhcpcd.conf (assuming you're running a Linux-based DHCP server - see Peter's answer below if you aren't)

shared-network "testing" { 

subnet 192.168.2.0 netmask 255.255.255.0 { 
option routers 192.168.2.1; 
} 

subnet 192.168.1.0 netmask 255.255.255.0 { 
option routers 192.168.1.1; 
option domain-name-servers a.b.c.d; 
pool { 

} 
} 
} 
3

Only the interface's primary address is sent in the DHCPDiscover packet as the gateway IP address (giaddr) field of the DHCP packet.

You could look into using subinterfaces that allow separate DHCP relay agents (ip helper-address).

2

I'm fairly certain that when the router forwards the DHCP request it includes only the primary network configured on the interface. I don't believe there's any way to have it use the secondary network.

Edit: I did some Googling and determined what others have already pointed out, there's a feature called smart-relay that can use the secondary network, but only after the primary times out three times.

The relevant quote from Understanding and Troubleshooting DHCP in Catalyst Switch or Enterprise Networks - Cisco Systems

How to make DHCP Work on Secondary IP Segments

By default, DHCP has a limitation in that the reply packets are sent only if the request is received from the interface configured with the primary IP address. DHCP traffic uses the broadcast address. When the DHCP request is received by the router interface, it forwards it to the DHCP server (when IP helper-address is configured) with a source address of the primary IP configured on the interface to let the DHCP server know which IP pool it must use (for the client) in the DHCP reply packet.

There is no way for the router to know if the DHCP broadcast request comes from a device that is on the secondary IP network configured on the interface. As a workaround, sub-interface configuration (provided that the device connected to the router supports dot1q tagging) to separate the two subnets can be configured, so both of them get their correspondent IP addresses properly.

If the secondary address is the preferred way, there is another workaround, which is to enable the global configuration command ip dhcp smart-relay . This has a limitation in that it only uses the secondary IP to relay the DHCP request if there is no response from the DHCP server after three consecutive requests for the primary address pool.

2

With Microsoft DHCP servers (and perhaps others) you can use superscopes to have it hand out from the secondary addresses.

Using DHCP to Assign IP Addresses to Secondary Networks

Some routers can be configured with primary and secondary addresses that allows one port on a router to listen to multiple (logical) subnets.

Windows NT 4.0 Service Pack 2 and later introduced Superscoping support for DHCP. This allows a DHCP server with one network interface card to assign leases for multiple logical subnets.

To setup Superscopes in DHCP Manager, perform the following steps:

  • Create a new scope in DHCP Manager that corresponds with the primary subnet on the router.
  • Create the Superscopes that will be a part of the secondary address(es) configured on the router.
  • Use the DHCP Manager to define the Superscope to include all the subnets.

For complete steps on how to setup DHCP Superscoping, please refer to the following article in the Microsoft Knowledge Base: 161571 Using DHCP Superscopes to Serve Multiple Logical Subnets

1

When a DHCP request is sent out its broadcasted from the primary address. So when its sent to whatever helper ip address that is specified, that server will see it coming from the primary ip address. On like a microsoft server, you need to set up the primary and secondary subnet into a superscope. It will draw from the secondary pool only after the first pool has exhausted the available ip addresses in the primary pool. I have heard of the smart-relay, but haven't played around with it yet.

0

configure ip-helper address on the subinterfaces too with the same helper ip.. no smart-relay.. i tried it and it worked in GNS3..not tested in live ..!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.