proc_sys_net_ipv4(5)

๐Ÿ“ฆ
version 6.20 ยท 4 versions
, in arch rolling, nixpkgs unstable

๐Ÿฆ‹ NAME ๐Ÿฆ‹

/proc/sys/net/ipv4/ โ€” it's giving IPv4, bestie ๐Ÿ’–

This lil page lives in the File Formats Manual section (that's section 5, iykyk).


โœจ DESCRIPTION โœจ

Okay so, plot twist: the IP protocol has a whole set of /proc interfaces that let you configure certain global parameters. You get at them by reading or writing the files inside the directory /proc/sys/net/ipv4/. That's it. That's the door. ๐Ÿšชโœจ

And real quick, because the internet is full of chaos: when something here is described as a Boolean, it takes an integer value. A nonzero value means "true" (the option is enabled, she's ON ๐Ÿ’…), and a zero value means "false" (the option is disabled, she's asleep ๐Ÿ˜ด).


๐ŸŒธ /proc/sys/net/ipv4/ip_always_defrag ๐ŸŒธ

(Boolean; since Linux 2.2.13)

History lesson, bestie: New with Linux 2.2.13. In earlier kernel versions this feature was controlled at compile time by the CONFIG_IP_ALWAYS_DEFRAG option. This option is not present in Linux 2.4.x and later. So if you're on anything modern, she's gone, she has left the chat ๐Ÿ‘‹

When this boolean flag is enabled (not equal 0), incoming fragments โ€” and by fragments we mean parts of IP packets that got chopped up because some host between origin and destination decided the packets were too large and cut them into pieces ๐Ÿ”ช โ€” will be reassembled (defragmented) before being processed, even if they're about to be forwarded.

Enable only if you're running either a firewall that is the sole link to your network, or a transparent proxy. Never ever use it for a normal router or host. Otherwise fragmented communication can be disturbed if the fragments travel over different links. And defragmentation also has a large memory and CPU time cost โ€” she's expensive ๐Ÿ’ธ๐Ÿ˜ญ

This is automagically turned on when masquerading or transparent proxying are configured. Magic. โœจ


๐Ÿ’€ /proc/sys/net/ipv4/ip_autoconfig ๐Ÿ’€

(since Linux 2.2 to Linux 2.6.17)

Not documented. That's the whole vibe. Nobody wrote it down. Moving on ๐Ÿ™ˆ


๐ŸŽ€ /proc/sys/net/ipv4/ip_default_ttl ๐ŸŽ€

(integer; default: 64; since Linux 2.2)

Sets the default time-to-live value of outgoing packets. And yes, you can change it per socket with the IP_TTL option. Flexible queen ๐Ÿ‘‘


๐Ÿฆ‹ /proc/sys/net/ipv4/ip_dynaddr ๐Ÿฆ‹

(Boolean; default: disabled; since Linux 2.0.31)

Enables dynamic socket address and masquerading entry rewriting on interface address change. Super useful for a dialup interface with changing IP addresses โ€” the classic glow-up-when-your-IP-changes situation.

The values, let her explain herself:

  • 0 means no rewriting
  • 1 turns it on
  • 2 enables verbose mode ๐Ÿ”Š

๐Ÿ”ฅ /proc/sys/net/ipv4/ip_forward ๐Ÿ”ฅ

(Boolean; default: disabled; since Linux 1.2)

Enables IP forwarding with a boolean flag. And plot twist: IP forwarding can also be set on a per-interface basis, so you're not locked in ๐Ÿ’…


๐ŸŒˆ /proc/sys/net/ipv4/ip_local_port_range ๐ŸŒˆ

(since Linux 2.2)

This file contains two integers that define the default local port range allocated to sockets that aren't explicitly bound to a port number โ€” aka the range used for ephemeral ports. Living on the edge, ephemeral, iconic โœจ

An ephemeral port gets allocated to a socket in these circumstances, and I need you to memorize them because this is the whole point of the page:

  • the port number in a socket address is specified as 0 when calling bind(2);
  • listen(2) is called on a stream socket that was not previously bound;
  • connect(2) was called on a socket that was not previously bound;
  • sendto(2) is called on a datagram socket that was not previously bound.

Allocation of ephemeral ports starts with the first number in /proc/sys/net/ipv4/ip_local_port_range and ends with the second number. And if the range of ephemeral ports is exhausted, then the relevant system call returns an error โ€” but see BUGS ๐Ÿ‘€

โš ๏ธ Heads up, bestie: the port range in /proc/sys/net/ipv4/ip_local_port_range should not conflict with the ports used by masquerading (although the case is handled, so she's forgiving). Also, arbitrary choices may cause problems with some firewall packet filters that make assumptions about the local ports in use. The first number should be at least greater than 1024, or better, greater than 4096, to avoid clashes with well known ports and to minimize firewall problems. Don't be chaotic about it ๐Ÿ™

๐Ÿงš /proc/sys/net/ipv4/ip_no_pmtu_disc ๐Ÿงš

(Boolean; default: disabled; since Linux 2.2)

If enabled, don't do Path MTU Discovery for TCP sockets by default.

Now, Path MTU discovery may fail if misconfigured firewalls (that drop all ICMP packets) or misconfigured interfaces (e.g., a point-to-point link where the both ends don't agree on the MTU) are on the path. But listen โ€” it is better to fix the broken routers on the path than to turn off Path MTU Discovery globally, because not doing it incurs a high cost to the network. Fix the router, don't punish the network ๐Ÿ’…


๐Ÿ’œ /proc/sys/net/ipv4/ip_nonlocal_bind ๐Ÿ’œ

(Boolean; default: disabled; since Linux 2.4)

If set, allows processes to bind(2) to nonlocal IP addresses, which can be quite useful, but may break some applications ๐Ÿ’€

Useful and dangerous at the same time, truly main character energy.


โญ /proc/sys/net/ipv4/ip6frag_time โญ

(integer; default: 30)

Time in seconds to keep an IPv6 fragment in memory. Your girl has a timer โณ


๐Ÿ“ /proc/sys/net/ipv4/ip6frag_secret_interval ๐Ÿ“

(integer; default: 600)

Regeneration interval (in seconds) of the hash secret (or lifetime for the hash secret) for IPv6 fragments. Yes, the IPv4 directory has IPv6 fragment knobs in it, don't ask, just accept her ๐ŸŒธ


๐Ÿ‘‘ /proc/sys/net/ipv4/ipfrag_high_thresh ๐Ÿ‘‘

๐Ÿ‘‘ /proc/sys/net/ipv4/ipfrag_low_thresh ๐Ÿ‘‘

(integer)

If the amount of queued IP fragments reaches /proc/sys/net/ipv4/ipfrag_high_thresh, the queue is pruned down to /proc/sys/net/ipv4/ipfrag_low_thresh. Contains an integer with the number of bytes. High thresh and low thresh, the duo of the century ๐Ÿซถ๐Ÿ“


๐Ÿ‡ /proc/sys/net/ipv4/neigh/* ๐Ÿ‡

See arp(7). Yeah, that's the whole thing. Go read arp(7), bestie ๐Ÿ’–


๐Ÿซถ SEE ALSO ๐Ÿซถ


And that's the page!! ๐ŸŽ€โœจ This was brought to you by Linux man-pages 6.20, dated 2025-12-25 โ€” yes, Christmas day, she's a holiday icon ๐ŸŽ„๐Ÿ‘‘ Go forth and sysctl responsibly, no cap ๐Ÿ’…๐Ÿ’–

๐Ÿ“ฆ where this page comes from
  • arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • ๐Ÿ“œ the page's license: Linux-man-pages-copyleft
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms