[DEV] add ipv4 forwarding

This commit is contained in:
Edouard DUPIN 2019-04-08 23:47:22 +02:00
parent 8b97c10ca0
commit 2f50498b3c
4 changed files with 13 additions and 0 deletions

2
11_route_enable.conf Normal file
View File

@ -0,0 +1,2 @@
# Enable network forwarding
net.ipv4.ip_forward=1

View File

@ -27,6 +27,9 @@ EXPOSE 1194/udp
CMD ["ovpn_run"]
#ADD ./11_route_enable.conf /etc/sysctl.d/11_route_enable.conf
#RUN sysctl -p /etc/sysctl.d/*
ADD ./bin /usr/local/bin
RUN chmod a+x /usr/local/bin/*

View File

@ -85,6 +85,13 @@ if [ -r "$OPENVPN/crl.pem" ]; then
addArg "--crl-verify" "$OPENVPN/crl.pem"
fi
# If this fails, ensure the docker container is run with --privileged
# Could be side stepped with `ip netns` madness to drop privileged flag
echo "Enabling IPv4 Forwarding"
sysctl -w net.ipv4.ip_forward=1 || echo "Failed to enable IPv4 forwarding"
ip -6 route show default 2>/dev/null
if [ $? = 0 ]; then
echo "Enabling IPv6 Forwarding"

View File

@ -1,6 +1,7 @@
version: '2'
services:
openvpn:
privileged: true
cap_add:
- NET_ADMIN
build: .