How does windows treat interface metric (which you can set at interface ip settings) and route settings? Which one does it prefer? What if I have interface with metric 1 but for this address there is other interface route with higher metric?
The route with the lowest metric is chosen.
Q: What if I have interface with metric 1 but for this address there is other interface route with higher metric?
If you have similar routes with different metrics, the lowest metric route for the destination is chosen.
In case of overlapping routes, keep in mind that route matches with longer netmasks are always better than route matches matches with shorter netmasks (so route match length is more important than lower metric). If you ever have a question about which route windows chose for a destination, use
route print <destination> from the cmd prompt
[Mike_Pennington@Win7 ~]$ route print 127.0.0.1 =========================================================================== Interface List 15...5c 26 0a 39 ac 9d ......Intel(R) 82577LM Gigabit Network Connection 12...58 94 6b e4 c8 28 ......Intel(R) Centrino(R) Advanced-N 6200 AGN 1...........................Software Loopback Interface 1 24...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 11...00 00 00 00 00 00 00 e0 Microsoft Teredo Tunneling Adapter =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 <--- =========================================================================== Persistent Routes: None IPv6 Route Table =========================================================================== Active Routes: None Persistent Routes: None [Mike_Pennington@Win7 ~]$
From Metric | Microsoft Docs:
When routes are chosen, the overall metric used to determine the preference is the sum of the route metric and the interface metric.
This question had bothered me for hours before I stumbled on this.