Setup Port Forwarding OS X Router

Macbook OS X has no direct GUI option to configure port forwarding. However, you can create a shell script as follows (open terminal and create a script called

# bit-torrent port forwarding with mac os x
killall-9 natd
# The following will forward 6881 to 6999 port to desktop computer located at
# => airport IP
# => Desktop client ip
# natd provides a Network Address Translation facility for use with divert(4) sockets under FreeBSD.
# ————————————————————————————————————————————————–
/usr/sbin/natd -aliasaddress -interface en1 -usesockets -sameports -unregisteredonly -dynamic -clampmss -enablenatportmap -natportmapinterface en0 -redirectport tcp -l

Simply run this script whenever you need to forward ports:

chmod +x
sudo ./

Type the following command to list current rules (these are set by above Internet sharing procedure):

sudo ipfw list


Posted on Friday, 12 August, 2011, in Mac. Bookmark the permalink. Comments Off on Setup Port Forwarding OS X Router.

Comments are closed.

%d bloggers like this: