To work with firewalls, you need to understand ports. So let's talk about ports. Firewalls
typically are working on IP addresses and ports, where every service has its own port.
And these ports normally are dedicated and well-reserved. There are privileged ports,
which are ports that are claimed by specific services. And the privileged ports go up to
port 1023. These are the ports that you should normally not allocate for your custom services.
And if you do, you need administrator privileges. There's also the dynamic ports. They range
from 1024 all the way up to 65536. And they can be used for dynamic port allocation, which
is done by some processes. And also, you can configure them manually for services that
don't have a privileged port for themselves. A static port definition can be found in ETC
services. Now, the bottom line is, no matter which port you are planning to use, it's a
good idea to first check in ETC services if it's not already in use. You have already
learned about the ss command and the netstat command. They can show you ports that are
currently in use, but they are not showing you reserved ports. And if you ever want to
configure something yourself, you need to make sure that the port is still available.
So let me show you what is in this ETC services file. So let's check it out on ETC services.
And here we can see that this is a list of ports that has been updated by IANA. That
is the Internet Authority that takes care of port numbers and much more. So you can
even check out the details right here. And there we can see the well-known ports. These
are the privileged ports. The registered port, that's a separate range. And dynamic ports,
well, there's also a specific range for ports that need to be dynamically allocated. So
if you want to be completely compliant, then you should allocate your dynamic port higher
than 49152. Now, let's imagine that you decide that you want to run your web server on port
82. Now, what are you going to do? Well, just check the ETC services file. And in ETC services,
you see that there is nothing between port 80 HTTP and port 88 Kerberos. So the bottom
line is, go ahead and use it. But make sure you use administrator privileges because these
are required for having services on registered ports.