10. Advanced NAT configuration
The following pages contain instructions for advanced NAT configuration using port mapping. Port mapping is required for some specific things, such as client computers receiving files via ICQ. It is not necessary to read any further unless you wish to enhance your network with this kind of functionality.
Read below to find out more about port mapping; or you can just follow these quick links:10.1 Mapping ports on the server
10.2 Configuring server programs on the client
What is a port, anyway?
For 2 computers on the internet talk to one another, a connection must first be established. To establish a connection, one computer (the client - NOT the same definition as was used for the local network you've already set up!!!) sends a message to the other computer (the server), requesting a connection. It's like one computer is making a phone call to the other. Also like a phone call, the initial request for a connection is one-way; but once the connection is established, each computer can send and receive information.
Now extend the phone call analogy to imagine that instead of 2 people talking on the phone, a person from one large company calls a person from another large company. Each company has heaps of phones, but the caller uses just one of their company's phones to call out, and the person receiving the call uses just one of their company's phones to answer. All of the phones in one company share the first few digits of their phone number, but they each have a different extension.
In an internet connection, a similar process occurs. Each computer has many "ports", and when a computer sends a connection request, it sends it from a particular "outgoing" port on that computer (ie the client) to a particular "incoming" port on the server. Thus the first part of the "phone number" is equivalent to the IP address of the relevant computer, and the "extension" is equivalent to the port number.
For example, let's say you surf to www.optushome.com.au, which has an IP address of 203.164.1.237. Your computer (the client) sends a connection request from a particular port on your computer (it doesn't matter which) to 203.164.1.237, port 80. Port 80 is the standard port number used for web browsing. The webserver accepts the connection, and sends you the webpage. Now you have a connection established with that computer (203.164.1.237) and you can request webpages, files etc and it can send them to you. Your computers can continue to talk until one of the computers closes this connection. All of this is handled by your web browser, so you don't need to know what's going on underneath the shiny surface.
Everything you do on the internet is based on this simple premise - communication between 2 computers is established after one computer requests a connection from the other. Note that the outgoing port is generally unimportant, whereas the incoming port (which is specified by the computer requesting a connection) is very important, as different services are assigned to different ports (eg port 80 for WWW). So the client computer could request a connection on a weird port such as 8754, and the server may accept it; but more likely the server will think "8754? What on earth is that for?" and reject the request.
Some more examples of connections include:
Did you get all that? :-) You may need to read over it a couple of times to understand exactly what I mean. Anyway, the important thing is this - any computer in your network that is receiving its internet connection via NAT (basically your client computers, and I'm going back to the definition of client that we were using in the rest of the guide) can send connection requests, but can not receive them.
The ramifications of this are easy to determine if you look at the above examples of connections. WWW, FTP, sending email and receiving email work fine; as do downloading in Napster and sending files in ICQ. However, allowing others to download from you in Napster, and receiving files in ICQ, require that your computer can receive a connection request. Thus, none of your client computers can upload in Napster or receive files in ICQ.
Port mapping
Port mapping is a feature of a NAT program that gets around this problem. Normally, any incoming connection requests go straight to the server computer. The server computer has no way of knowing which computer on the home network the connection request was intended for, so by default it takes all such requests. Port mapping is a process whereby you can tell the server computer "please forward any requests for a connection on port x to computer 192.168.0.y".
For example, let's say you had a client computer, 192.168.0.2, running Napster; and that you wanted people to be able to download your shared songs. Let's say Napster was configured to accept connections on port 6699, the default. You could configure your server to allow this by saying "please forward any requests for a connection on port 6699 to computer 192.168.0.2". If you had another computer, 192.168.0.3, also running Napster, you could configure its version of Napster to accept connections on port 6700. Then you could configure the server to "please forward any requests for a connection on port 6700 to computer 192.168.0.3".
Port mapping thus allows your client computers to accept connections from other computers on the internet, which they would have been otherwise unable to do. The most common applications of this are Napster and ICQ, but it is equally applicable to any program that needs the computer to accept connections.
To learn how to set up port mapping on your home network, continue...