Translations: "Italiano" |
DHCP Relay on Cisco Nexus and PXE
Recently a customer asked to enable the dhcp relay feature on Cisco Nexus 9300 switches, in order to use a remote dhcp server instead of a local one.
After few days, they realized that booting an operating system in a PC through a PXE Server wasn't working anymore, because of the behavior of Cisco Nexus with DHCP broadcast packets, when DHCP relay is configured.
DHCP Relay
A client, configured to get an address through DHCP, sends a broadcast packet called DHCP Discover asking for an IP address (and other network parameters). A DHCP server, that is on the same VLAN as the client, sees the packet and replies with an offer. If the client is happy for the offer, it accepts it and the device has an IP address.
Most of the time, however, the DHCP server is not on the same VLAN as the client. In these cases it is required a device that captures the DHCP discover broadcast packet and forwards it to the DHCP server. This device is called a DHCP relay agent. Usually, the default gateway of the VLAN is configured as a DHCP relay agent. For Cisco Nexus switches, the configuration is
where 172.16.1.1 is the DHCP Server IP address.
Preboot Execution Environment (PXE)
The Preboot Execution Environment (PXE) is a method to boot a PC using an ethernet network connection and the support of a server, without the need for a mass storage unit.
With this system, a client, that receives an IP through DHCP, also receives the information needed to download a file via TFTP. This file allows the PC to boot an operating system.
DHCP Relay and PXE
Usually the PXE server also acts as a DHCP Server, but provides only the additional options used by the client to download the operating system boot file.
For this reason, when the PXE Server is on the same VLAN as the client, it replies to the DHCP Discover messages with the additional information.
Cisco Nexus and DHCP Relay
Unlike Cisco IOS, Cisco Nexus switches, when configured with the DHCP relay feature, take the DHCP Discover packet, forward it to the configured DHCP server, but do not propagate the broadcast packet to all other interfaces. On the contrary, the Cisco IOS propagate the DHCP packet as a normal broadcast on all interfaces, as well as the address of the DHCP Server.
At this link you will find a detailed description of this different behavior.
And here the problems...
After switching from a local DHCP server to a remote one, but leaving the PXE Server locally, the problem with PXE Server emerged.
Since the DHCP discover packet is a broadcast packet, and not knowing the difference in the behavior of the Cisco Nexus, I was not able to understand how PXE could no longer work after the change of the DHCP Server.
...Troubleshooting
After discovering the behavior of Cisco Nexus with dhcp relay feature, the resolution turned out to be simple. Indeed, to forward the broadcast packet to the PXE Server it is sufficient to configure the IP of the PXE Server as dhcp relay, even if it is on the same VLAN as the client.
1interface vlan 100
2 ip address 192.168.100.1
3 ip dhcp relay 172.16.1.1
4 ip dhcp relay 192.168.100.10
5end
where 192.168.100.10 is the PXE Server IP address.
Now the PXE Server receives the DHCP Discover packet and responds by providing the information necessary for the PC to be able to start the operating system.
Fixed!