DHCP Broadcast flag handling in Windows 7

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_MACHINESYSTEMCurrentControlSetServicesTcpipParametersInterfaces{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_MACHINESYSTEMCurrentControlSetServicesDhcpParameters

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