BPFTUNE-NEIGH(8)
π BPFTUNE-NEIGH π
okay bestie, welcome to BPFTUNE-NEIGH β straight out of the System Manager's Manual, section 8, and it's giving networking glow-up. this is the neighbor table bpftune plugin, and its whole job is managing neighbor table sizing. let's get into it π
β¨ NAME β¨
BPFTUNE-NEIGH β the neighbor table bpftune plugin, here to manage neighbor table sizing. that's the vibe. π¦
πΈ DESCRIPTION πΈ
so the neighbor table is basically the group chat between layer 3 and layer 2 β it holds layer 3 -> layer 2 mappings plus reachability information about remote systems. we look up by layer 3 address (the IP address) and it tells us the layer 2 address (the MAC address) associated with it. iconic. π
the table gets populated with both static and garbage-collected values. when we're adding entries we can specify that they should be PERMANENT, in which case they are not (exempt from) garbage-collected. no take-backs, bestie. π
Periodic garbage collection happens for non-permanent failed or expired entries β and it runs immediately if we can't alloc a new neighbor table entry. it's got main character energy when it needs to. β¨
there are a few pathologies we wanna dodge here, principally:
- neighbor table full: if we see
/var/log/messagessaying"Neighbour table overflow."then bestieβ¦ we have run out of space π. this can happen if garbage collection isn't run quickly enough, or if we're full with entries that are not subject to garbage collection.- in the former case, we could auto-tune by reducing
gc_thresh2, since this makes GC run more quickly. - in the latter case, with a large number (75% or more) of exempt-from-GC entries, garbage collection won't help, so we have to increase
gc_thresh3. this is done on a per-table basis via netlink, so the resource costs are limited rather than setting a system-wide tunable. size is increased by 25% of the current value (so1024->1280, etc). - π note that by increasing
gc_thresh3only, garbage collection gets more time to run from table sizedgc_thresh2until we reachgc_thresh3. so it effectively helps with both scenarios. slay.
- in the former case, we could auto-tune by reducing
- neighbor table thrashing: too-aggressive GC eviction might lead to excessive overhead in re-establishing L3->L2 reachability information.
TBD. π
π§ Tunables π§
gc_interval: how often garbage collection should happen; default30seconds. β°gc_stale_time: how often to check for stale entries. if neighbor goes stale, it is resolved again before sending data; defaults to60sec.base_reachable_time_ms: how long neighbor entry is considered reachable for; defaults to30sec.gc_thresh1: with a table size below this value, no GC happens; default128.gc_thresh2: soft max of entries in table; wait5secs if we exceed this value to do GC; default512.gc_thresh3: hard max for table size, GC will run if more entries than this exist, default1024.
π’ Note: to set table size we need to use the equivalent of"ip ntable"; i.e."ip ntable change name arp_cache dev eth0 thresh3 1024"(this is done directly in bpftune via netlink). we do this forgc_thresh1,thresh2andthresh3to ensure that GC scales with overall table size.
however, we set an upper limit on the adjustments based on gc_thresh3 size comparison to the prefixlens of the IP addresses configured on the netdevice the table manages. for example π β for a single IPv4 address with a /24 prefixlen, there are 256 possible addresses, and allowing for multicast etc we multiply this by a scaling factor (currently 4). so in this case we will not increase beyond 1024. but with larger networks / more devices, we will. we also scale down the table size when there are too few entries, upto the minimum of kernel default values, to minimize memory usage. π«Ά
contrast this approach with simply choosing a large net.ipv4.neigh.gc_thresh3. if thresh2 and thresh3 are far apart, we may over-garbage collect, whereas if they are close we may end up keeping around too many entries. in either case, we're mistuned because we've had to choose coarse-grained defaults rather than adapting on a per-table basis as the need arises. periodt. π
π SEE ALSO π
and that's the whole page, bestie π shoutout to the System Manager's Manual for hosting us, and to the page itself β BPFTUNE-NEIGH(8), section 8, that's the one. go tune some neighbor tables, you've got this πβ¨
π¦ where this page comes from
- ubuntu stonking: bpftune 0.4.2.10.g4712347-1 Β· GPL-2.0 WITH Linux-syscall-note exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms