When an application sends a packet to the global broadcast IP address
255.255.255.255, I would like that the packet be sent to the Ethernet global broadcast address (
ff:ff:ff:ff:ff:ff), on all interfaces.
On Linux and probably other OSes as well this seems to work. Windows XP and Windows 7 exhibit different behaviors about this, and neither behaviour is desirable for my situation.
Windows XP behavior
The packet will be sent correctly to the first network interface (interface order is specified in "Network Connections/Advanced/Advanced Settings"). It will also be sent to the other interfaces.
Everything is right so far. Problem is, when sending to the other interfaces, the source address of the broadcast packet is the IP address of the first interface. For example, imagine this network configuration (order is important):
- Adapter 1: IP address
- Adapter 2: IP address
- Adapter 3: IP address
Now if I send a broadcast packet, the following packets will be sent (with source and destination IP addresses):
On adapter 1:
On adapter 2:
On adapter 3:
In practice, applications using broadcast packets won't work on any interfaces other than adapter 1. In my opinion, this is a blatant bug in the TCP/IP stack of Windows XP.
Windows 7 behavior
Modifying the network interface order doesn't seem to have any effect on Windows 7. Instead, broadcast seems to be controlled by the IP route table.
IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.202.254.254 10.202.1.2 286 0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.3 10 10.202.0.0 255.255.0.0 On-link 10.202.1.2 286 10.202.1.2 255.255.255.255 On-link 10.202.1.2 286 10.202.255.255 255.255.255.255 On-link 10.202.1.2 286 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 192.168.0.0 255.255.255.0 On-link 192.168.0.3 266 192.168.0.3 255.255.255.255 On-link 192.168.0.3 266 192.168.0.255 255.255.255.255 On-link 192.168.0.3 266 188.8.131.52 240.0.0.0 On-link 127.0.0.1 306 184.108.40.206 240.0.0.0 On-link 192.168.0.3 266 220.127.116.11 240.0.0.0 On-link 10.202.1.2 286 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 192.168.0.3 266 255.255.255.255 255.255.255.255 On-link 10.202.1.2 286 ===========================================================================
255.255.255.255 routes? Yep, they control broadcast packets. In this situation, broadcast packets will be send via the
192.168.0.3 because it has the lower metric... but not to the other interfaces.
You can change the interface through which global broadcast packets will be sent very easily (just add a persistent
255.255.255.255 route with a low metric). But no matter how hard you try, broadcast packets will only be sent on only one interface, not all of them like I'd like it to do.
- Windows 7 only sends broadcast packets to one interface. You can choose which one, but that's not the point here.
- Windows XP sends broadcast packets to all interfaces, but it only sends them as expected to one interface, which in practice is equivalent to the Windows 7 behavior.
I want to change this global IP broadcast support in Windows (preferably Windows 7) once and for all. Of course the better way would be to have some kind of supported configuration change (registry hack or similar), but I'm open to all suggestions.