~/portfolio/blog/multi-nic-routing
What Happens When Your PC Has Multiple NICs?
networkinglinuxdeep-diveinteractive

What Happens When Your PC Has Multiple NICs?

An interactive deep-dive into how your OS decides which Network Interface Card — and which router — to use when you browse the internet.

April 12, 202611 min read

Ever plugged in two network cables into your PC — maybe one to your home router and one to a lab switch — and wondered: which one does the OS actually use? 🤔

It turns out, the answer is beautifully deterministic. Your OS doesn't guess. It consults a silent rule-book that's been sitting there the whole time: the Routing Table.


The Setup

Imagine your machine has two NICs:

InterfaceIP AddressConnected To
NIC-1192.168.1.10Router-1 (ISP A)
NIC-2192.168.2.20Router-2 (ISP B)

Both routers have internet access. Both NICs are up. So when you open google.com — who handles it?


Step Through It Interactively

Click through the demo below and watch the packet travel in real time. Pay close attention to the routing table — especially the metric column.

// INTERACTIVE DEMO 🧪
Multiple NICs & Internet Routing
Your PC · 2 NICs · 2 Routers · Who wins the packet? 🥊
🌍Internet142.250.195.46📡Router-1WAN 203.0.113.1LAN 192.168.1.1📡Router-2WAN 198.51.100.1LAN 192.168.2.1🖥️Your PC🔌 NIC-1192.168.1.10metric: 100 ⚡🔌 NIC-2192.168.2.20metric: 200
🧠 Step 1: You type google.com
Your browser asks the OS: "Hey! I need to reach 142.250.195.46 (Google). Which door should I use?"
$ route -n — OS Routing Table
DestinationGatewayInterfaceMetricNote
192.168.1.0/24NIC-1100Local LAN-1
192.168.2.0/24NIC-2200Local LAN-2
0.0.0.0/0192.168.1.1NIC-1100Default ✅ WINNER
0.0.0.0/0192.168.2.1NIC-2200Default (backup)
💡 Override manually: ip route add (Linux) · route ADD (Windows) · NIC-2 auto-takes over if NIC-1 dies = failover · Both NICs active at once = policy-based routing

The Key Concept: Metric

The metric is a cost value. Think of it like a preference score — lower is better. When two routes exist for the same destination (0.0.0.0/0 = the whole internet), the kernel picks the one with the lower metric.

# Linux: view your routing table
$ ip route show

# or the older style
$ route -n
Kernel IP routing table
Destination     Gateway         Iface   Metric
0.0.0.0/0       192.168.1.1     eth0    100     ← WINNER
0.0.0.0/0       192.168.2.1     eth1    200
192.168.1.0/24  0.0.0.0         eth0    100
192.168.2.0/24  0.0.0.0         eth1    200

What Happens When NIC-1 Dies?

If the link on NIC-1 goes down, the kernel detects it (via netlink events) and removes its routes from the table. NIC-2's route is now the only default route — it automatically takes over.

That's called failover, and it happens with zero manual intervention.

# Simulate: manually remove NIC-1's default route
$ sudo ip route del default via 192.168.1.1 dev eth0

# Now NIC-2 is the only default route
$ ip route show
0.0.0.0/0 via 192.168.2.1 dev eth1 metric 200

Want Both NICs Active Simultaneously?

That's Policy-Based Routing (PBR) — you define rules that say things like:

  • "Traffic from 192.168.1.10 → always go via Router-1"
  • "Traffic from 192.168.2.20 → always go via Router-2"
# Create two separate routing tables
$ echo "200 isp1" >> /etc/iproute2/rt_tables
$ echo "201 isp2" >> /etc/iproute2/rt_tables

# Add routes to each table
$ ip route add default via 192.168.1.1 table isp1
$ ip route add default via 192.168.2.1 table isp2

# Add rules to match source IPs to tables
$ ip rule add from 192.168.1.10 table isp1
$ ip rule add from 192.168.2.20 table isp2

Now both NICs carry real traffic simultaneously — no failover, just parallel routing. 🔥


Windows Equivalent

On Windows, metric is configured per adapter:

# View routing table
> route print

# Add a static route
> route ADD 0.0.0.0 MASK 0.0.0.0 192.168.1.1 METRIC 100

# Or via GUI:
# Control Panel → Network Adapters → IPv4 Properties
# → Advanced → Automatic metric (uncheck to set manually)

Summary

ScenarioBehaviour
Both NICs upLower metric NIC handles all internet traffic
Primary NIC goes downOS auto-switches to backup NIC (failover)
Policy-based routingBoth NICs active, traffic split by source IP or mark
Manual overrideip route add / route ADD lets you force a path

The OS routing subsystem is one of those quiet, invisible workhorses — running every time you send a single byte — and it's elegant once you see how it works.


If you found this useful, you might also enjoy my posts on VLAN tagging and how NAT really works.

>_