Skip to content

Commit bff87f4

Browse files
authored
Merge pull request #1552 from MrMeatikins/fix-arp-flux-docs-issue-1546
docs: Clarify ARP flux sysctl limitations with host networking
2 parents 6f7d2c3 + df3ca50 commit bff87f4

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

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: When using `network_mode: host`, these sysctls require the
35+
# NET_ADMIN capability to be applied to the host namespace.
36+
#
37+
# If your environment restricts capabilities, or you prefer to configure
38+
# them on the Host OS, REMOVE the sysctls block below and apply via:
39+
# sudo sysctl -w net.ipv4.conf.all.arp_ignore=1 net.ipv4.conf.all.arp_announce=2
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 or `network_mode: host` with `NET_ADMIN`)
25+
26+
If you are using standard bridged networking, or `network_mode: host` and the container is granted the `NET_ADMIN` capability (as is the default recommendation), 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 (Fallback for `network_mode: host`)
50+
51+
If you are running the container with `network_mode: host` and cannot grant the `NET_ADMIN` capability, or if your container runtime environment explicitly blocks sysctl overrides, applying these settings via the container configuration will fail. Attempting to do so without sufficient privileges typically results 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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ 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', setting these via docker-compose sysctls
26+
requires the NET_ADMIN capability. When granted, these sysctls will
27+
modify the host namespace. Otherwise, you must configure them directly
28+
on your host operating system instead.
29+
2530
Detection accuracy may be reduced until configured.
2631
2732
See: https://docs.netalertx.com/docker-troubleshooting/arp-flux-sysctls/

0 commit comments

Comments
 (0)