How to Implement Policy-Based Routing in Windows: Split Traffic Between LAN and 3G Interfaces


1 views

When dealing with multiple network interfaces in Windows (like corporate LAN and 3G), the system's default routing behavior often needs manual adjustment. From your route print output, I notice multiple default gateways competing, with the 3G interface currently winning due to its lower metric.

Interface 40: Vodafone Mobile Connect (3G)
Interface 11: Broadcom NetXtreme (LAN)
Multiple default routes with:
    0.0.0.0/0 via 10.183.148.5 (metric 4235)
    0.0.0.0/0 via 10.183.148.6 (metric 4235)
    0.0.0.0/0 via 10.183.148.7 (metric 4235)
    0.0.0.0/0 via on-link (10.57.175.79, metric 31)

Here's how to force corporate LAN traffic (10.183.0.0/16) through your wired interface while using 3G for everything else:

Step 1: Clean Up Existing Routes

First, remove conflicting default routes:

route delete 0.0.0.0 mask 0.0.0.0 10.183.148.5
route delete 0.0.0.0 mask 0.0.0.0 10.183.148.6
route delete 0.0.0.0 mask 0.0.0.0 10.183.148.7

Step 2: Set Up Specific Routes

Add routes for your corporate network via the LAN interface:

route -p add 10.183.0.0 mask 255.255.0.0 10.183.148.1 if 11

Step 3: Set 3G as Default Gateway

Configure the 3G interface as your default route with a lower metric:

route -p add 0.0.0.0 mask 0.0.0.0 10.57.175.79 if 40 metric 20

After implementation, verify with:

route print
ping 10.183.148.1
tracert google.com

Common issues to watch for:

  • Interface indexes might change after reboots
  • Corporate VPNs might override your routing table
  • 3G connection drops might require route adjustments

For more robust management, create a PowerShell script:

# Get interface indexes
$3GIndex = (Get-NetAdapter -Name "Vodafone*").ifIndex
$LANIndex = (Get-NetAdapter -Name "Broadcom*").ifIndex

# Remove existing default routes
Get-NetRoute -DestinationPrefix "0.0.0.0/0" | Remove-NetRoute -Confirm:$false

# Add corporate routes
New-NetRoute -DestinationPrefix "10.183.0.0/16" -InterfaceIndex $LANIndex -NextHop "10.183.148.1"

# Set 3G as default
New-NetRoute -DestinationPrefix "0.0.0.0/0" -InterfaceIndex $3GIndex -NextHop "10.57.175.79" -RouteMetric 20

When working with multiple network interfaces in Windows (like corporate LAN + 3G/4G connections), you often need fine-grained control over which traffic goes through which interface. The default routing behavior might not always match your requirements.

From your route print output, we can observe:

IPv4 Route Table
===========================================================================
Active Routes:
    Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0     10.183.148.5   10.183.148.157   4235
          0.0.0.0          0.0.0.0     10.183.148.6   10.183.148.157   4235
          0.0.0.0          0.0.0.0     10.183.148.7   10.183.148.157   4235
          0.0.0.0          0.0.0.0         On-link      10.57.175.79     31

Here's how to configure specific routing for your case:

Step 1: Make 3G the Default Route

route delete 0.0.0.0 mask 0.0.0.0
route add 0.0.0.0 mask 0.0.0.0 10.57.175.79 if 40 metric 1

Step 2: Add Corporate LAN Routes

route add 10.183.148.0 mask 255.255.255.0 10.183.148.1 if 11 metric 1

Add the -p flag to make routes survive reboots:

route -p add 10.183.148.0 mask 255.255.255.0 10.183.148.1 if 11 metric 1

After making changes, verify with:

route print

For modern Windows versions, consider using PowerShell:

New-NetRoute -DestinationPrefix "10.183.148.0/24" -InterfaceIndex 11 -NextHop 10.183.148.1
Set-NetIPInterface -InterfaceIndex 40 -InterfaceMetric 1

If your corporate network uses multiple subnets:

route -p add 10.183.0.0 mask 255.255.0.0 10.183.148.1 if 11
route -p add 10.184.0.0 mask 255.255.0.0 10.183.148.1 if 11

Common issues and solutions:

  • Metric conflicts: Always check interface metrics with netsh interface ip show config
  • Interface indexes: Verify with get-netadapter | select ifIndex,Name
  • DNS considerations: Remember to configure corporate DNS servers appropriately