Common TCP and UDP ports
Ranges: 0–1023 are system ports (requiring root or CAP_NET_BIND_SERVICE), 1024–49151 are registered,
and 32768–60999 is the default Linux client ephemeral range (Ports and sockets).
| Port | Protocol | Service | Notes |
|---|---|---|---|
22 |
TCP | SSH | Server shell access, SFTP, SSH tunnels |
53 |
UDP, TCP | DNS | Regular queries use UDP; large replies and zone transfers use TCP (DNS and dig) |
67, 68 |
UDP | DHCP | 67 is the server, 68 is the client |
80 |
TCP | HTTP | Usually redirects to 443 and serves Let’s Encrypt HTTP-01 challenges |
123 |
UDP | NTP | Time sync (systemd-timesyncd, chrony) |
443 |
TCP, UDP | HTTPS / HTTP/3 | TCP carries TLS + HTTP/1.1 and HTTP/2; UDP carries QUIC and HTTP/3 (UDP and QUIC) |
465, 587 |
TCP | SMTP (outbound) | 465 is SMTPS (implicit TLS), 587 is Submission (STARTTLS) |
993 |
TCP | IMAPS | Mail retrieval over TLS |
3306 |
TCP | MariaDB / MySQL | Keep on 127.0.0.1 or an internal Docker network |
5432 |
TCP | PostgreSQL | Keep on 127.0.0.1 or an internal Docker network |
6379 |
TCP | Redis / Valkey | No password by default — never expose to the internet |
8006 |
TCP | Proxmox VE | Web UI and API (HTTPS) |
51820 |
UDP | WireGuard | Default port; stays silent on unknown keys |
TCP flags and the tcp[13] byte
TCP flags sit in the 14th header byte (zero-based offset 13). In tcpdump output, ACK prints as a dot .
and the rest print as their first letter (TCP: flags and states):
| Flag | In tcpdump |
Bit value | Hex | Meaning |
|---|---|---|---|---|
FIN |
F |
1 |
0x01 |
Sender finished sending and closes its half |
SYN |
S |
2 |
0x02 |
Connection open request, exchanges initial seq and options |
RST |
R |
4 |
0x04 |
Immediate reset (closed port or firewall REJECT) |
PSH |
P |
8 |
0x08 |
Flush buffer straight to the application without waiting to fill a segment |
ACK |
. |
16 |
0x10 |
The ack field confirms received bytes |
URG |
U |
32 |
0x20 |
Urgent pointer (rarely seen in practice) |
ECE |
E |
64 |
0x40 |
ECN-Echo: signals link congestion without dropping packets |
CWR |
W |
128 |
0x80 |
Congestion Window Reduced: sender shrank its window after ECE |
Frequent combinations in tcpdump BPF filters:
| Combination | In tcpdump |
tcp[13] mask |
What it captures |
|---|---|---|---|
Pure SYN |
[S] |
tcp[13] == 0x02 |
New connection attempts with no reply yet |
SYN + ACK |
[S.] |
tcp[13] == 0x12 |
Successful server handshake replies |
Any RST |
[R] or [R.] |
tcp[13] & 0x04 != 0 |
Connection resets and closed ports |
Any FIN |
[F.] |
tcp[13] & 0x01 != 0 |
Graceful session teardown |
SYN, FIN, or RST |
— | tcp[13] & 0x07 != 0 |
All connection lifecycle boundaries (opens and closes) |
Build an exact bitmask and copy the ready filter:
sudo tcpdump -nn 'tcp[13] == 0x12'# by name: sudo tcpdump -nn 'tcp[tcpflags] == (tcp-ack|tcp-syn)'TCP socket states in ss
| State | What is happening | When to look closer |
|---|---|---|
LISTEN |
Server waits for inbound SYN on this address and port |
Check 0.0.0.0 vs 127.0.0.1 (0.0.0.0 vs 127.0.0.1) |
SYN-SENT |
Client sent SYN and waits for SYN-ACK |
Many stuck sockets point to firewall DROP or an unreachable host |
SYN-RECV |
Server sent SYN-ACK and waits for the final ACK |
A spike signals client-side loss or a SYN flood |
ESTAB |
Connection is open and passing data | Watch Recv-Q/Send-Q: growth means an app or network bottleneck |
FIN-WAIT-1 / FIN-WAIT-2 |
Local side sent FIN and waits for the peer to close |
Stuck FIN-WAIT-2 expires after tcp_fin_timeout (60 s) |
CLOSE-WAIT |
Peer sent FIN, but the local program never called close() |
Socket leak in application code (unrelated to the network) |
TIME-WAIT |
Local side closed first; holds the record for 60 s (2×MSL) |
Normal TCP protection, not a leak (TIME-WAIT is not a leak) |
LAST-ACK |
Sent the closing FIN back, waiting for the peer’s final ACK |
Brief state during teardown |
Important ICMP types and codes (IPv4)
| Type / Code | nftables name |
Meaning |
|---|---|---|
8 / 0 |
echo-request |
ping request |
0 / 0 |
echo-reply |
ping reply |
3 / 0 |
destination-unreachable (net) |
Router has no route to the target subnet |
3 / 1 |
destination-unreachable (host) |
Host on the local LAN did not reply to ARP |
3 / 3 |
destination-unreachable (port) |
UDP port is closed (the UDP equivalent of TCP RST) |
3 / 4 |
destination-unreachable (frag-needed) |
Packet exceeds MTU with DF set — basis of PMTUD (MTU blackhole) |
3 / 13 |
destination-unreachable (admin-prohibited) |
Packet blocked by a firewall REJECT rule (DROP vs REJECT) |
11 / 0 |
time-exceeded |
TTL hit zero in transit — basis of traceroute and mtr |
Important ICMPv6 types
Never block all ICMPv6: dropping types 1–4 and 133–136 breaks addressing, gateway discovery, and Path MTU
(IPv6 in practice):
| Type | Name | Why it is needed |
|---|---|---|
1 |
Destination Unreachable | Routing errors, closed ports, administrative blocks |
2 |
Packet Too Big | IPv6 counterpart to Fragmentation Needed — routers never fragment IPv6 |
3 |
Time Exceeded | Hop Limit hit zero (IPv6 equivalent of TTL) |
4 |
Parameter Problem | Malformed IPv6 header |
128 / 129 |
Echo Request / Reply | ping -6 |
133 / 134 |
Router Solicitation / Advertisement | Gateway discovery and SLAAC prefix assignment (local link only) |
135 / 136 |
Neighbor Solicitation / Advertisement | NDP — replaces ARP for resolving IPv6 to MAC (local link only) |