NAT: Hidden static port mapping features

Richard Burgess‘ implementation of NAT (http://www.rickb.com/software/) for BeOS is a standby for anyone sharing their BeOS machine’s Internet connection with other machines on a LAN.
If you’d like to run a server (web, telnet, ftp, etc.) on a machine within a LAN that has its link to the Internet through a BeOS machine running NAT, you can set up Static Port Mapping. Static Port Mapping forwards packets received on a given port to any machine on your LAN. Read the NAT documentation on how to set this up.
What is not covered in the documentation is how set up Static Port Mapping so that (for example) incoming requests on port 8080 are forwarded to a machine on port 80. This is useful (for instance) if you’re already running a web server on your BeOS machine, but you also want external access to a web server on a machine within your LAN. Ports cannot have more than one application controlling them, so you must enable this workaround.
To enable this workaround, you must first set up Static Port Mapping via NAT’s GUI configuration tool, using the port you want open on the BeOS machine as the port. The address is the machine on your LAN that you want the packets to be forwarded to.
Next, open up /boot/home/config/settings/network in a text editor. Toward the bottom should be a block containing NAT’s configuration. It should look something like this:
nat: PORT_MAP0 = 80-80:192.168.0.2:80:3
There should be a block of information above the PORT_MAPX field(s), we’re only interested in the PORT_MAPX fields though.

  1. The first set of numbers (i.e. 80-80) is the range of ports on the BeOS machine that will forward to a given address. It’s set to only one port by default, but can also be a range of ports. A value of 80-80 will only enable port 80 to forward, whereas a value of 80- 90 will enable all ports 80-90 (80, 81, 82…) to forward packets.
  2. The next set of numbers is the IP address of the machine on your LAN (192.168.0.2, in this case) that is getting the forwarded packets. You can only use one IP address.
  3. The next number is the port on the remote machine (80 in this case). This is set by default to the same as the port on the BeOS machine. This is can be changed to whatever you please (most likely the port that your server is receiving on). Only one port is allowed.
  4. I have no idea what the last number (3, in this case) does, so I’ve never tried to change it. I suggest you don’t either.

After you’ve made your changes, save the file. Then restart networking.

 

Comments

No comments so far.

(comments are closed)

Kategorien

 
 
Blogroll
Resources