fix dev tun and sysctl ip_forward error

This commit is contained in:
Антон
2026-02-07 14:07:47 +03:00
parent f9df3f8d05
commit 6131bcaba9
2 changed files with 9 additions and 9 deletions

View File

@@ -7,23 +7,20 @@ if [ ! -c /dev/net/tun ]; then
chmod 600 /dev/net/tun chmod 600 /dev/net/tun
fi fi
# Enable IP forwarding # Enable IP forwarding (moved to docker-compose.yml sysctls)
sysctl -w net.ipv4.ip_forward=1 || true # sysctl -w net.ipv4.ip_forward=1 || true
# NAT MASQUERADE # NAT MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# MSS Clamping (Path MTU Tuning) # MSS Clamping (Path MTU Tuning)
# Works for both directions in one rule on the FORWARD chain
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
# Minimal OpenRC initialization to allow rc-service to work in Alpine
# Start OpenRC (needed for rc-service if we use it, but better to start openvpn directly or via rc) mkdir -p /run/openrc
# Since we are in Alpine, we can try to start the service if configured, touch /run/openrc/softlevel
# but Container 4 main.py might expect rc-service to work.
openrc default
# Start the APP_PROFILER API # Start the APP_PROFILER API
# We use 0.0.0.0 to be reachable from other containers # We use 0.0.0.0 to be reachable from other containers
python main.py python main.py

View File

@@ -59,7 +59,10 @@ services:
container_name: ovp-profiler container_name: ovp-profiler
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
sysctls:
- net.ipv4.ip_forward=1
devices: devices:
- "/dev/net/tun:/dev/net/tun" - "/dev/net/tun:/dev/net/tun"
ports: ports:
- "8000:8000" - "8000:8000"