Forward all traffic from one IP to another IP on OS X

5

3

This is related to this question I just asked...

I have two IP address on my iMac I want to "bridge". I'm not sure what the proper terminology is... here's the situation.

My iMac has a firewire connection to my laptop and an ethernet connection to the rest of my office. My laptop has an ip of 192.168.100.2 (on the firewire interface). My iMac has an IP of 192.168.100.1 on the firewire interface, and two IPs, 10.1.0.6 and 10.1.0.7, on it's ethernet interface.

If I wanted to forward all traffic coming in from 192.168.100.2 on my OS X machine to go out on IP 10.1.0.7, and vice-versa, can this be done? I assume I would use the ipfw command.

Essentially I want to "bridge" the firewire network to the ethernet network so my laptop can see all the machines on the 10.1 network, and all those machines can see my laptop at 10.1.0.7. Is this possible?

Josh

Posted 2010-04-09T16:19:31.727

Reputation: 7 540

Answers

1

Just turn on "Internet Sharing" for the required port(s):

System Preferences => Sharing => Internet Sharing

Paul R

Posted 2010-04-09T16:19:31.727

Reputation: 4 717

If I do that it involves additional overhead and the computers on the 10.1.0.0 network can't reach the laptop on 192.168.100.2. I'd like to avoid "full" NAT if possible. But it might not be possible. – Josh – 2010-04-09T18:56:27.637

OK - in that case you may be looking at a commercial solution, e.g. http://www.sustworks.com/site/prod_ipnrx_overview.html

– Paul R – 2010-04-10T06:43:50.773

0

You can turn on TCP/IP forwarding in OS X by running the following:

sysctl -w net.inet.ip.forwarding=1

Note that this may not necessarily be enough to get packets routed to the device properly depending on your network configuration.

Ignacio Vazquez-Abrams

Posted 2010-04-09T16:19:31.727

Reputation: 100 516

0

I would probably just use the route command from the command line to do the routing.

See the man page here. Basically just add a new route to the desired network through the desired network device. Do the same on the other computer only in reverse. I would also look into what OS X uses to determine the routing metric so you're not completely lost when it doesn't work right away.

Nitrodist

Posted 2010-04-09T16:19:31.727

Reputation: 1 488