Question Two gateways on one PC

russff

Distinguished
Oct 14, 2008
14
0
18,510
Laptop has a wired ethernet connection for all internet access, connected to a router. It also has a wifi connection to a mifi for access to a private radio network (no internet through this connection, only access to the radios). The default gateway is the internet router (192.168.0.1). The mifi is 192.168.2.1. I want all 172.16.23.x traffic to go through the mifi and all other traffic through the wired ethernet. Using Win 7 Pro. I used "route -p 172.16.23.0 mask 255.255.255.0 192.168.2.1". Route Print shows 0.0.0.0 0.0.0.0 192.168.0.1 Default (metric) and 172.16.23.0 255.255.255.0 192.168.2.1 1 (metric). Problem is when I connect to the mifi, ALL traffic goes through it and I lose my internet (since the radios have no internet access). How can I get both to work at the same time so I can access the internet AND the radios?
 
The WIFI should not have a default gateway. Remove it from the WIFI since you added a route.
Sorry, I should have mentioned it. The hardwired LAN has the default gateway 192.168.0.1, the wifi has no default gateway, it is setup to obtain automatically for both IP and gateway. But maybe I shouldn't throw a wrench into it, but I can also connect to the internet router via wifi when I am moving around and can't plug in directly (in this case, the laptop get's its IP and gateway from the router DHCP). So it's really only when I connect to the mifi that I have this problem and I don't connect to the mifi and the router at the same time wirelessly.
 
Last edited:
Guess I didn't read you whole post, u may need a second gateway after all, this would be a good time to post a diagram with the different subnets so we don't waste time guessing what u have.
The mifi is intended only to access the radios, not for internet access, so only 172.16.23.x traffic should go to the wifi, EVERYTHING else should go through the router.
IOPzHk0.png
 
Last edited:
It should work but it still appears that you have a DHCP enabled on the wifi. Something is putting the 0.0.0.0 route in for the mifi network. You should be able to delete but it depends what is putting it in.

The method that works is to put in 2 permanent routes pointing to the 192.168.0.1. You would use 0.0.0.0 and 128.0.0.0 with a mask of 128.0.0.0 on both. These routes are more specific so they will be preferred. This is how many vpn client accomplish overriding the default route without actually removing it.
 
It should work but it still appears that you have a DHCP enabled on the wifi. Something is putting the 0.0.0.0 route in for the mifi network. You should be able to delete but it depends what is putting it in.

The method that works is to put in 2 permanent routes pointing to the 192.168.0.1. You would use 0.0.0.0 and 128.0.0.0 with a mask of 128.0.0.0 on both. These routes are more specific so they will be preferred. This is how many vpn client accomplish overriding the default route without actually removing it.
I created that 172.... route with the "route -p 172.16.23.0 mask 255.255.255.0 192.168.2.1" command. The 0.0.0.0 route was the only route that existed before I added the other one.
This is the Route Print result:
Network AddressNetmaskGatewayMetric
0.0.0.00.0.0.0192.168.0.1Default
172.16.23.0255.255.255.0192.168.2.11
It works fine if I am not connected to the mifi. But when I connect to the mifi, all traffic tries to go through it and I lose internet and the local network access.
 
Last edited:
In general, it looks alright. U getting close.

The 0.0.0.0 is your fallover default, it should be the Internet gateway (any other IP not specified, GO HERE) AND it should be the LAST route to be resolved.

Am little rusty on Windows' routing table, but assuming table is resolved from top to bottom, then the 0.0.0.0 route should be at the bottom, and there should only be one pointing at 192.168.0.1 and nowhere else.
 
That is because when you connect the mifi you get another 0.0.0.0 router that is preferred. Not sure where you get that from. Did you leave the gateway blank on wifi interface when you set the ip address.
In wifi config, both settings (IP/Gateway and DNS) are set to Obtain Automatically and Automatic Metric is checked. Automatic Metric is also checked for my LAN setup.

When I am connected to the mifi, Active Routes does show two 0.0.0.0/0.0.0.0 entries, the one to my router has a metric of 266 and is at the top of the list and the one to the mifi metric 25 and is second on the list. There is also an entry that matches the persistent route I added, with a metric of 26. When I disconnect from the mifi, the metric 25 and 26 entries go away.
 
Last edited:
Use static ip on the mifi with no gateway or dns configured .
That actually worked, that and I manually deleted the other 0.0.0.0 route. Now I only have the one 0.0.0.0 route that goes to my internet router and the 172.16.0.0 route that goes to the mifi and it all is working correctly so I can access the radios and the internet at the same time. Thanks for the help!