How it works
A port is a number from 0 to 65535 attached to every TCP or UDP connection. Common services have agreed defaults: 80 for HTTP, 443 for HTTPS, 22 for SSH, 53 for DNS, 587 for sending email and 5432 for PostgreSQL. A server listens on its port, and a firewall decides which ports can be reached from outside.
Numbers below 1024 are the well-known range, and on Linux opening one needs admin rights. Port forwarding on a router sends traffic that arrives on a public port to a device inside the network. Leaving admin ports such as 22 (SSH) or 3389 (Windows Remote Desktop) open to the whole internet invites a constant stream of automated login attempts.
Related terms
More in Networking
Network basics