Default Interface for Multicast on Windows
February 20th, 2009This tidbit was very hard to find. I needed to change the “default” multicast interface route in Windows. That is, I needed to change which interface Windows picks by default for outbound mulitcast traffic. I knew there was a way, but the only help I could find from Microsoft was that Windows uses the lowest metric in the routing table for multicast addresses. No examples on how to change it, and all the “expected” commands failed. Then I found this(http://www.sabi.co.uk/Notes/windowsNotes.html#mcastRoutes), and it turns out I can’t change the route because it doesn’t exist, despite the fact that “route print” says it does:
Deleting default multicast routes
When enabling a network interface MS Windows by default creates a multicast route on it which cannot be deleted.
Apparently it cannot be deleted because it is some kind of
virtualroute. But adding a similar route just overrides thevirtualroute, and it can then be deleted.Something like this works:
route add 224.0.0.0 mask 240.0.0.0 10.0.0.1 10.0.0.1 route delete 224.0.0.0 mask 240.0.0.0 10.0.0.1Deleting such a route can be useful to prevent packets being multicast on some of the interfaces of a multi-homed node.
My problem was that the interface with the lowest metric was not the one I wanted to send MCast traffic on. Since the metric was 1, I couldn’t set anything lower to override it, so I needed to set this metric to something higher. But I couldn’t do that since the entry with the metric=1 didn’t really exist.
route print 224.0.0.0
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
224.0.0.0 240.0.0.0 1.2.3.4 1.2.3.4 1
224.0.0.0 240.0.0.0 192.168.10.51 192.168.10.51 100
224.0.0.0 240.0.0.0 192.168.20.100 192.168.20.100 20
224.0.0.0 240.0.0.0 192.168.128.2 192.168.128.2 20
Default Gateway: 1.2.3.4
===========================================================================
Persistent Routes:
None
Here’s how I corrected it (the interface I don’t want to use as default is 1.2.3.4):
route add 224.0.0.0 mask 240.0.0.0 1.2.3.4 1.2.3.4
route print 224.0.0.0
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
224.0.0.0 240.0.0.0 1.2.3.4 1.2.3.4 1
224.0.0.0 240.0.0.0 192.168.10.51 192.168.10.51 100
224.0.0.0 240.0.0.0 192.168.20.100 192.168.20.100 20
224.0.0.0 240.0.0.0 192.168.128.2 192.168.128.2 20
Default Gateway: 1.2.3.4
===========================================================================
Persistent Routes:
Noneroute change 224.0.0.0 mask 240.0.0.0 64.100.82.119 metric 200
route print 224.0.0.0
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
224.0.0.0 240.0.0.0 1.2.3.4 1.2.3.4 200
224.0.0.0 240.0.0.0 192.168.10.51 192.168.10.51 100
224.0.0.0 240.0.0.0 192.168.20.100 192.168.20.100 20
224.0.0.0 240.0.0.0 192.168.128.2 192.168.128.2 20
Default Gateway: 1.2.3.4
===========================================================================
Persistent Routes:
None

