Ports and IP Addressing

Overview

Those of you seeking a more-than-casual knowledge of the way in which networks function will find this section particularly helpful. The information that follows discusses:

Ports is Ports

So what the heck are ports, anyway? Simply put, they're part of the addressing that controls how data travels from one computer to another. You've already seen how IP addresses work to identify a single, unique location somewhere on the Internet, thus enabling you to send packets to a distant computer. But before this can be done, one more tiny hurdle must be overcome.

A single wire connects the network to the distant computer, but there may be many applications on that machine-a web server, an ftp server, a telnet server, etc.-waiting for somebody to connect. So the question arises: How do you use one wire and one IP address to connect to the right application? The answer: Ports.

Here's an analogy. Let's say you send a package to a friend. The Zip Code you include on the mailing label is similar to an IP address in that it gets your package to the one and only town in which your friend lives. Once there, however, the package still needs to get to your friend's doorstep. That's where the street address-akin to a port number-comes in. In other words, an IP address connects you to the right computer; a port number lands you in the right application. Computers have many ports (about 65,000), and each has a unique number.

So, let's say a network card, listening on its network, has accepted packets intended for its IP address. The port, a kind of junior-level address, tells the computer who (i.e., which local application) gets which packets.

Kinds of Ports: Source Ports, Destination Ports, Listening Ports, Standard Ports, Ephemeral Ports and Proxy Ports.

An important principle behind the Internet's smooth functioning is that some common applications always have the same ports. In other words, you needn't know in advance which port on a distant machine accepts mail, because every machine everywhere uses port 25 to accept email transport. If a mail server application is running on a machine and is ready to accept mail, the server application opens port 25 and listens for incoming mail packets.

Some common standard ports:

Telnet Port 23
Mail (smtp, or send mail) Port 25
World Wide Web Port 80
Post Office (pop, or get mail) Port 110
News (nntp) Port 119

In general, ports 1 through 1023 are reserved for common usage, while those in higher ranges are used in other ways. There is, however, much leeway.

USER TIP:Ports 1 through 1023 have standard, well-known, uses. Almost all common Internet applications use listening ports in that range. Since they're used as ephemeral ports, they're always available for use as listening ports by local applications.

You might think that the application sending mail uses port 25, but that's not the case. The usual procedure involves an application requesting and being given a socket by the operating system; that is, it asks for and receives a port. Any port will do (the application doesn't even need to know what the exact port number is), but the operating system will typically hand over a port from somewhere above 1023. These ports are known as ephemeral ports. They are used briefly, and then returned to the pool for another application's later use.

The application sending the mail, using an ephemeral port, sends a connection request to a standard port. When the actual packets join to accomplish this, part of the information in each packet is the source IP address and port as well as the destination IP address and port. The ephemeral port is the source port; the standard port is the destination port. When the distant machine returns packets-and for any single connection, many packets are exchanged back and forth-it returns them using the original ephemeral port as its destination port. Although this sounds complicated, the underlying principle is easy to grasp: when a program uses an ephemeral port, any replies arrive back at that same port.

Here's one last bit of complexity. Since standard listening ports are for everybody, the answering machine doesn't actually use it for data transfer. It only listens on that port. As soon as a connection is established it hands that connection to a local ephemeral port and immediately resumes listening for new incoming connection requests on the standard port. That's how a web server can listen for (and handle!) thousands of connections from client browsers.

Now that you've waded through all this you must be wondering what the payoff is. How, exactly, does this information help you use WinProxy? Well, think back to clients and servers. Those terms have definite meanings for Internet communication. A client application-a browser or an email application, say-sends a connection request to a server (a web or mail server, for example) listening on a standard port. Servers always listen on standard ports for incoming connection requests from client applications. A server waits and listens for connection requests from a client-that's pretty much what server and client means these days.

WinProxy is a Proxy Server. It actually serves a dual-purpose role, acting as a server to any client machine making a connection request, and acting as a client application when connecting to a server on behalf of the client. There are many places where you are permitted to make port settings in WinProxy. A few of these are labeled a "Destination Ports," and that is what they are-the ports to which WinProxy sends its connection requests while acting as a proxy client. A destination port setting is always labeled as such in WinProxy. When you configure a Destination Port, it's a sub-address on a different machine. It's up to you to know (1) whether a machine is actually listening on that port; and (2) that machine's IP address.

Most port designations you can make in WinProxy are listening ports. They are also labeled as proxy ports. When you designate a proxy port, WinProxy opens it up as a listening port and answers connection requests coming in to that port. For instance, when you do the mail protocol settings, it asks what ports you want to use. These are listening, proxy ports. When you give it port 25 for smtp, it opens a listening port on the internal network connection and waits for connection requests from mail applications on your local LAN.

NOTE:Unlike many proxy servers, WinProxy will not open a listening port on all network connections; it makes a careful distinction between the internal (outgoing connections) and external (incoming connections) listening ports. These distinctions are important for the security of your firewall. For more information about incoming/outgoing connections, check out the section entitled "MappedPorts" in Advanced Settings

Additional Links

Search

Authorization

 
Forgot your password?
Register

Subscribe

Subscribe to company news