Skip to content

Commit 3e15583

Browse files
author
Emilia Hane
committed
Discover nat topology theory
1 parent 4df432e commit 3e15583

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

discv5/discv5-theory.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ ENR as its potential relay, the longer time that has passed since a peer sent us
405405
the less guarantee we have that the peer is in fact connected to the owner of that ENR and
406406
hence of its ability to relay.
407407
408-
### Job of keeping the hole punched falls on Bob and Bob's incentives to do so
408+
### Job of keeping the hole punched falls on Bob and Bob's incentive to do so
409409
410410
UDP session table entry lifetimes are configurable, though a common lower bound is 20
411411
seconds[^1]. Bob must periodically reset the session table entry for Alice in its NAT to
@@ -421,6 +421,16 @@ session. If there is no hole for Alice in Bob's NAT when Alice carries out a
421421
behind a NAT intends to frequently communicate with a peer, reestablishing the session is
422422
more costly than managing the interval of sent packets to that peer.
423423
424+
### Discovering if the local node is behind a NAT and must keep holes for peers punched
425+
426+
A node may be assigned an externally reachable socket to advertise at start-up. If it is
427+
not, the [external socket used by the local node is discovered] at runtime and at start-up
428+
the node assumes it is behind a NAT and must activate the [mechanism for keeping holes punched].
429+
Once an externally reachable IP address is known, implementations will try to bind to the
430+
address at some number of ports, randomly selected from a given range of probably unused
431+
ports. If binding succeeds for any port, the node is not behind a NAT and the
432+
[mechanism for keeping holes punched] is deactivated.
433+
424434
[EIP-778]: ../enr.md
425435
[identity scheme]: ../enr.md#record-structure
426436
[message packet]: ./discv5-wire.md#ordinary-message-packet-flag--0
@@ -437,6 +447,8 @@ more costly than managing the interval of sent packets to that peer.
437447
[UDP communication]: ./discv5-wire.md#udp-communication
438448
[Sessions]: ./discv5-theory.md#sessions
439449
[liveness check]: ./discv5-theory.md#table-maintenance-in-practice
450+
[external socket used by the local node is discovered]: ./discv5-theory.md#maintaining-the-local-node-record
451+
[mechanism for keeping holes punched]: ./discv5-theory.md#job-of-keeping-the-hole-punched-falls-on-bob-and-bob's-incentive-to-do-so
440452
441453
[^1]: https://pdos.csail.mit.edu/papers/p2pnat.pdf
442454
[^2]: https://datatracker.ietf.org/doc/html/rfc4787

0 commit comments

Comments
 (0)