PPP Connection Sharing

From Stack Overflow
Jump to: navigation, search

Taken from http://www.macosxhints.com/article.php?story=20020708095436166 :

First I have a machine in a company network which I can connect to the telephone line for basic e-mail access. I share this connection with the ethernet network by using the command-line program ipfw (which I think Brickhouse uses internally). I have created a script called ip-up located in /etc/ppp that has the following (and runs when the ppp connection is activated):

/usr/sbin/natd -dynamic -interface ppp0
/sbin/ipfw -f flush
/sbin/ipfw add divert natd all from any to any via ppp0
/sbin/ipfw add pass all from any to any

This simply allows for address going to the ppp0 interface to be rerouted and their ip addresses translated. This also allows for the users in other machines in the network to use the route as well by adding "route" statements in their machines. This is a very rough and specific set-up.

Alternative, which seems to actually work:

/usr/sbin/natd -interface en0 -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss
/sbin/ipfw add 10 divert 8668 all from any to any via en0
/usr/sbin/sysctl -w net.inet.ip.forwarding=1
Personal tools