The port numbers are divided into three ranges: the Well Known Ports, the Registered Ports, and the Dynamic and/or Private Ports.
Ques: What is a port?
Ans: A port is piece of software which is used as docking point in your machine, where remote application can communicate. This is analogy to the physical ports for entering in to a country from different sea ports.
Ques: What is hardware port?
Ans: This is a physical peripheral connecting point to a machine from a physical device.
Ques: What is a socket?
Ans: Socket is combination of software Port and IP address.
Ques: What is the range of ports or how many ports are there?
Ques: Why port numbers are just 65536?
Ques: What are the well-known ports or assigned ports or default ports?
Ques: What do you mean by default port?
Ans: Default port is a designated port for particular well-known service such as web server, mail server, ftp server etc. By default FTP uses 21 port, DNS uses 53 and Apache uses 80 port.
Ques: Can we change default port for a service(example Apache, squid)?
Ans: Yes, we can change. In Apache and DNS we can change this using listen configuration entry in httpd.conf and named.conf. Squid have port entry in it’s squid.conf file to mention port number.
Ques: What are the protocol numbers for TCP and UDP?
Ans: Do not confuse this one with port numbers. TCP and UDP have their own numbers in TCP/IP stack.
Ques: Is there any way I can see all the port information in Linux?
Ans: Yes, you can get that from /etc/services files.
Ques: How can I see open ports in Linux?
Ans: By using nmap command.