1520 Views 4 Replies Latest reply: Feb 5, 2009 12:56 PM by Camelot
Your route statement is the right approach, just the wrong values.
If you're using two interfaces you have to remember that you can only have one default route. In this case with the USB modem handling your internet connection you should NOT have a router address set for the ethernet interface. Instead you should add a static route for just the subnets that should go over that link.
In this case you want to route 172.19.x.x addresses through 192.168.0.2, so you'd run:
sudo route add -net 172.19 192.168.0.2
That way your system will use the ethernet network for all 192.168.0.x traffic (since that's the LAN address of that interface). It'll send any traffic for 172.19.x.x over this interface (via 192.168.0.2) and all other traffic will use the USB interface.
Any changes via the route command are transient and will go away when the machine reboots.
You have several options for making the route persistent - have the OS run a script at startup that adds the route.
Your best option would be to save your routes setup in a shell script (such as /usr/local/bin/addroutes) and add a launchd script to launch that at boot time, like:
/sbin/route add -net 172.19 192.168.0.2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
The first file, /usr/local/bin/addroutes has the commands to execute while the .plist file runs the script at boot time.