Skip to content

Commit 93fc126

Browse files
committed
docs: clarify ARP flux sysctl limitations with host networking
1 parent a60ec9e commit 93fc126

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

docs/DOCKER_COMPOSE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ services:
3030
- CHOWN # Required for root-entrypoint to chown /data + /tmp before dropping privileges
3131
- SETUID # Required for root-entrypoint to switch to non-root user
3232
- SETGID # Required for root-entrypoint to switch to non-root group
33+
# --- ARP FLUX MITIGATION ---
34+
# Note: If running in `network_mode: host`, modern Docker/runc will correctly
35+
# block sysctl overrides via the container configuration to prevent
36+
# unauthorized changes to the host's global kernel settings.
37+
#
38+
# If using host networking, REMOVE the sysctls block below and apply
39+
# settings directly on your Host OS instead (sudo sysctl -w ...).
40+
# ---------------------------
3341
sysctls: # ARP flux mitigation (reduces duplicate/ambiguous ARP behavior on host networking)
3442
net.ipv4.conf.all.arp_ignore: 1
3543
net.ipv4.conf.all.arp_announce: 2

docs/docker-troubleshooting/arp-flux-sysctls.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ The running environment does not provide the expected kernel sysctl values. This
2121

2222
## How to Correct the Issue
2323

24-
Set these sysctls at container runtime.
24+
### Option A: Via Docker (Standard Bridge Networking)
25+
26+
If you are using standard bridged networking (default), set these sysctls at container runtime.
2527

2628
- In `docker-compose.yml` (preferred):
2729
```yaml
@@ -44,6 +46,24 @@ Set these sysctls at container runtime.
4446
> - Use `--privileged` with `docker run`.
4547
> - Use the more restrictive `--cap-add=NET_ADMIN` (or `cap_add: [NET_ADMIN]` in `docker-compose` service definitions) to allow the sysctls to be applied at runtime.
4648

49+
### Option B: Via Host OS (Required for `network_mode: host`)
50+
51+
If you are running the container with `network_mode: host`, modern Docker versions (specifically the `runc` runtime) **will not allow** you to set `net.*` sysctls via the container configuration. Attempting to do so will result in an OCI runtime error: `sysctl "net.ipv4.conf.all.arp_announce" not allowed in host network namespace`.
52+
53+
In this scenario, you must apply the settings directly on your host operating system:
54+
55+
1. **Remove** the `sysctls` section from your `docker-compose.yml`.
56+
2. **Apply** on the host immediately:
57+
```bash
58+
sudo sysctl -w net.ipv4.conf.all.arp_ignore=1
59+
sudo sysctl -w net.ipv4.conf.all.arp_announce=2
60+
```
61+
3. **Make persistent** by adding the following lines to `/etc/sysctl.conf` on the host:
62+
```text
63+
net.ipv4.conf.all.arp_ignore=1
64+
net.ipv4.conf.all.arp_announce=2
65+
```
66+
4767
## Additional Resources
4868

4969
For broader Docker Compose guidance, see:

install/production-filesystem/entrypoint.d/37-host-optimization.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ if [ "$failed" -eq 1 ]; then
2222
net.ipv4.conf.all.arp_ignore=1
2323
net.ipv4.conf.all.arp_announce=2
2424
25+
Note: If using 'network_mode: host', you cannot set these via docker-compose
26+
sysctls. You must configure them directly on your host operating system instead.
27+
2528
Detection accuracy may be reduced until configured.
2629
2730
See: https://docs.netalertx.com/docker-troubleshooting/arp-flux-sysctls/

0 commit comments

Comments
 (0)