attach, or bind to ports on a system.

attach, or bind to ports on a system. For example, Internet mail servers generally bind to TCP port 25. Connections intended for the mail server will try to connect to port 25. This means that other programs could connect to the same machine on other ports. The /etc/services file contains a list of port numbers and the services that they’re commonly associated with. It’s possible to run almost any service on any port, but by doing so you’ll confuse other Internet hosts that try to connect to your system. If someone tries to send you email, their mail program will automatically connect to port 25 on your machine. If your server runs email on port 77, and you have a web server on port 25, that mail will never arrive. What’s more, people will never see the web page on that system. /etc/services has a very simple format, with five columns: the official service name, the port number, the protocol, any aliases for that service, and comments. For example, one service that could be found on many UNIX hosts was Quote of the Day, also known as qotd. If you check /etc/services, you’ll find the following entry: qotd 17/tcp quote The Quote of the Day service runs on TCP and can normally be found on port 17. Many services have both the TCP and UDP ports of a certain number assigned to them, while others have only one of the protocols. For example, the “echo” service runs on port 7 of both TCP and UDP. Many programs read /etc/services to learn which port to bind to. Depending on the program, you may have to edit /etc/services to assign that protocol to the port. The software instructions will generally tell you if this is the case. Like all standards, the lists in /etc/services can be violated. The SSH daemon, sshd, normally listens on port 22, but I’ve run it on port 80 to escape firewalls in some unusual circumstances. This all depends on the program you’re using to provide a service. Low-Numbered Ports The ports 1024 and below are called low-numbered ports. These are the ports reserved for core Internet infrastructure protocols and important services such as DNS, SSH, HTTP, and so on. Their standard port assignment is basically carved in stone. Only programs that start with root-level privileges can bind to low-numbered ports. What Ports Are Open? So, programs bind to ports. The two obvious questions here are, “which ports are open” and “what programs are listening to each?” You can identify this with netstat(1), the same program we used to check mbuf counts. General Netstat Hints Any time you use netstat(1) to look at network information you might want to use the “-n” flag. -n tells netstat to not perform DNS lookups on the IP addresses it sees. If most of your network connections are to IP addresses with names cached by your nameserver, then your output will be fairly fast even with DNS lookups. If the system must perform a DNS lookup for every IP address your command will run very slowly, especially if the network between you and your DNS server is performing badly. The “-f” flag allows you to select a protocol family to examine with netstat(1). If you’re only interested in IPv4 connections, use “-f inet”. Other valid values for -f include inet6 (for IPv6 connections), ipx (Novell IPX), atalk (AppleTalk), and UNIX (pipes). See netstat(1) for a full list of protocols you can select. Open Ports and Netstat Netstat’s “-a” flag shows open ports and existing TCP/IP connections. If this machine is an active server, you’ll almost certainly want to use the “-n” flag to avoid the DNS lookups, and you’ll want to use the “-f inet” option to specify IP connections only. (Try it some time without using either -n or -f, just for your own education.) You’ll get a long list back, with six columns. Page 169

Hint: If you are looking for high quality and reliable webspace provider to host and run your jsp hosting application check Virtualwebstudio jsp web hosting provider

Comments are closed.