I have a bunch of routes to my LAN line that won't resolve through my WiFi (which is set as 1st order).
sudo route add 10.999.999.999 10.888.888.888
I have a lot more but that's just a sample. This works great but sometimes I need access to another Network asset which means I have to go add it to the list again.
Can I make it so I route any IP address starting with 10 gets rerouted through the LAN router?
Something like this:
sudo route add 10.* 10.888.888.888
THIS DOES NOT WORK
My Setup:
I have two internet connections.
- WiFi - no firewalls - no access to network assets
- LAN - firewalls - access to network assets
I set WiFi first in my order of precedence and I force certain domains through the LAN connection using my host file to resolve the IP addresses and a routes table to direct those IPs through my LAN router.
Basically I want my cake and eat it too.
Here is what I ended up with:
#! /bin/bash
sudo route -n flush
sudo route add -net 10 10.255.255.255
networksetup -setairportpower en0 off
sleep 2
networksetup -setairportpower en0 on
This flushes the route table, routes any traffic starting with the ip address 10.
to my LAN connection's router, then restarts the wifi router (en0
).
10.{0..255}.{0..255}.{0..255}
It'll expand to all IPs beginning with number 10.