Skip to content

Results

The port range cells

The measured numbers of this page are a study of kernel 7.0.0. The data comes from data file port-range-2026-11-17.json of 2026-11-17, at commit 9398ddb, on kernel 7.0.0. The oldest data of this page is 6 days old at this build, on 2026-11-23. The age limit of this data is 30 days, from 2026-12-07. The subject is the kernel of the runner, and GitHub updates it. The driver, the prober and the bands are code of this repository.

Catalogs
PR
Date
2026-11-17
Kernel
Linux 7.0 · HZ 1000
Cells
8
Runs
32 runs
8 hold

These are the results of the cells of the port range, from 2026-11-17. Each cell puts one client in a small ip_local_port_range against one target. The client connects again and again, and the cell records the local port of each connect. The page of the port range computes the same laws in your browser, and its orange dots link to these cells.

  • The search (PR.1 to PR.4): a reset ends each connection, thus a closed connection holds no port. A search connects until a connect gets EADDRNOTAVAIL. The cell counts the connects of each search and the ports that they got.
  • A held port (PR.5 to PR.8): one search takes each port, and then each connection closes. The cell measures the time until the first connect gets a port again.

The predictions come from portSearchSpan and portSearchShares of @mark1russell7/algebra, and from the timers of LINUX_TCP of @mark1russell7/machines. The low port of each range is 40000.

CI started the cells at main in the run 44177444372, in 4 shards on the hosted runners of GitHub. The kernel is Linux 7.0, with HZ 1000. Each cell has 4 runs in 2 fresh environments, with one warm-up run in each environment.

Each of the 8 cells holds against the prediction of the algebra. The cells have 32 counted runs, and no run is void.

  • An even range gives each of its ports. A range of 16 ports gave 16 connects in each of the 200 searches of PR.1. The next connect got EADDRNOTAVAIL in 120 µs or less.
  • An odd range can lose its top port. A range of 3 ports gave 2 connects in each search of PR.2. The search rounds 3 down to 2, thus the top port stays out of reach.
  • The share of each count comes from the search. A range of 5 ports gave 5 connects in 1,303 of the 1,600 searches of PR.3, and 4 connects in the others. The share of 5 in each run was 0.8 to 0.8275, inside the band of the algebra, 0.7291 to 0.9194.
  • The count is for each destination. With two ports of one target, a range of 16 gave 16 connects to each port in each of the 400 searches of PR.4. The search refuses a 4-tuple, not a local port.
an even range of 16 gives 16 connects to one destination, then EADDRNOTAVAIL at oncePR.1
holds
Ports
16
Destinations
1
tcp_tw_reuse
2
Each connection
a reset after each round
Connects of a search
16

The two passes of the search reach each port of an even range. A reset holds no port, thus each round has the same count. The first 8 connects get the ports of the parity of the low port.

Each of the 4 counted runs holds each term of the law. No run was void.

an odd range of 3 gives 2 connects, and the top port is never usedPR.2
holds
Ports
3
Destinations
1
tcp_tw_reuse
2
Each connection
a reset after each round
Connects of a search
2

The search rounds 3 down to 2. Each pass makes one try, at offset 0 and at offset 1.

Each of the 4 counted runs holds each term of the law. No run was void.

an odd range of 5 gives 4 or 5 connects, and the share of each count comes from the searchPR.3
holds
Ports
5
Destinations
1
tcp_tw_reuse
2
Each connection
a reset after each round
Connects of a search
4 or 5

The search rounds 5 down to 4, and each pass makes 2 tries. Thus a port can stay out of reach of each try of a connect, and a later connect from another start reaches it. The share comes from the exact chain of the search.

Each of the 4 counted runs holds each term of the law. No run was void.

the count is for each destination: a range of 16 gives 32 connects to two ports of one targetPR.4
holds
Ports
16
Destinations
2
tcp_tw_reuse
2
Each connection
a reset after each round
Connects of a search
16

The search refuses a 4-tuple, not a port. A second destination port gets each port of the range again.

Each of the 4 counted runs holds each term of the law. No run was void.

  • TIME_WAIT holds a port for 60 s, plus the wheel. In PR.5 the client closes first. The first port came back 60.551 s to 61.121 s after the FIN of the target. The band is 59.999 s to 64.156 s. The default tcp_tw_reuse of 2 is for loopback only, and this path is a veth.
  • tcp_tw_reuse 1 gives the port back after 1 s. In PR.6 the first port came back 1.001 s to 1.011 s after the FIN of the target. The band is 0.999 s to 1.061 s.
  • The side that closes first holds the port. In PR.7 the target closes first. Each of the 10 rounds of each run got the 4 ports at once, with no retransmission.
  • A lost ACK of a FIN holds the port for one RTO. In PR.8 the first ACK of each FIN of the client drops. The client holds each port in LAST_ACK, and its FIN goes again. The first port came back after 203.1 ms to 213.9 ms, inside the band of 199 ms to 268 ms. Each run had 4 retransmissions, one for each port.
the client closes first: each port stays held for 60 s from the FIN of the target, plus the wheelPR.5
holds
Ports
4
Destinations
1
tcp_tw_reuse
2
Each connection
the client closes first
Connects of a search
4
First free port
59.999 s to 64.156 s
60 s61 s62 s63 s64 s

The FIN of the peer moves the socket to TIME_WAIT and sets its timer again. The default tcp_tw_reuse of 2 is for loopback only, and this path is a veth.

Each of the 4 counted runs holds each term of the law. No run was void.

tcp_tw_reuse 1: the client closes first, and each port comes back 1000 ms after the FIN of the targetPR.6
holds
Ports
4
Destinations
1
tcp_tw_reuse
1
Each connection
the client closes first
Connects of a search
4
First free port
999 ms to 1.061 s
1000 ms1020 ms1040 ms1060 ms

With reuse, a connect takes a port in TIME_WAIT when tcp_tw_reuse_delay has passed from the FIN of the peer, and the search does not wait for the timer.

Each of the 4 counted runs holds each term of the law. No run was void.

the target closes first: the client holds no port, and each round gets each port at oncePR.7
holds
Ports
4
Destinations
1
tcp_tw_reuse
2
Each connection
the target closes first
Connects of a search
4
Retransmissions
0

TIME_WAIT is at the side that closes first, here the target. A new SYN with a newer timestamp passes that TIME_WAIT, thus no connect waits and no SYN is sent again.

Each of the 4 counted runs holds each term of the law. No run was void.

the target closes first and the first ACK of each FIN of the client drops: each port comes back one RTO after that FINPR.8
holds
Ports
4
Destinations
1
tcp_tw_reuse
2
Each connection
the target closes first
Connects of a search
4
First free port
199 ms to 268 ms
Retransmissions
4
Fault
the first ACK of each FIN of the client drops
200 ms220 ms240 ms260 ms

The side that closes second holds its port in LAST_ACK until the ACK of its FIN. The FIN goes again at the RTO at the latest, and the target in TIME_WAIT answers it. Thus each port makes one retransmission.

Each of the 4 counted runs holds each term of the law. No run was void.

PR.7 held in this read, but it does not hold in each read. A read of 40 runs at main, the run 44163293814, failed in 7 of 40 runs with no fault in its plan. The rate is 0.175, and its Wilson interval of 95 % is 0.087 to 0.319.

Each failed run has one retransmission, and no run that held has one. That retransmission is a tail loss probe of a FIN with no data, from a client socket in LAST_ACK. In six runs it came during the rounds, thus the client held that port longer, and a later round got 3 ports, not 4. In one run it came 201 ms after the last round, thus each round got 4 ports. No counter of a drop moved at either end.

At this rate, a read of 4 runs holds PR.7 with a chance of 0.46. Thus a refresh can show PR.7 as a failure. That failure is a finding of the same cause, and no band gets wider to hide it.

  • Each cell has 4 runs. A rare failure, as the one of PR.7, needs a longer read.
  • Each run puts the client and the target in two network namespaces, with a pair of veth devices between them. A NAT or a router on the path keeps its own table of connections, and these cells do not measure it.