Changing the TTL value in the DHCPDISCOVER packet (or in any broadcast packet)

This article describes how to change the TTL (time to live, or hop limit) value in the DHCPDISCOVER packet (or in any broadcast packet) to help prevent interoperability issues.

The goal is to help prevent any interoperability issues by increasing the TTL value of the DHCPDISCOVER packet.

DHCPDISCOVER (or other broadcast packets) uses the variable net.inet.ip.mcast_ttl to set the value of TTL.

The variable is described as follows on a shell prompt through sysctl:

By default, the value of the variable is 1:

The default TTL value in Discover packets from SRX is 1, as seen in this example packet capture.

When SRX acts as a DHCP client, it sends a DHCPDISCOVER packet with a TTL value of 1. This can cause interoperability issues with some devices (such as ProCurve, from HP), which, when acting as relays before sending requests to DHCP servers, decrease the TTL.

Changing the TTL Value in the DHCPDISCOVER packet

To change the TTL value, use the command below:

Verify that the value was changed from 1 to 2 by using the command below:

Now, delete and reconfigure DHCP on the interface (if the interface is not configured, ignore this step):

Take a new packet capture. Note that in the DHCPDISCOVER packets seen in the example, the TTL is changed to 64. But, it is recommended that you do not change the TTL to more than 2-3 hops, unless required.
Note: These changes are not permanent and will be lost when the device is rebooted.

To have the device retain the changes after a reboot, edit the /etc/rc.custom file (from the shell prompt), and add the following content:


About the author


Leave a Comment