Configuring Dual Network Routing for Simultaneous LAN and Wi-Fi Access

In a typical dual-network setup, a Windows machine may be connected to both a wired Ethernet network (for a private LAN) and a wireless Wi-Fi network (for public internet). This often leads to routing conflicts, where one connection's default gateway and DNS settings override the other, preventing full access to either network. For instance, a corporate LAN might provide DNS that can only resolve internal hostnames, effectively blocking external internet access when the wired connection is active.

The solution is to manually manage the IP routing table. We will configure the system to route all general internet traffic through the Wi-Fi gateway while forcing specific LAN-bound traffic to use the wired gateway.

Manual Route Configuration via Command Prompt

These commands, executed with administrative privileges, will adjust the routing table to achieve the desired traffic flow. The IP addresses used are examples; replace them with your actual network gateway and subnet details.

route delete 0.0.0.0
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1 metric 1
route add 10.0.0.0 mask 255.0.0.0 10.10.20.1 metric 10

Here's a breakdown of the logic:

  1. route delete 0.0.0.0: This command removes any existing default routes. The destination 0.0.0.0 with a 0.0.0.0 mask represents all possible IP destinations, effectively the default path for any traffic not covered by a more specific route.
  2. route add 0.0.0.0 mask 0.0.0.0 192.168.1.1 metric 1: This establishes a new default route, directing all traffic to the gateway at 192.168.1.1. In this example, this IP address belongs to the Wi-Fi router. The low metric value of 1 prioritizes this path for genarel internet access.
  3. route add 10.0.0.0 mask 255.0.0.0 10.10.20.1 metric 10: This adds a more specific static route for the internal network. Any traffic destined for the 10.0.0.0/8 subnet will be explicitly sent to the wired network's gateway at 10.10.20.1, regardless of the default route. A higher metric ensures it is only used for its designated subnet.

Handling Dynamic Route Updates

Windows automatically manages network interfaces and may overwrite the default gateway (0.0.0.0) when a network adapter reconnects or its state changes. This can undo your manual configuraton. A more resilient method is to modify the existing default route instead of deleting and recreating it. This can be done using the route change command:

route change 0.0.0.0 mask 0.0.0.0 192.168.1.1 metric 1

Using route change updates the existing default route's properties, wich can sometimes be more stable across network events. However, it is often necessary to run the configuration script after establishing both network connections to ensure the correct routes are in place.

PowerShell Alternative for Route Management

For a more modern and scriptable approach, PowerShell provides cmdlets for network management. This method is often preferred for automation and complex scenarios.

# To inspect the current routing table
Get-NetRoute

# To add the new static route for the internal LAN
New-NetRoute -DestinationPrefix "10.0.0.0/8" -NextHop "10.10.20.1" -RouteMetric 10 -PolicyStore ActiveStore

The New-NetRoute cmdlet achieves the same result as the route add command. The -DestinationPrefix uses CIDR notation to define the network subnet, and -NextHop specifies the gateway. The default route for internet traffic will typically be managed by the interface with the lowest automatic metric, so you may only need to add the specific route for the private network.

Tags: Windows networking Routing PowerShell Command Prompt

Posted on Wed, 27 May 2026 22:31:21 +0000 by [PQ3]RogeR