Microsoft Windows DHCP Team Blog

The world's most deployed DHCP Server! Deploy and discuss about your fav. server, here!

DHCP Broadcast flag handling in Windows 7

DHCP Broadcast flag handling in Windows 7

  • Comments 20
  • Likes

1.     DHCP Broadcast flag:

DHCP messages have ‘flags’ field. The first bit in this field indicates whether the client is expecting a broadcast or unicast response from the DHCP server \ Relay agent. When the bit is set to 1, it indicates that the client expects broadcast response, and when the bit is set to 0, it indicates that the client expects a unicast response. While the majority of the DHCP Servers and Relay Agents support both the values for the broadcast flag, there are still few of them which support only either of the values of the broadcast flag.

2.     Behaviour change in Windows 7:

           In Vista, the default broadcast flag value is set to ‘1’. But it had caused inter-operability issues with some 3rd party router based DHCP Servers \ Relay agents  that did not support broadcast flag ‘1’. Therefore in Windows 7, the behaviour change introduced would try with both the values for the broadcast flag (toggling between ‘0’ & ‘1’) and also would cache the last successful broadcast bit setting for which the client received IP address. This is to ensure that the client acquires the address properly, irrespective of the support for the flag from DHCP Server \ Relay Agent. That is, during address acquisition, first the client will try with the broadcast flag set to 0 and it sends 4 DHCP DISCOVER messages at exponential intervals for a total duration of one minute. If the client does not get any response (i.e. DHCP OFFER), then broadcast flag is toggled to 1 and again 4 DISCOVER messages are sent at exponential intervals. At least one of the flag setting is expected to succeed when the DHCP server \ Relay Agent is reachable. The successful broadcast flag is cached, and that cached flag is used as the starting broadcast flag, during the next time of address acquisition.

Another difference is, in Vista, toggling can happen (if configured) only for the address acquisition. But in Windows 7, toggling is extended to INIT-REBOOT scenario as well. In this scenario, after getting valid address, if the client gets a disconnect - connect, then the client will first send 3 DHCP REQUESTs with the broadcast flag (with which it had acquired the address). If there is no response from the server, the client will then send 3 DHCP REQUEST with the alternate Broadcast flag. If again, there is no response, then the gateway reachability check is done. If the gateway is reachable, the old IP configuration is kept. If the gateway is also not reachable, then the old configuration is removed.

So, the default behaviour is to have starting broadcast flag as 0 and toggling is ON. This can be changed by changing the configuration settings in registry as given below.  

3.     Configuring broadcast flag settings:

 

      The default broadcast bit behaviour of Windows 7 is expected to work fine in most of the scenarios, and therefore it is least expected from the users to modify any broadcast bit related settings, unless the user clearly understands the impact. Also note that the explained registry based procedure to configure broadcast bit settings may not be maintained in future versions of windows, unless it is required. There are two kinds of broadcast flag settings that can be configured.

 

i)                    The starting broadcast flag, with which the first set of DHCP DISCOVERs start. By default it starts with ‘0’.

ii)                  The toggle setting, which will indicate whether the broadcast flag can be toggled (if the starting broadcast flag fails). By default, toggling is ON.

  

3.1 Configuring the starting broadcast flag:

The starting broadcast flag value can be specified at two levels.

i)                    For a specific interface.

ii)                  Globally based on the interface type. This option needs to be chosen, only if the value of the MediaType and PhysicalMediumType of the interface are known.

 

3.1.1  Configuring the starting broadcast flag for a specific interface :

i)                   Click Start, type regedit in the Start Search box, and then click regedit in the Programs list. If you are prompted for an administrator password for  confirmation, type your password, and click Continue.

ii)                 Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{GUID}.  In this registry path, click the (GUID) subkey that corresponds to the network adapter that is connected to the network.

iii)               Right-click DhcpConnForceBroadcastFlag, and then click Modify.

iv)                In the Value data box, type the broadcast flag (0 or 1), and then click OK.

v)                  Close Registry Editor.

vi)                Restart the machine.

 

3.1.2  Configuring the starting broadcast flag globally for an interface type:

i.                    Click Start, type regedit in the Start Search box, and then click regedit in the Programs list. Collapse this imageExpand this image If you are prompted for an administrator password for confirmation, type your password, and click Continue.

ii.                  Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dhcp\Parameters

iii.                On the Edit menu, point to New, and then click Key.

iv.                 Type DhcpGlobalForceBroadcastFlag for the name of the registry subkey, and then press ENTER.

v.                   Click DhcpGlobalForceBroadcastFlag, point to New on the Edit menu, and then click Key.

vi.                 Type the Value of MediaType(Real Value, not this string) for the name of the registry subkey, and then press ENTER. Following are some of the possible values.

 

Value of MediaType

Media

0

Unknown adapters like remote access adapters

1

Wireless

14

Ethernet

vii.                 Click Value of MediaType, point to New on the Edit menu, and then click DWORD Value to create a new registry entry.

viii.               Type Value of PhysicalMediumType (Real Value, not this string) for the name of the registry entry, and then press ENTER.

ix.                   Right-click on this registry entry, and then click Modify.

x.                     In the Value data box, type the broadcastflag(0 or 1), and then click OK.

xi.                   Review the final output. The final output should resemble the following:

[HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Dhcp \ Parameters \ DhcpGlobalForceBroadcastFlag \ Value Of MediaType] "Value of PhysicalMediumType"= dword : [1 or 0]

xii.                 Close Registry Editor.

xiii.               Restart the machine.

3.2 Configuring the toggle settings:

 This setting is used to indicate whether the client can perform toggling of broadcast flag. This setting can be defined only at the interface level. By default toggling is ON.

i.                      Click Start, type Regedit in the Start Search box, and then click regedit in the Programs list. If you are prompted for an administrator password 

             for confirmation, type your password and click Continue.

ii.                    Locate and then click the following registry subkey:  

             HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{GUID} . In this registry path, click the (GUID) subkey 

             that corresponds to the network adapter that is connected to the network.

iii.                  On the Edit menu, point to New, and then click DWORD (32-bit) Value.

iv.                  In the New Value #1 box, type DhcpConnEnableBcastFlagToggle, and then press ENTER.

v.                    Right-click DhcpConnEnableBcastFlagToggle, and then click Modify.

vi.                  In the Value data box, type 1 or 0 (ON\OFF), and then click OK.

vii.                Close Registry Editor.

viii.              Restart the machine.

4.     Verification of broadcast flag settings:

 

i)                    Install the latest network monitor from http://www.microsoft.com/downloads/ .

ii)                  Apply filter ‘DHCP’ and start capturing the packets.

iii)                In an elevated command prompt, do ipconfig /releaseName of Interface”, specify the interface name in which you want to verify.

iv)                 Then, do ipconfig /renew  Name of Interface

v)                  You can find that DHCP packets are getting captured on network monitor. Expand the flags field of DHCP DISCOVER packet, the first bit of this 

            field  denotes the broadcast flag set.

vi)                By default, you should be seeing 8 DISCOVER packets for a total duration of 2 mins. The first 4 DISCOVER packets will have the flag set to ‘0’ and the 

            next 4 will have the flag set to ‘1’.

 

5.     FAQ on broadcast flag settings:

 

i)                   I have configured the broadcast flag settings, but still the setting does not come up in DHCP messages?

            Follow the steps exactly as specified in section 3. After modifying the registry settings, immediately restart without doing any other IP  related operations. As specified in verification section (4), use netmon to verify the broadcast flag set in the DHCP message. Ensure that you are verifying the broadcast flag on the DHCP messages that originate only from your machine.

 

ii)                  I have a domain joined IPsec enabled machine and the machine does not get IP address in certain routers?

This will happen when the router does not support broadcast flag ‘1’. When DHCP DISCOVERs are sent with broadcast flag 0, the corresponding OFFERs are dropped by IPsec as they are unsolicited unicast messages. To resolve this issue, the IPsec administrators are recommended to have UDP traffic exemption from port 67 to 68 (for DHCP messages). The issue could also be solved by updating the router firmware. But since, the external routers cannot be controlled always, IPsec admins are advised to have this exemption.

 

iii)                The machine takes around a minute to get the IP configuration, when I move between networks?

This can happen if the broadcast flag supported at your source network and destination network are different. Please update your router firmware for the issue to be fixed.

 

iv)                Does the above method to configure broadcast flag settings apply to Vista as well ?

Yes. Though the default behaviour of Vista is different, the configuration and verification methods specified here, can be applied to Vista as well. In Vista, by default, the starting broadcast flag is 1 and toggling is OFF.

 

v)                  My WWAN card does not get IP address on a domain joined IPsec enabled machine ?

This is known issue in Windows 7 Beta, which is fixed in further releases of Windows 7 versions. Temporarily this be could be solved, by changing the interface-specific ‘starting broadcast flag’ to ‘1’ [See configuration section 3.1.1] 

 

6.     Troubleshooting Broadcast flag issues:

If you think, that your machine is not getting an address, because of broadcast flag issue, then here are steps to troubleshoot.

i)                    Start capturing DHCP packets on the interface, as specified in the verification section (4).

ii)                  If the default settings are not modified, you should be seeing 4 DISCOVERs sent on the first minute with a specific broadcast flag (0 by default), and during the second minute another 4 DISCOVERs will be sent with the alternate broadcast flag.

iii)                If 8 DISCOVERs are not sent as mentioned above, then verify whether the toggle setting [specified in configuration section 3.2] is correct.

iv)                If 8 DISCOVERs are properly sent and none of them got any response from the DHCP server, then it is likely that DHCP server is not reachable, and the issue is not associated with broadcast flag.

v)                  If a specific set of DISCOVERs got OFFER as the response, but still the client did not accept the OFFER, and continues sending the DISCOVER, then it is likely that you are having a router which does not support broadcast flag 1 and a domain joined IPsec enabled machine. Refer to FAQ section for the resolution.

 

 

 

 

 

Comments
  • Anybody got the DhcpGlobalForceBroadcastFlag key working on Windows 7 ?

    I'm try to set it for en ethernet card, like this :

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Dhcp\Parameters\DhcpGlobalForceBroadcastFlag\14]

    "0"=dword:00000001

    When I check with Network Monitor the broadcast flag is not set to 1.

    I've try the DhcpConnForceBroadcastFlag method and it works like a charm. But I want to set the Broadcast Flag to 1 for all the computers here on any ethernet card (I don't want to have to gess the GUID of the interface on each computer).

  • On Windows 2008 R2 Server Core, we see sometimes the IPv4 address is lost suddently. Normally DhcpConnForceBroadcastFlag is 1. When issue happened, it was o. After the flag from 0 to 1, and reboot the box, the IP address is retrieved. Anyone know how come that flag is set to 0 suddenly?

  • Great info here, hard to find...  I have had an issue with ms dhcp on server 2008r2 and using cisco iphelpers, the machines fail when firewall is in bootstate, but then succeed when domain firewall is active.  They do not fail long enough to toggle the broadcast flag and the netlogon service fails and boot time policies are not applied.  I have a scripted fix to set the broadcast flag to 1 for each interface.  Is there any change in this behavior in server 2012 / windows 8?

  • my network keep changing from home to public. this is what I did go to device manager right click wireless network device hit properties, advanced -tab and than highlight roaming sensitivity level and disable it and done, worked for me hope it works for you too good luck.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment