When a Windows/Linux system has multiple active network interfaces (e.g., Ethernet + WiFi + VPN), each with its own default gateway, the OS employs a metric-based routing decision. The gateway with the lowest metric (highest priority) becomes the de facto default route.
View current routing table in PowerShell:
Get-NetRoute -AddressFamily IPv4 | Where-Object {$_.DestinationPrefix -eq "0.0.0.0/0"} | Format-Table -AutoSize
Manually adjust interface metrics (lower = higher priority):
Set-NetIPInterface -InterfaceAlias "Ethernet" -InterfaceMetric 10
Set-NetIPInterface -InterfaceAlias "Wi-Fi" -InterfaceMetric 20
# Check routing table
ip route show
# Alternative:
route -n
# Temporary metric adjustment
sudo ip route add default via 192.168.1.1 dev eth0 metric 100
sudo ip route add default via 10.0.0.1 dev tun0 metric 200
For true multi-gateway functionality, modern kernels support policy routing tables:
# Create custom routing table
echo "200 custom_table" >> /etc/iproute2/rt_tables
# Add rules for specific traffic
ip rule add from 192.168.1.100 lookup custom_table
ip route add default via 192.168.1.254 dev eth0 table custom_table
- Check destination IP against routing table
- Evaluate interface metrics for matching routes
- Apply policy routing rules if configured
- Fall back to lowest-metric default gateway
Common issues include:
- Route flapping due to dynamic metric changes
- VPN clients overriding system defaults
- IPv4 vs IPv6 gateway conflicts
When a Windows/Linux PC has multiple network interfaces (Ethernet, Wi-Fi, VPN, etc.), each adapter can technically have its own default gateway configured. However, the operating system's routing table will only use one active default gateway at any given time for outbound traffic.
Modern OSes use these mechanisms for gateway selection:
- Metric-based selection: Interfaces have priority metrics (lower = higher priority)
- Interface speed: Faster connections typically get preference
- Manual configuration: Administrators can set route metrics
On Windows (Command Prompt):
route print
On Linux:
ip route show
netstat -rn
For true multi-gateway usage, you need policy routing. Linux example using iproute2:
# Create custom routing table
echo "200 custom" >> /etc/iproute2/rt_tables
# Add route to table
ip route add default via 192.168.1.1 dev eth0 table custom
# Add rule to use table
ip rule add from 192.168.1.100 table custom
To modify interface metrics:
Set-NetIPInterface -InterfaceIndex 12 -InterfaceMetric 10
Get-NetIPInterface | Where-Object {$_.ConnectionState -eq "Connected"} | Sort-Object -Property InterfaceMetric
Common issues include:
- Asymmetric routing (outbound vs inbound paths differ)
- VPN connection drops when both interfaces are active
- DNS resolution failures due to wrong interface selection
For reliable multi-gateway setups:
- Use static routes for specific networks
- Configure failover gateways with appropriate metrics
- Implement network policies via Group Policy (Windows) or NetworkManager (Linux)