Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Macbook, Leopard, USB CDMA modem and private network

Hi,

I have been searching all over for an answer and not found anything that works yet.

I am using a USB modem to access internet on my macbook. I also am connected to a private WAN network. I connect via my ethernet port to a PC running Mikrotik RouterOS which is my gateway to the WAN.

The router IP is 192.168.0.2.
The WAN uses the IP range 172.19...
I have set my ethernet port a manual IP of 192.168.0.5 with 192.168.0.2 (the routerOS gateway) as the gateway.

If I connect one of these, the other does not work, I assume because whichever is connected first becomes the default route. I have tried changing the service order under advanced network preferences with no luck.

I also tried adding a route : route add -net 172.19.0.0 -interface eth0

Neither of these worked. Any ideas?

Thanks in advance.

Macbook, iMac, iPhone, Mac OS X (10.5.5)

Posted on Feb 4, 2009 10:11 PM

Reply
Question marked as Best reply

Posted on Feb 4, 2009 10:31 PM

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.
4 replies
Question marked as Best reply

Feb 4, 2009 10:31 PM in response to Rtaxerxes

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.

Feb 5, 2009 12:56 PM in response to Rtaxerxes

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:

/usr/local/bin/addroutes

#! /bin/sh

/sbin/route add -net 172.19 192.168.0.2


/Library/LaunchDaemons/local.customroutes.plist

<?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">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.customroutes</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/addroutes</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>LaunchOnlyOnce</key>
<true/>
</dict>
</plist>


The first file, /usr/local/bin/addroutes has the commands to execute while the .plist file runs the script at boot time.

Macbook, Leopard, USB CDMA modem and private network

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.