Skip navigation
This discussion is archived

Macbook, Leopard, USB CDMA modem and private network

1496 Views 4 Replies Latest reply: Feb 5, 2009 12:56 PM by Camelot RSS
Rtaxerxes Calculating status...
Currently Being Moderated
Feb 4, 2009 10:11 PM
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)
  • Camelot Level 8 Level 8 (45,670 points)
    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.
    Mac OS X (10.5.6)
  • Camelot Level 8 Level 8 (45,670 points)
    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.
    Mac OS X (10.5.6)

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.