Partager via


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

Comments

  • Anonymous
    January 01, 2003
    214 Microsoft Team blogs searched, 92 blogs have new articles in the past 7 days. 218 new articles found

  • Anonymous
    January 01, 2003
    Hello I have the same issue with windows 7 32-bit not picking up IP from a 2K3 DHCP server, these are Intel DG45FC ITX with core 2 duo E8500, the Windows 7 64-bit works on the fly but some how with 32-bit does not. Please help. I got that dhcptrace directory will send it to you via email Thanks Bill

  • Anonymous
    January 01, 2003
    Anybody got the DhcpGlobalForceBroadcastFlag key working on Windows 7 ? I'm try to set it for en ethernet card, like this : [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetservicesDhcpParametersDhcpGlobalForceBroadcastFlag14] "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).

  • Anonymous
    January 01, 2003
    hi Patrick, This looks to be some issue where the offer is not reaching DHCP client or being dropped by DHCP client because of some reason and then DHCP client sending the Discovers again and again. In order for us to investigate the issue, please provide us the DHCP traces, steps being mentioned in one of the above comments on this blog by teamdhcp. Please let me know in case you face any issue or have any doubt. Thanks Ranu

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    hi Martina, On troubleshooting you get " dhcp is not enabled" as you applied static IP address on the adapter. Without typing in the IP address, please try to troubleshoot before even typing the IP address. Also, can you please provide me the DHCP traces as mentioned above in one of the comments. Please start the tracing, let your computer be idle for long period, then resume it and see if you get the connectivity. As you said you should not have get the connectivity. Wait for 3-4 mins. Then stop the tracing. Also, when you don't get connectivity, try doing "ipconfig /release and ipconfig /renew" and see if you get the connectivity. Also try connect/discoonect on adapter and disable/enable and let us know if you are able to get connectivity with any of these. Thanks teamdhcp

  • Anonymous
    January 01, 2003
    hi, In order to figure out if your issue is due to DHCP or not, please try the folowing: Try assigning static IP address on Win7RC and then see if the issue is still there. Please provide us the exact repro steps.In order to figure out the issue, please provide us DHCP traces at dhcpblog at microsoft dot com.

  1. Copy-paste the following exact instructions in a dhcptrace.cmd file @echo off IF "%1" == "-start" ( netsh dhcpclient trace disable > NUL netsh trace stop > NUL echo. echo Starting dhcp trace.. echo. del /Q %TEMP%DhcpTraces echo. echo Creating the folder %TEMP%DhcpTraces echo. mkdir %TEMP%DhcpTraces ipconfig /all > %TEMP%DhcpTracesIpConfigStart.txt REG QUERY "HKLMSOFTWAREMicrosoftWindows NTCurrentVersion" /v BuildLabEx > %TEMP%DhcpTracesBuildLabVersion.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesTcpipParameters" /s > %TEMP%DhcpTracesTcpIpParametersStart.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesTcpip6Parameters" /s > %TEMP%DhcpTracesTcpIp6ParametersStart.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesDhcpParameters" /s > %TEMP%DhcpTracesDhcpParametersStart.txt netsh trace start scenario=AddressAcquisition ^ provider=Microsoft-Windows-TCPIP ^ provider=Microsoft-Windows-winsock-AFD ^ provider=Microsoft-Windows-WFP ^ tracefile=%TEMP%DhcpTracesaddracq-cap.etl protocol=UDP overwrite=yes report=no capture=yes >> %TEMP%DhcpTracesOtherLogs.txt netsh dhcpclient trace enable >> %TEMP%DhcpTracesOtherLogs.txt netsh dhcpclient trace dump copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpv4trace.log %TEMP%DhcpTracesdhcpv4tracestart.log >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpv6trace.log %TEMP%DhcpTracesdhcpv6tracestart.log >> %TEMP%DhcpTracesOtherLogs.txt echo Dhcp tracing successfully started goto eof ) IF "%1" == "-stop" ( echo. echo Stopping dhcp trace. Please wait for a few seconds.. ipconfig /all > %TEMP%DhcpTracesIpConfigStop.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesTcpipParameters" /s > %TEMP%DhcpTracesTcpIpParametersStop.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesTcpip6Parameters" /s > %TEMP%DhcpTracesTcpIp6ParametersStop.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesDhcpParameters" /s > %TEMP%DhcpTracesDhcpParametersStop.txt netsh dhcpclient trace disable >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpcsvc.etl %TEMP%DhcpTracesdhcpcsvc.etl >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpcsvc6.etl %TEMP%DhcpTracesdhcpcsvc6.etl >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpqec.etl %TEMP%DhcpTracesdhcpqec.etl >> %TEMP%DhcpTracesOtherLogs.txt netsh dhcpclient trace dump copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpv4trace.log %TEMP%DhcpTracesdhcpv4traceend.log >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpv6trace.log %TEMP%DhcpTracesdhcpv6traceend.log >> %TEMP%DhcpTracesOtherLogs.txt netsh trace stop >> %TEMP%DhcpTracesOtherLogs.txt move /y %TEMP%DhcpTracesaddracq-cap.etl %TEMP%DhcpTracesaddracq-cap-uncorrelated.etl >> %TEMP%DhcpTracesOtherLogs.txt netsh trace correlate %TEMP%DhcpTracesaddracq-cap-uncorrelated.etl %TEMP%DhcpTracesaddracq-cap.etl retainpii=yes >> %TEMP%DhcpTracesOtherLogs.txt echo. echo Dhcp tracing successfully stopped. echo. echo Trace Location: %TEMP%DhcpTraces echo. echo Please send this folder to the feature team. goto eof ) echo -start : starts the dhcp trace echo -stop : stops the dhcp trace echo  eg: : dhcptrace -start echo  : dhcptrace -stop :eof
  2. Now on a machine where you are able to repro this issue, in an elevated prompt,  please run "dhcptrace.cmd -start"
  3. Repro the issue. You should not have seen the connectivity as you said.
  4. After repro is over, wait for 2 mins and then run "dhcptrace.cmd -stop"
  5. The log files are copied in %TEMP%dhcptraces.
  6. Please compress and send us this folder. It will be really helpful if you can provide us the above mentioned logs to figure out the exact issue. Thanks
  • Anonymous
    January 01, 2003
    hi Dennis, Do you mean that if you try to join a new XP machine instead of Win7, then things are OK and server assigns address properly but if a new Win7 machine is joined to the network, it will always lead to getting an address marked as "Bad Address"? Do some machines have static IP address in the network due to which the address is marked as "Bad Address"? Please explain the scenario and the issue in details. If possible, please also provide netmon capture to us when the Windows 7 machine tries to connect to the server and causes the issue. Thanks teamdhcp

  • Anonymous
    January 01, 2003
    hi Michael, In order to figure out if your issue is due to DHCP or not, please try the folowing: Please provide us the exact repro steps.In order to figure out the issue, please provide us DHCP traces at dhcpblog at microsoft dot com.

  1. Copy-paste the following exact instructions in a dhcptrace.cmd file @echo off IF "%1" == "-start" ( netsh dhcpclient trace disable > NUL netsh trace stop > NUL echo. echo Starting dhcp trace.. echo. del /Q %TEMP%DhcpTraces echo. echo Creating the folder %TEMP%DhcpTraces echo. mkdir %TEMP%DhcpTraces ipconfig /all > %TEMP%DhcpTracesIpConfigStart.txt REG QUERY "HKLMSOFTWAREMicrosoftWindows NTCurrentVersion" /v BuildLabEx > %TEMP%DhcpTracesBuildLabVersion.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesTcpipParameters" /s > %TEMP%DhcpTracesTcpIpParametersStart.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesTcpip6Parameters" /s > %TEMP%DhcpTracesTcpIp6ParametersStart.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesDhcpParameters" /s > %TEMP%DhcpTracesDhcpParametersStart.txt netsh trace start scenario=AddressAcquisition ^ provider=Microsoft-Windows-TCPIP ^ provider=Microsoft-Windows-winsock-AFD ^ provider=Microsoft-Windows-WFP ^ tracefile=%TEMP%DhcpTracesaddracq-cap.etl protocol=UDP overwrite=yes report=no capture=yes >> %TEMP%DhcpTracesOtherLogs.txt netsh dhcpclient trace enable >> %TEMP%DhcpTracesOtherLogs.txt netsh dhcpclient trace dump copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpv4trace.log %TEMP%DhcpTracesdhcpv4tracestart.log >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpv6trace.log %TEMP%DhcpTracesdhcpv6tracestart.log >> %TEMP%DhcpTracesOtherLogs.txt echo Dhcp tracing successfully started goto eof ) IF "%1" == "-stop" ( echo. echo Stopping dhcp trace. Please wait for a few seconds.. ipconfig /all > %TEMP%DhcpTracesIpConfigStop.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesTcpipParameters" /s > %TEMP%DhcpTracesTcpIpParametersStop.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesTcpip6Parameters" /s > %TEMP%DhcpTracesTcpIp6ParametersStop.txt REG QUERY "HKLMSYSTEMCurrentControlSetServicesDhcpParameters" /s > %TEMP%DhcpTracesDhcpParametersStop.txt netsh dhcpclient trace disable >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpcsvc.etl %TEMP%DhcpTracesdhcpcsvc.etl >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpcsvc6.etl %TEMP%DhcpTracesdhcpcsvc6.etl >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpqec.etl %TEMP%DhcpTracesdhcpqec.etl >> %TEMP%DhcpTracesOtherLogs.txt netsh dhcpclient trace dump copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpv4trace.log %TEMP%DhcpTracesdhcpv4traceend.log >> %TEMP%DhcpTracesOtherLogs.txt copy /y %SYSTEMDRIVE%WindowsSystem32LogfilesWMIdhcpv6trace.log %TEMP%DhcpTracesdhcpv6traceend.log >> %TEMP%DhcpTracesOtherLogs.txt netsh trace stop >> %TEMP%DhcpTracesOtherLogs.txt move /y %TEMP%DhcpTracesaddracq-cap.etl %TEMP%DhcpTracesaddracq-cap-uncorrelated.etl >> %TEMP%DhcpTracesOtherLogs.txt netsh trace correlate %TEMP%DhcpTracesaddracq-cap-uncorrelated.etl %TEMP%DhcpTracesaddracq-cap.etl retainpii=yes >> %TEMP%DhcpTracesOtherLogs.txt echo. echo Dhcp tracing successfully stopped. echo. echo Trace Location: %TEMP%DhcpTraces echo. echo Please send this folder to the feature team. goto eof ) echo -start : starts the dhcp trace echo -stop : stops the dhcp trace echo  eg: : dhcptrace -start echo  : dhcptrace -stop :eof
  2. Now on a machine where you are able to repro this issue, in an elevated prompt,  please run "dhcptrace.cmd -start"
  3. Repro the issue. You should not have seen the connectivity as you said.
  4. After repro is over, wait for 2 mins and then run "dhcptrace.cmd -stop"
  5. The log files are copied in %TEMP%dhcptraces.
  6. Please compress and send us this folder. It will be really helpful if you can provide us the above mentioned logs to figure out the exact issue. Thanks Ranu
  • Anonymous
    January 01, 2003
    thanks

  • Anonymous
    January 01, 2003
    hi Michael, In the earlier reply I mentioned the email id. You might have missed it.Please send the traces at  dhcpblog at microsoft dot com. Thanks Ranu

  • Anonymous
    May 27, 2009
    I am having connectivity problem in windows 7 rc 64 bit. Have to boot to xp to get the dsl modem to connect to internet then only it works in windows 7 rc is it due to dhcp problem? How can I know that my connectivity problem is due to DHCP?

  • Anonymous
    June 20, 2009
    I'm using the windows 7 32bit os.  After about a week of using it I started having a problem getting on the internet.  If my computer sits too long or even if i just turn it on, I have no internet or network access.  I have to type in the IP address and trouble shoot to apply a fix everytime I want to use the internet. When I do that I get a message that said  DHCP is not enabled.  How do I fix this problem so I don't have to go through so much to use my internet?

  • Anonymous
    June 22, 2009
    A test machine windows 7 x64 has problems with dhcp. We did a trace and found that the discover is done and 2 offers are received from the client but the client does not react with a request message. We use a 3rd party dhcp server over cisco ip helper. But to be sure we used our old microsoft 2003 dhcp server and we saw that the client gets the offer also from the microsoft server but nothing. The client just issues a few more discovers. What could be the issue? ipsec domain - we don't have this enabled. Firewall has been put off. Kind regards, Patrick

  • Anonymous
    December 09, 2009
    The comment has been removed

  • Anonymous
    December 10, 2009
    Hi dhcpteam ... unfortunally you haven't provided any e-mail address where I could send the compressed content of the DhcpTraces folder to.... BTW: After all these night sessions with Win7 and all the frustrating results trying to setup the LINUX dhcpd-server and all the the other routers I decided to step back to XP ... and wait until Win8 or Win9 or Win10 is released hoping that one of these releases will work stable and without any problems, even as Win XP does. Not only for my home PCs in my lab, but also for the networks in all schools I'm administrating. Sorry, Michael. PS: But I'd like to send you the dhcp-trace results if I would get an email addy from your side :.(

  • Anonymous
    April 05, 2010
    On the DCHP server, in the Address Leases, I get Bad address showing up in the Name field on the address leases when I configure the windows 7 computer to get it IP address from the DCHP server. The Bad address slams over the name of the XP computers that have the address leased. This causes an IP conflict statement to the user of the XP computer. We have a Windows 2003 server that is handling our DHCP server.  When we connect our first Window 7 computer to the network, our DHCP server start getting Bad Address on the TCP/Ip List.  When we disconnet the Win 7 computer, the Bad Address stops. DHCP Server: server 2003 R2 Standard Edition SP 2 DHCP: Version 5.2.3790.3959 Windows 7: PRO   All Are 32 bit

  • Anonymous
    June 15, 2011
    The comment has been removed

  • Anonymous
    November 15, 2013
    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?

  • Anonymous
    February 01, 2014
    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.

  • Anonymous
    February 02, 2014
    Von BootP zu DHCP