OS X Connection Sharing Without The Control Panel

From Stack Overflow
Jump to: navigation, search

Sometimes you need to enable connection sharing without touching the control panel. Here's how:

nat.sh:
#!/bin/sh
/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

Script developed from information at http://www.ppcnerds.org/modules.php?op=modload&name=News&file=article&thold=-1&mode=flat&order=0&sid=109

Personal tools