ZeroTierOne icon indicating copy to clipboard operation
ZeroTierOne copied to clipboard

Windows interface and route metrics

Open laduke opened this issue 3 years ago • 2 comments

5 is the lowest metrics an interface will get based on Windows Automatic Metrics as far as I know. https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/automatic-metric-for-ipv4-routes

If we set our metric to 3, there's a chance Windows will use it for broadcast traffic, and things like game discovery will work. If the user doesn't want that, they can leave the zerotier network or manually set the metric on their physical interface to < 3.

For routes with "via"'s we put the metric high, in case it overlaps with a physical route to the same subnet.

These could be plumbed through and set via the controller or local.conf someday, istead of being hardcoded magic numbers.

laduke avatar Jan 07 '22 21:01 laduke

Caveat for the Interface metric:

There are a small amount of service providers out there that use zerotier as just a remote access into user's PC. They don't necessarily want the zerotier network to take over broadcast on the user's machine.

laduke avatar Jan 10 '22 19:01 laduke

Yeah. We're probably going to want a flag a la allowDefault to enable/disable this

glimberg avatar Jan 10 '22 19:01 glimberg

Happy new year! What should we do about this PR?

someara avatar Dec 13 '22 10:12 someara

Need to make it user configurable in some way.

laduke avatar Dec 13 '22 16:12 laduke

took a look at this again. It seems like the config needs to go in the local network settings ala allowManaged, like grant said above. Which is not local.conf nor the network config from the controller.

cat ./networks.d/d5e04297a1123456.local.conf 
allowManaged=1
allowGlobal=0
allowDefault=0
allowDNS=0

something like

cat ./networks.d/d5e04297a1123456.local.conf 
allowManaged=1
allowGlobal=0
allowDefault=0
allowDNS=0
interfaceMetric=2
routeMetric=5000

Not every OS has interface metrics or route metrics, so their could be a little confusion. Changing those values could be added to a UI in the future. It's a lot of plumbing. I'm not sure if I'm going to do try it right now.

laduke avatar Dec 20 '22 23:12 laduke

🙅 I think integrating something like winipbroadcast is better.

classic thread for reference https://social.technet.microsoft.com/Forums/windows/en-US/72e7387a-9f2c-4bf4-a004-c89ddde1c8aa/how-to-fix-the-global-broadcast-address-255255255255-behavior-on-windows?forum=w7itpronetworking

laduke avatar Dec 21 '22 15:12 laduke

Rebasing the dev branch into this to keep it from drifting too far

someara avatar Jan 19 '23 08:01 someara

Thanks! I'm gonna close this. I don't think we want to do it this way. When we delete the branch, does the extra context in the PR go away?

laduke avatar Jan 19 '23 19:01 laduke

RegSetKeyValueA(tcpIpInterfaces, _netCfgInstanceId.c_str(), "InterfaceMetric", REG_DWORD, &metric, sizeof(metric));

laduke avatar Jan 19 '23 19:01 laduke