Port forwarding, often referred to as .tunnelling. is the forwarding of network ports from one network device to another. This is commonly done using a NAT (network address translation) enabled router or server and another computer within the local network. The main purpose of using port forwarding is to allow hosts outside your local network who doesn.t have their own public IP address access to some services running on machines within your LAN.
Port forwarding is easy to set up on a router since the management interface allows for easy configuration. In some cases this easy configuration feature might be a problem since most routers cannot provide complex customization for port forwarding and other services. In such case a Linux box can do the job. With Linux, port forwarding is configured by adding iptable rules with a DNAT target to the PREROUTING chain and a SNAT target to the POSTROUTING chain. After doing so iptables will use the existent masquerade table to rewrite packages so they will reach the desired host in concordance with the port forwarding rules you provided. This is similar to OSX and BSD, however ipfw is used. In most cases ipfw is already compiled...