요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
================================
Documentation for /proc/sys/net/
================================
Copyright
Copyright (c) 1999
- Terrehon Bowden <terrehon@pacbell.net>
- Bodo Bauer <bb@ricochet.net>
Copyright (c) 2000
- Jorge Nerin <comandante@zaralinux.com>
Copyright (c) 2009
- Shen Feng <shen@cn.fujitsu.com>
For general info and legal blurb, please look in index.rst.
------------------------------------------------------------------------------
This file contains the documentation for the sysctl files in
/proc/sys/net
The interface to the networking parts of the kernel is located in
/proc/sys/net. The following table shows all possible subdirectories. You may
see only some of them, depending on your kernel's configuration.
Table : Subdirectories in /proc/sys/net
========= =================== = ========== ===================
Directory Content Directory Content
========= =================== = ========== ===================
802 E802 protocol mptcp Multipath TCP
appletalk Appletalk protocol netfilter Network Filter
ax25 AX25 netrom NET/ROM
bridge Bridging rose X.25 PLP layer
core General parameter tipc TIPC
ethernet Ethernet protocol unix Unix domain sockets
ipv4 IP version 4 x25 X.25 protocol
ipv6 IP version 6
========= =================== = ========== ===================
1. /proc/sys/net/core - Network core options
============================================
bpf_jit_enable
--------------
This enables the BPF Just in Time (JIT) compiler. BPF is a flexible
and efficient infrastructure allowing to execute bytecode at various
hook points. It is used in a number of Linux kernel subsystems such
as networking (e.g. XDP, tc), tracing (e.g. kprobes, uprobes, tracepoints)
and security (e.g. seccomp). LLVM has a BPF back end that can compile
restricted C into a sequence of BPF instructions. After program load
through bpf(2) and passing a verifier in the kernel, a JIT will then
translate these BPF proglets into native CPU instructions. There are
two flavors of JITs, the newer eBPF JIT currently supported on:
- x86_64
- x86_32
- arm64
- arm32
- ppc64
- ppc32
- sparc64
- mips64
- s390x
- riscv64
- riscv32
- loongarch64
- arc
And the older cBPF JIT supported on the following archs:
- mips
- sparc
eBPF JITs are a superset of cBPF JITs, meaning the kernel will
migrate cBPF instructions into eBPF instructions and then JIT
compile them transparently. Older cBPF JITs can only translate
tcpdump filters, seccomp rules, etc, but not mentioned eBPF
programs loaded through bpf(2).
Values:
- 0 - disable the JIT (default value)
- 1 - enable the JIT
- 2 - enable the JIT and ask the compiler to emit traces on kernel log.
bpf_jit_harden
--------------
This enables hardening for the BPF JIT compiler. Supported are eBPF
JIT backends. Enabling hardening trades off performance, but can
mitigate JIT spraying.
Values:
- 0 - disable JIT hardening (default value)
- 1 - enable JIT hardening for unprivileged users only
- 2 - enable JIT hardening for all users
where "privileged user" in this context means a process having
CAP_BPF or CAP_SYS_ADMIN in the root user name space.
bpf_jit_kallsyms
----------------
When BPF JIT compiler is enabled, then compiled images are unknown
addresses to the kernel, meaning they neither show up in traces nor
in /proc/kallsyms. This enables export of these addresses, which can
be used for debugging/tracing. If bpf_jit_harden is enabled, this
feature is disabled.
Values :
- 0 - disable JIT kallsyms export (default value)
- 1 - enable JIT kallsyms export for privileged users only
bpf_jit_limit
-------------
This enforces a global limit for memory allocations to the BPF JIT
compiler in order to reject unprivileged JIT requests once it has
been surpassed. bpf_jit_limit contains the value of the global limit
in bytes.
dev_weight
----------
The maximum number of packets that kernel can handle on a NAPI interrupt,
it's a Per-CPU variable. For drivers that support LRO or GRO_HW, a hardware
aggregated packet is counted as one packet in this context.
Default: 64
dev_weight_rx_bias
------------------
RPS (e.g. RFS, aRFS) processing is competing with the registered NAPI poll function
of the driver for the per softirq cycle netdev_budget. This parameter influences
the proportion of the configured netdev_budget that is spent on RPS based packet
processing during RX softirq cycles. It is further meant for making current
dev_weight adaptable for asymmetric CPU needs on RX/TX side of the network stack.
(see dev_weight_tx_bias) It is effective on a per CPU basis. Determination is based
on dev_weight and is calculated multiplicative (dev_weight * dev_weight_rx_bias).
Default: 1
dev_weight_tx_bias
------------------
Scales the maximum number of packets that can be processed during a TX softirq cycle.
Effective on a per CPU basis. Allows scaling of current dev_weight for asymmetric
net stack processing needs. Be careful to avoid making TX softirq processing a CPU hog.
Calculation is based on dev_weight (dev_weight * dev_weight_tx_bias).
Default: 1
default_qdisc
-------------
The default queuing discipline to use for network devices. This allows
overriding the default of pfifo_fast with an alternative. Since the default
queuing discipline is created without additional parameters so is best suited
to queuing disciplines that work well without configuration like stochastic
fair queue (sfq), CoDel (codel) or fair queue CoDel (fq_codel). Don't use
queuing disciplines like Hierarchical Token Bucket or Deficit Round Robin
which require setting up classes and bandwidths. Note that physical multiqueue
interfaces still use mq as root qdisc, which in turn uses this default for its
leaves. Virtual devices (like e.g. lo or veth) ignore this setting and instead
default to noqueue.
Default: pfifo_fast
busy_read
---------
Low latency busy poll timeout for socket reads. (needs CONFIG_NET_RX_BUSY_POLL)
Approximate time in us to busy loop waiting for packets on the device queue.
This sets the default value of the SO_BUSY_POLL socket option.
Can be set or overridden per socket by setting socket option SO_BUSY_POLL,
which is the preferred method of enabling. If you need to enable the feature
globally via sysctl, a value of 50 is recommended.
Will increase power usage.
Default: 0 (off)
busy_poll
----------------
Low latency busy poll timeout for poll and select. (needs CONFIG_NET_RX_BUSY_POLL)
Approximate time in us to busy loop waiting for events.
Recommended value depends on the number of sockets you poll on.
For several sockets 50, for several hundreds 100.
For more than that you probably want to use epoll.
Note that only sockets with SO_BUSY_POLL set will be busy polled,
so you want to either selectively set SO_BUSY_POLL on those sockets or set
sysctl.net.busy_read globally.
Will increase power usage.
Default: 0 (off)
mem_pcpu_rsv
------------
Per-cpu reserved forward alloc cache size in page units. Default 1MB per CPU.
rmem_default
------------
The default setting of the socket receive buffer in bytes.
rmem_max
--------
The maximum receive socket buffer size in bytes.
Default: 4194304
rps_default_mask
----------------
The default RPS CPU mask used on newly created network devices. An empty
mask means RPS disabled by default.
tstamp_allow_data
-----------------
Allow processes to receive tx timestamps looped together with the original
packet contents. If disabled, transmit timestamp requests from unprivileged
processes are dropped unless socket option SOF_TIMESTAMPING_OPT_TSONLY is set.
Default: 1 (on)
wmem_default
------------
The default setting (in bytes) of the socket send buffer.
wmem_max
--------
The maximum send socket buffer size in bytes.
Default: 4194304
message_burst and message_cost
------------------------------
These parameters are used to limit the warning messages written to the kernel
log from the networking code. They enforce a rate limit to make a
denial-of-service attack impossible. A higher message_cost factor, results in
fewer messages that will be written. Message_burst controls when messages will
be dropped. The default settings limit warning messages to one every five
seconds.
warnings
--------
This sysctl is now unused.
This was used to control console messages from the networking stack that
occur because of problems on the network like duplicate address or bad
checksums.
These messages are now emitted at KERN_DEBUG and can generally be enabled
and controlled by the dynamic_debug facility.
netdev_budget
-------------
Maximum number of packets taken from all interfaces in one polling cycle (NAPI
poll). In one polling cycle interfaces which are registered to polling are
probed in a round-robin manner. Also, a polling cycle may not exceed
netdev_budget_usecs microseconds, even if netdev_budget has not been
exhausted.
netdev_budget_usecs
---------------------
Maximum number of microseconds in one NAPI polling cycle. Polling
will exit when either netdev_budget_usecs have elapsed during the
poll cycle or the number of packets processed reaches netdev_budget.
netdev_max_backlog
------------------
Maximum number of packets, queued on the INPUT side, when the interface
receives packets faster than kernel can process them.
netdev_rss_key
--------------
RSS (Receive Side Scaling) enabled drivers use a 40 bytes host key that is
randomly generated.
Some user space might need to gather its content even if drivers do not
provide ethtool -x support yet.
::
myhost:~# cat /proc/sys/net/core/netdev_rss_key
84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8: ... (52 bytes total)
File contains nul bytes if no driver ever called netdev_rss_key_fill() function.
Note:
/proc/sys/net/core/netdev_rss_key contains 52 bytes of key,
but most drivers only use 40 bytes of it.
::
myhost:~# ethtool -x eth0
RX flow hash indirection table for eth0 with 8 RX ring(s):
0: 0 1 2 3 4 5 6 7
RSS hash key:
84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8:43:e3:c9:0c:fd:17:55:c2:3a:4d:69:ed:f1:42:89
netdev_tstamp_prequeue
----------------------
If set to 0, RX packet timestamps can be sampled after RPS processing, when
the target CPU processes packets. It might give some delay on timestamps, but
permit to distribute the load on several cpus.
If set to 1 (default), timestamps are sampled as soon as possible, before
queueing.
netdev_unregister_timeout_secs
------------------------------
Unregister network device timeout in seconds.
This option controls the timeout (in seconds) used to issue a warning while
waiting for a network device refcount to drop to 0 during device
unregistration. A lower value may be useful during bisection to detect
a leaked reference faster. A larger value may be useful to prevent false
warnings on slow/loaded systems.
Default value is 10, minimum 1, maximum 3600.
skb_defer_max
-------------
Max size (in skbs) of the per-cpu list of skbs being freed
by the cpu which allocated them. Used by TCP stack so far.
Default: 64
optmem_max
----------
Maximum ancillary buffer size allowed per socket. Ancillary data is a sequence
of struct cmsghdr structures with appended data. TCP tx zerocopy also uses
optmem_max as a limit for its internal structures.
Default : 128 KB
fb_tunnels_only_for_init_net
----------------------------
Controls if fallback tunnels (like tunl0, gre0, gretap0, erspan0,
sit0, ip6tnl0, ip6gre0) are automatically created. There are 3 possibilities
(a) value = 0; respective fallback tunnels are created when module is
loaded in every net namespaces (backward compatible behavior).
(b) value = 1; [kcmd value: initns] respective fallback tunnels are
created only in init net namespace and every other net namespace will
not have them.
(c) value = 2; [kcmd value: none] fallback tunnels are not created
when a module is loaded in any of the net namespace. Setting value to
"2" is pointless after boot if these modules are built-in, so there is
a kernel command-line option that can change this default. Please refer to
Documentation/admin-guide/kernel-parameters.txt for additional details.
Not creating fallback tunnels gives control to userspace to create
whatever is needed only and avoid creating devices which are redundant.
Default : 0 (for compatibility reasons)
devconf_inherit_init_net
------------------------
Controls if a new network namespace should inherit all current
settings under /proc/sys/net/{ipv4,ipv6}/conf/{all,default}/. By
default, we keep the current behavior: for IPv4 we inherit all current
settings from init_net and for IPv6 we reset all settings to default.
If set to 1, both IPv4 and IPv6 settings are forced to inherit from
current ones in init_net. If set to 2, both IPv4 and IPv6 settings are
forced to reset to their default values. If set to 3, both IPv4 and IPv6
settings are forced to inherit from current ones in the netns where this
new netns has been created.
Default : 0 (for compatibility reasons)
txrehash
--------
Controls default hash rethink behaviour on socket when SO_TXREHASH option is set
to SOCK_TXREHASH_DEFAULT (i. e. not overridden by setsockopt).
If set to 1 (default), hash rethink is performed on listening socket.
If set to 0, hash rethink is not performed.
gro_normal_batch
----------------
Maximum number of the segments to batch up on output of GRO. When a packet
exits GRO, either as a coalesced superframe or as an original packet which
GRO has decided not to coalesce, it is placed on a per-NAPI list. This
list is then passed to the stack when the number of segments reaches the
gro_normal_batch limit.
high_order_alloc_disable
------------------------
By default the allocator for page frags tries to use high order pages (order-3
on x86). While the default behavior gives good results in most cases, some users
might have hit a contention in page allocations/freeing. This was especially
true on older kernels (< 5.14) when high-order pages were not stored on per-cpu
lists. This allows to opt-in for order-0 allocation instead but is now mostly of
historical importance.
Default: 0
2. /proc/sys/net/unix - Parameters for Unix domain sockets
----------------------------------------------------------
There is only one file in this directory.
unix_dgram_qlen limits the max number of datagrams queued in Unix domain
socket's buffer. It will not take effect unless PF_UNIX flag is specified.
3. /proc/sys/net/ipv4 - IPV4 settings
-------------------------------------
Please see: Documentation/networking/ip-sysctl.rst and
Documentation/admin-guide/sysctl/net.rst for descriptions of these entries.
4. Appletalk
------------
The /proc/sys/net/appletalk directory holds the Appletalk configuration data
when Appletalk is loaded. The configurable parameters are:
aarp-expiry-time
----------------
The amount of time we keep an ARP entry before expiring it. Used to age out
old hosts.
aarp-resolve-time
-----------------
The amount of time we will spend trying to resolve an Appletalk address.
aarp-retransmit-limit
---------------------
The number of times we will retransmit a query before giving up.
aarp-tick-time
--------------
Controls the rate at which expires are checked.
The directory /proc/net/appletalk holds the list of active Appletalk sockets
on a machine.
The fields indicate the DDP type, the local address (in network:node format)
the remote address, the size of the transmit pending queue, the size of the
received queue (bytes waiting for applications to read) the state and the uid
owning the socket.
/proc/net/atalk_iface lists all the interfaces configured for appletalk.It
shows the name of the interface, its Appletalk address, the network range on
that address (or network number for phase 1 networks), and the status of the
interface.
/proc/net/atalk_route lists each known network route. It lists the target
(network) that the route leads to, the router (may be directly connected), the
route flags, and the device the route is using.
5. TIPC
-------
tipc_rmem
---------
The TIPC protocol now has a tunable for the receive memory, similar to the
tcp_rmem - i.e. a vector of 3 INTEGERs: (min, default, max)
::
# cat /proc/sys/net/tipc/tipc_rmem
4252725 34021800 68043600
#
The max value is set to CONN_OVERLOAD_LIMIT, and the default and min values
are scaled (shifted) versions of that same value. Note that the min value
is not at this point in time used in any meaningful way, but the triplet is
preserved in order to be consistent with things like tcp_rmem.
named_timeout
-------------
TIPC name table updates are distributed asynchronously in a cluster, without
any form of transaction handling. This means that different race scenarios are
possible. One such is that a name withdrawal sent out by one node and received
by another node may arrive after a second, overlapping name publication already
has been accepted from a third node, although the conflicting updates
originally may have been issued in the correct sequential order.
If named_timeout is nonzero, failed topology updates will be placed on a defer
queue until another event arrives that clears the error, or until the timeout
expires. Value is in milliseconds.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
문서 범위와 하위 디렉터리
1-46이 문서는 Terrehon Bowden, Bodo Bauer, Jorge Nerin, Shen Feng이 작성한 `/proc/sys/net` sysctl 설명서입니다. 일반 정보와 법적 안내는 `index.rst`를 참조합니다.
커널 networking 영역의 인터페이스는 `/proc/sys/net`에 있습니다. 실제로 보이는 하위 디렉터리는 커널 구성에 따라 다음 목록의 일부일 수 있습니다.
| 디렉터리 | 내용 | 디렉터리 | 내용 |
|---|---|---|---|
| `802` | E802 protocol | `mptcp` | Multipath TCP |
| `appletalk` | Appletalk protocol | `netfilter` | Network Filter |
| `ax25` | AX25 | `netrom` | NET/ROM |
| `bridge` | Bridging | `rose` | X.25 PLP layer |
| `core` | 일반 매개변수 | `tipc` | TIPC |
| `ethernet` | Ethernet protocol | `unix` | Unix domain socket |
| `ipv4` | IP version 4 | `x25` | X.25 protocol |
| `ipv6` | IP version 6 |
1. /proc/sys/net/core - Network core options
47-49`/proc/sys/net/core`의 network core 공통 옵션입니다.
bpf_jit_enable
50-93BPF Just in Time(JIT) compiler를 활성화합니다. BPF는 여러 hook point에서 bytecode를 실행하는 유연하고 효율적인 기반이며 networking의 XDP·tc, tracing의 kprobes·uprobes·tracepoints, security의 seccomp 등에 사용됩니다.
LLVM BPF backend는 제한된 C를 BPF instruction으로 compile할 수 있습니다. `bpf(2)`로 program을 load하고 kernel verifier를 통과하면 JIT가 BPF proglet을 native CPU instruction으로 변환합니다.
새 eBPF JIT는 `x86_64`, `x86_32`, `arm64`, `arm32`, `ppc64`, `ppc32`, `sparc64`, `mips64`, `s390x`, `riscv64`, `riscv32`, `loongarch64`, `arc`에서 지원됩니다. 구형 cBPF JIT는 `mips`, `sparc`에서 지원됩니다.
eBPF JIT는 cBPF JIT의 상위 집합입니다. 커널은 cBPF instruction을 eBPF instruction으로 옮긴 뒤 투명하게 JIT compile합니다. 구형 cBPF JIT는 tcpdump filter와 seccomp rule 등만 변환할 수 있고 `bpf(2)`로 load한 eBPF program은 변환하지 못합니다.
| 값 | 동작 |
|---|---|
| `0` | JIT 비활성화(기본값) |
| `1` | JIT 활성화 |
| `2` | JIT를 활성화하고 compiler가 trace를 kernel log에 출력하도록 요청 |
bpf_jit_harden
94-109eBPF JIT backend의 hardening을 활성화합니다. 성능과 맞바꾸어 JIT spraying을 완화할 수 있습니다. 여기서 privileged user는 root user namespace에서 `CAP_BPF` 또는 `CAP_SYS_ADMIN`을 가진 프로세스를 뜻합니다.
| 값 | 동작 |
|---|---|
| `0` | JIT hardening 비활성화(기본값) |
| `1` | 비특권 사용자에게만 활성화 |
| `2` | 모든 사용자에게 활성화 |
bpf_jit_kallsyms
110-123BPF JIT가 만든 image 주소는 기본적으로 커널에 알려지지 않아 trace나 `/proc/kallsyms`에 나타나지 않습니다. 이 옵션은 디버깅과 tracing을 위해 주소를 내보냅니다. `bpf_jit_harden`이 켜져 있으면 이 기능은 비활성화됩니다.
| 값 | 동작 |
|---|---|
| `0` | JIT kallsyms export 비활성화(기본값) |
| `1` | privileged user에게만 export |
bpf_jit_limit
124-131BPF JIT compiler의 memory 할당에 전역 한도를 적용합니다. 한도를 넘으면 비특권 JIT 요청을 거부하며 값의 단위는 byte입니다.
dev_weight
132-140NAPI interrupt 한 번에 커널이 처리할 수 있는 최대 packet 수인 CPU별 변수입니다. LRO나 `GRO_HW`를 지원하는 driver에서는 hardware가 aggregate한 packet도 여기서는 packet 하나로 셉니다. 기본값은 `64`입니다.
dev_weight_rx_bias
141-153RX softirq cycle에서 driver의 등록 NAPI poll function과 경쟁하는 RPS(RFS, aRFS 등)가 `netdev_budget` 중 얼마를 사용할지 비율에 영향을 줍니다. network stack의 비대칭 RX/TX CPU 요구에 맞춰 현재 `dev_weight`를 조정하기 위한 값이며 CPU별로 적용됩니다.
계산은 `dev_weight * dev_weight_rx_bias`입니다. `dev_weight_tx_bias`도 참조하십시오. 기본값은 `1`입니다.
dev_weight_tx_bias
154-164TX softirq cycle에서 처리할 수 있는 최대 packet 수를 CPU별로 배율 조정합니다. network stack의 비대칭 처리 요구에 맞춰 `dev_weight`를 조정하지만 TX softirq가 CPU를 독점하지 않도록 주의해야 합니다.
계산은 `dev_weight * dev_weight_tx_bias`이며 기본값은 `1`입니다.
default_qdisc
165-180network device에 사용할 기본 queuing discipline입니다. `pfifo_fast` 대신 다른 qdisc를 선택할 수 있습니다. 추가 매개변수 없이 생성되므로 stochastic fair queue(`sfq`), CoDel(`codel`), fair queue CoDel(`fq_codel`)처럼 설정 없이 잘 동작하는 qdisc가 적합합니다.
class와 bandwidth 설정이 필요한 Hierarchical Token Bucket이나 Deficit Round Robin에는 적합하지 않습니다. physical multiqueue interface는 root qdisc로 계속 `mq`를 사용하고 leaf에 이 기본값을 적용합니다. `lo`, `veth` 같은 virtual device는 이 설정을 무시하고 `noqueue`를 기본 사용합니다. 기본값은 `pfifo_fast`입니다.
busy_read
181-194socket read의 low-latency busy poll timeout이며 `CONFIG_NET_RX_BUSY_POLL`이 필요합니다. device queue에서 packet을 기다리며 busy loop할 대략적인 시간이고 단위는 microsecond입니다. `SO_BUSY_POLL` socket option의 기본값을 정합니다.
socket마다 `SO_BUSY_POLL`로 설정하거나 덮어쓰는 방식이 권장됩니다. sysctl로 전역 활성화해야 한다면 `50`을 권장합니다. 전력 사용량이 늘며 기본값은 `0`(off)입니다.
busy_poll
195-209`poll`과 `select`의 low-latency busy poll timeout이며 `CONFIG_NET_RX_BUSY_POLL`이 필요합니다. event를 기다리며 busy loop할 대략적인 시간이고 단위는 microsecond입니다.
권장값은 poll할 socket 수에 따라 여러 개면 `50`, 수백 개면 `100`입니다. 더 많으면 epoll 사용을 고려합니다. `SO_BUSY_POLL`이 설정된 socket만 busy poll하므로 필요한 socket에 선택적으로 설정하거나 `sysctl.net.busy_read`를 전역 설정해야 합니다. 전력 사용량이 늘며 기본값은 `0`(off)입니다.
mem_pcpu_rsv
210-214CPU별 reserved forward allocation cache 크기이며 단위는 page입니다. 기본값은 CPU당 1MB입니다.
rmem_default
215-219socket receive buffer의 기본 크기이며 단위는 byte입니다.
rmem_max
220-226receive socket buffer의 최대 크기이며 단위는 byte입니다. 기본값은 `4194304`입니다.
rps_default_mask
227-232새로 만드는 network device에 적용할 기본 RPS CPU mask입니다. 빈 mask는 RPS가 기본적으로 비활성화됨을 뜻합니다.
tstamp_allow_data
233-241프로세스가 원래 packet 내용과 함께 loop된 TX timestamp를 받을 수 있게 합니다. 비활성화하면 `SOF_TIMESTAMPING_OPT_TSONLY` socket option이 없는 비특권 프로세스의 transmit timestamp 요청을 버립니다. 기본값은 `1`(on)입니다.
wmem_default
242-246socket send buffer의 기본 크기이며 단위는 byte입니다.
wmem_max
247-253send socket buffer의 최대 크기이며 단위는 byte입니다. 기본값은 `4194304`입니다.
message_burst and message_cost
254-263networking code가 kernel log에 쓰는 warning message를 제한합니다. denial-of-service 공격을 막기 위해 rate limit을 적용하며 `message_cost`가 클수록 기록하는 message가 줄고 `message_burst`는 message를 버리기 시작할 시점을 제어합니다. 기본 설정은 5초마다 warning 하나로 제한합니다.
warnings
264-275현재는 사용하지 않는 sysctl입니다. 예전에는 중복 주소나 잘못된 checksum 같은 network 문제로 network stack이 console에 내는 message를 제어했습니다. 이제 이 message는 `KERN_DEBUG` 수준으로 출력되며 일반적으로 `dynamic_debug` 기능으로 활성화하고 제어합니다.
netdev_budget
276-284NAPI poll 한 cycle에서 모든 interface로부터 가져올 최대 packet 수입니다. poll에 등록된 interface를 round-robin 방식으로 검사합니다. `netdev_budget`을 다 쓰지 않았더라도 cycle은 `netdev_budget_usecs` microsecond를 넘을 수 없습니다.
netdev_budget_usecs
285-291NAPI poll cycle 하나의 최대 microsecond 수입니다. 이 시간이 지나거나 처리 packet 수가 `netdev_budget`에 이르면 poll을 끝냅니다.
netdev_max_backlog
292-297interface가 커널의 처리 속도보다 빨리 packet을 받을 때 INPUT 쪽에 queue할 최대 packet 수입니다.
netdev_rss_key
298-324RSS(Receive Side Scaling) 지원 driver는 무작위로 생성한 40-byte host key를 사용합니다. 아직 `ethtool -x`를 지원하지 않는 driver에서도 사용자 공간이 내용을 읽어야 할 수 있습니다.
myhost:~# cat /proc/sys/net/core/netdev_rss_key
84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8: ... (52 bytes total)
어떤 driver도 `netdev_rss_key_fill()`을 호출한 적이 없으면 파일에 NUL byte가 들어 있습니다. `/proc/sys/net/core/netdev_rss_key`에는 52 byte key가 있지만 대부분 driver는 그중 40 byte만 사용합니다.
myhost:~# ethtool -x eth0
RX flow hash indirection table for eth0 with 8 RX ring(s):
0: 0 1 2 3 4 5 6 7
RSS hash key:
84:50:f4:00:a8:15:d1:a7:e9:7f:1d:60:35:c7:47:25:42:97:74:ca:56:bb:b6:a1:d8:43:e3:c9:0c:fd:17:55:c2:3a:4d:69:ed:f1:42:89
netdev_tstamp_prequeue
325-334`0`이면 target CPU가 packet을 처리하는 RPS 뒤에 RX packet timestamp를 sample할 수 있습니다. timestamp가 조금 늦어질 수 있지만 여러 CPU에 부하를 분산할 수 있습니다. `1`(기본값)이면 queue에 넣기 전 가능한 한 빨리 sample합니다.
netdev_unregister_timeout_secs
335-345network device unregister timeout의 초 단위 값입니다. unregister 중 device refcount가 0이 되기를 기다리며 warning을 내기까지의 시간을 정합니다. 낮은 값은 bisection 때 reference leak을 빨리 찾는 데 유용하고, 높은 값은 느리거나 부하가 큰 시스템의 false warning을 줄일 수 있습니다.
기본값은 `10`, 최솟값은 `1`, 최댓값은 `3600`입니다.
skb_defer_max
346-353할당한 CPU가 해제하는 skb의 CPU별 목록 최대 크기이며 단위는 skb 수입니다. 현재 TCP stack이 사용합니다. 기본값은 `64`입니다.
optmem_max
354-362socket마다 허용할 ancillary buffer 최대 크기입니다. ancillary data는 `struct cmsghdr` 구조체와 뒤따르는 data의 연속입니다. TCP TX zerocopy도 내부 구조체 한도로 `optmem_max`를 사용합니다. 기본값은 128KB입니다.
fb_tunnels_only_for_init_net
363-383`tunl0`, `gre0`, `gretap0`, `erspan0`, `sit0`, `ip6tnl0`, `ip6gre0` 같은 fallback tunnel을 자동 생성할지 제어합니다.
| 값 | 동작 |
|---|---|
| `0` | module을 load할 때 모든 network namespace에 해당 fallback tunnel 생성(하위 호환 동작) |
| `1` (`initns`) | init network namespace에만 생성하고 다른 namespace에는 만들지 않음 |
| `2` (`none`) | 어떤 network namespace에서도 module load 때 만들지 않음 |
module이 built-in이면 boot 뒤 `2`로 바꿔도 의미가 없으므로 기본값을 바꾸는 kernel command-line 옵션이 있습니다. 자세한 내용은 `Documentation/admin-guide/kernel-parameters.txt`를 참조하십시오.
fallback tunnel을 자동 생성하지 않으면 사용자 공간이 필요한 device만 만들 수 있어 중복 device를 피할 수 있습니다. 호환성 때문에 기본값은 `0`입니다.
devconf_inherit_init_net
384-399새 network namespace가 `/proc/sys/net/{ipv4,ipv6}/conf/{all,default}/`의 현재 설정을 어떻게 물려받을지 제어합니다.
| 값 | 동작 |
|---|---|
| `0` | 기존 동작. IPv4는 `init_net`의 현재 설정을 상속하고 IPv6는 기본값으로 초기화 |
| `1` | IPv4와 IPv6 모두 `init_net`의 현재 설정을 강제로 상속 |
| `2` | IPv4와 IPv6 모두 기본값으로 강제 초기화 |
| `3` | 새 namespace를 만든 현재 network namespace의 설정을 강제로 상속 |
호환성 때문에 기본값은 `0`입니다.
txrehash
400-408`SO_TXREHASH` option이 `SOCK_TXREHASH_DEFAULT`, 즉 `setsockopt`으로 덮어쓰지 않은 상태일 때 socket의 기본 hash 재계산 동작을 제어합니다.
| 값 | 동작 |
|---|---|
| `1` | listening socket에서 hash 재계산 수행(기본값) |
| `0` | 재계산하지 않음 |
gro_normal_batch
409-417GRO 출력에서 한 묶음으로 처리할 최대 segment 수입니다. packet이 coalesced superframe이거나 GRO가 합치지 않기로 한 원래 packet으로 GRO를 빠져나오면 NAPI별 목록에 놓입니다. segment 수가 `gro_normal_batch`에 이르면 목록을 stack으로 넘깁니다.
high_order_alloc_disable
418-429기본적으로 page fragment allocator는 x86에서 order-3 같은 high-order page를 사용하려고 합니다. 대부분 좋은 결과를 내지만 일부 사용자는 page 할당·해제 경합을 겪을 수 있습니다. 특히 high-order page를 CPU별 목록에 저장하지 않던 5.14 이전 커널에서 두드러졌습니다.
대신 order-0 할당을 선택할 수 있게 하지만 현재는 주로 역사적 의미만 있습니다. 기본값은 `0`입니다.
2. /proc/sys/net/unix - Parameters for Unix domain sockets
430-437이 디렉터리에는 파일 하나만 있습니다. `unix_dgram_qlen`은 Unix domain socket buffer에 queue할 datagram의 최대 개수를 제한합니다. `PF_UNIX` flag를 지정하지 않으면 효과가 없습니다.
3. /proc/sys/net/ipv4 - IPV4 settings
438-443이 항목의 설명은 `Documentation/networking/ip-sysctl.rst`와 `Documentation/admin-guide/sysctl/net.rst`를 참조하십시오.
4. Appletalk
444-449Appletalk가 load되면 `/proc/sys/net/appletalk`에 구성 데이터와 다음 매개변수가 나타납니다.
aarp-expiry-time
450-455ARP entry를 만료시키기 전까지 유지하는 시간이며 오래된 host를 제거하는 데 사용합니다.
aarp-resolve-time
456-460Appletalk 주소를 resolve하려고 시도할 시간입니다.
aarp-retransmit-limit
461-465포기하기 전에 query를 재전송할 횟수입니다.
aarp-tick-time
466-487만료 항목을 검사하는 비율을 제어합니다.
`/proc/net/appletalk`에는 machine의 활성 Appletalk socket 목록이 있습니다. 필드는 DDP type, `network:node` 형식 local 주소, remote 주소, transmit 대기 queue 크기, receive queue 크기(application이 읽기를 기다리는 byte), 상태, socket 소유 UID를 나타냅니다.
`/proc/net/atalk_iface`는 Appletalk에 구성된 모든 interface와 그 이름, Appletalk 주소, 해당 주소의 network 범위(phase 1 network에서는 network 번호), interface 상태를 표시합니다.
`/proc/net/atalk_route`는 알려진 각 network route의 target network, router(직접 연결일 수 있음), route flag, 사용하는 device를 표시합니다.
5. TIPC
488-490TIPC protocol의 조정 항목입니다.
tipc_rmem
491-507TIPC receive memory를 `tcp_rmem`처럼 조정하는 세 정수 `(min, default, max)` vector입니다.
# cat /proc/sys/net/tipc/tipc_rmem
4252725 34021800 68043600
#
최댓값은 `CONN_OVERLOAD_LIMIT`이고 default와 min은 같은 값을 shift해 조정한 값입니다. 현재 min은 의미 있게 사용되지 않지만 `tcp_rmem` 같은 항목과 일관성을 유지하려고 triplet 형식을 보존합니다.
named_timeout
508-519TIPC name table update는 transaction 처리 없이 cluster에 비동기로 배포되므로 race가 생길 수 있습니다. 예를 들어 한 node의 name withdrawal이 다른 node에 도착하기 전에 세 번째 node의 겹치는 name publication이 받아들여져, 원래 순서가 올바른 update도 충돌할 수 있습니다.
`named_timeout`이 0이 아니면 실패한 topology update를 defer queue에 넣고, 오류를 해소하는 다른 event가 오거나 timeout이 끝날 때까지 기다립니다. 단위는 millisecond입니다.
요약과 해설
net.rst:1-519network sysctl은 packet 처리량과 latency, socket memory, CPU 분산, network namespace 초기 상태, protocol별 timeout을 런타임에 조정합니다. 값의 단위가 packet·byte·microsecond·millisecond로 서로 다르므로 자동 조정 전에 단위를 확인해야 합니다.
busy polling은 latency를 낮추는 대신 CPU와 전력을 더 사용하고, NAPI budget과 backlog는 처리량을 높이는 대신 한 CPU cycle의 독점을 늘릴 수 있습니다. workload와 NIC queue 구조를 측정한 뒤 단계적으로 조정해야 합니다.