TCP Ports
These are documented by the Service Name and Transport Protocol Port Number Registry.
Port | Service |
---|---|
21 | FTP |
22 | SSH |
23 | Telnet |
25 | SMTP |
42 | nameserver |
43 | nicname |
53 | DNS |
67, 68 | DHCP |
80 | HTTP |
88 | kerberos |
110 | POP3 |
123 | NTP |
143 | IMAP |
389 | LDAP |
443 | HTTPS |
636 | LDAP over TLS/SSL |
989, 990 | FTP over TLS/SSL |
3306 | mysql |
3398 | RDP |
5432 | postgres |
Port Ranges
- System Ports (0-1023)
- User Ports (1024-49151)
- Dynamic/Private Ports (49152-65535)
Find unassigned port numbers with Postgres
tcp-registry.csv
data was retrieved from iana.org.
$ curl -O https://radavis.github.io/assets/data/tcp-registry.csv
$ head -n 2 tcp-registry.csv
-- schema.sql
DROP TABLE IF EXISTS tcp_registry_csv;
CREATE TABLE tcp_registry_csv (
id SERIAL,
service_name CHARACTER VARYING,
port_number CHARACTER VARYING,
transport_protocol CHARACTER VARYING,
description CHARACTER VARYING,
assignee CHARACTER VARYING,
contact CHARACTER VARYING,
registration_date CHARACTER VARYING,
modification_date CHARACTER VARYING,
reference CHARACTER VARYING,
service_code CHARACTER VARYING,
known_unauthorized_uses CHARACTER VARYING,
assignment_notes CHARACTER VARYING
);
-- seed.sql
COPY tcp_registry_csv (
service_name,
port_number,
transport_protocol,
description,
assignee,
contact,
registration_date,
modification_date,
reference,
service_code,
known_unauthorized_uses,
assignment_notes
)
FROM '/home/rd/projects/tcp-ports/tcp-registry.csv'
DELIMITER ','
CSV HEADER;
$ createdb tcp_registry
$ psql tcp_registry < schema.sql
$ psql tcp_registry < seed.sql
$ psql tcp_registry
tcp_registry=# select id, port_number, description from tcp_registry_csv
tcp_registry-# where port_number = '5432';
tcp_registry=# select id, port_number, description
tcp_registry-# from tcp_registry_csv
tcp_registry-# where description ilike '%unassigned%'
tcp_registry-# order by id;