Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The library and other public Wifis restrict internet access to certain ports, sometimes just port 80. I'd need to be able to use ssh and other programs that require a different port.

My current solution is to tether to my phone, completely bypassing the public wifi. But then all traffic goes through my phone, which is slow.

Is there a way to connect to both connections simultaneously (connect to the phone via bluetooth or usb), and then select which traffic uses a particular connection? Ideally everything would default to one connection, and only things I manually configure would exit via the 2nd connection (my phone).

I'm on a macbook air using OSX 10.7.3.

UPDATE:

Naturally I found the solution after posting. Connect to both internet connections, and make sure the "default" connection is higher on the list in the "set service order" menu within the network setting preferences pane. Click the "advanced" button for the phone's network connection, and copy the "router" IP address. Then in the terminal type "sudo route add [IP of box we're trying to ssh into] [router IP for phone's connection]".

Follow up question #1: how can I make this easy to activate and de-activate? Is there a way to get those specific routes configured as part of a network "location" profile? Or do I need to create an on/off script?

Follow up question #2: is there a way to do this based on destination port instead of IP address? Routes won't work. Maybe some sort of locally-running proxy?

share|improve this question
    
    
Yeah, sorry. It amazing how I couldn't find those until after I posted. –  mpoisot Apr 20 '12 at 22:50

1 Answer 1

check out 'route'. (Go to terminal and enter "man route"). You can force certain traffic to specific interfaces

Specifically, route PRINT is the same as netstat -r

This shows how tcpip will route a destination IP (with its subnet mask) to the default gateway VIA a specified interface (and how many hops/the metric it is to the destination)

eg:

 route ADD someIp MASK 255.255.255.0 gatewayIp METRIC 1 IF {interfaceID}

each interface has an id, you have four. (use ipconfig ifcount to know for certain OR you can use networksetup -listallhardwarereports to display a easier-to-read listing of the same info.)

localhost (lo0), your hardwire (en0), your wireless (en1) and your phone (??). Use ifconfig to see all the details for each interface.

the interface ID for route is the interface's index. i'll be right back on how to print that out. hmm.. ipconfig is supposed to output the index but on OSX is doesn't. still looking...

UPDATE:

On OSX the networksetup command might have a way to do what route should do. I am not personally familiar with it but its options are all somewhat self explanatory.

share|improve this answer
    
It turns out there is no "route print" in OSX, thanks for pointing out netstat -r. Any thoughts on my follow up questions? –  mpoisot Apr 20 '12 at 22:19
    
actually, it turns out all the route syntax is different... ugh. –  mpoisot Apr 20 '12 at 22:45
    
regarding q#2.. ya.. a locally hosted socks server of some kind would do what you want. address routing is just that.. for addresses. port forwarding is a different kettle of fish. –  KenK Apr 21 '12 at 0:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.