How to enable ip forwarding on Leopard Mac OS X
2009-01-03 19:53:24
In a nutshell, you need to create a launchd script. Here is mine, which I put in /Library/LaunchDaemons.
<?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>com.billo</string>
<key>Program</key>
<string>/usr/sbin/sysctl</string>
<key>ProgramArguments</key>
<array>
<string>sysctl</string>
<string>-w</string>
<string>net.inet.ip.forwarding=1</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>TimeOut</key>
<integer>90</integer>
<key>WorkingDirectory</key>
<string>/var/root</string>
</dict>
</plist>
That's the hard way.
The easy way is to create or edit /etc/sysctl.conf and add
net.inet.ip.forwarding=1
Duh.