I'm noticing IPTABLES failing on container start up:
ovpn_env.sh:
declare -x OVPN_AUTH=""
declare -x OVPN_CIPHER=""
declare -x OVPN_CLIENT_TO_CLIENT
declare -x OVPN_CN="vpn.example.co"
declare -x OVPN_COMP_LZO
declare -x OVPN_DEFROUTE="0"
declare -x OVPN_DEVICE="tun"
declare -x OVPN_DNS="1"
declare -x OVPN_ENV="/etc/openvpn/ovpn_env.sh"
declare -x OVPN_FRAGMENT
declare -x OVPN_MTU
declare -x OVPN_NAT="1"
declare -x OVPN_OTP_AUTH
declare -x OVPN_PORT="1194"
declare -x OVPN_PROTO="udp"
declare -ax OVPN_PUSH='([0]="dhcp-options DNS 8.8.8.8")'
declare -ax OVPN_ROUTES='([0]="172.0.0.0/8")'
declare -x OVPN_SERVER="10.99.0.0/24"
declare -x OVPN_SERVER_URL="udp://vpn.example.co:1194"
declare -x OVPN_TLS_CIPHER=""
openvpn.conf:
server 10.99.0.0 255.255.255.0
verb 3
key /etc/openvpn/pki/private/vpn.example.co.key
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/vpn.example.co.crt
dh /etc/openvpn/pki/dh.pem
tls-auth /etc/openvpn/pki/ta.key
key-direction 0
keepalive 10 60
persist-key
persist-tun
proto udp
# Rely on Docker to do port mapping, internally always 1194
port 1194
dev tun0
status /tmp/openvpn-status.log
user nobody
group nogroup
push "route 172.0.0.0 255.0.0.0"
push 'dhcp-option DNS 8.8.8.8'
push 'dhcp-option DNS 10.99.0.1'
push 'dhcp-option DOMAIN example.local'
+ iptables -t nat -C POSTROUTING -s 10.99.0.0/24 -o eth0 -j MASQUERADE
iptables: No chain/target/match by that name.
+ iptables -t nat -A POSTROUTING -s 10.99.0.0/24 -o eth0 -j MASQUERADE
+ for i in '"${OVPN_ROUTES[@]}"'
+ iptables -t nat -C POSTROUTING -s 172.0.0.0/8 -o eth0 -j MASQUERADE
iptables: No chain/target/match by that name.
+ iptables -t nat -A POSTROUTING -s 172.0.0.0/8 -o eth0 -j MASQUERADE
Does NAT work for you? Can you access the Internet through the VPN?
Yes when I am connected to the VPN I am able to access all sites on my end with no issues.
Closing due to no updates in a few months.
Hi, @kylemanna. I see the same issue. What information do you need to help troubleshoot?
Same here when running the following command: docker run --volumes-from ovpn-data --rm --publish 1194:1194/udp --cap-add=NET_ADMIN --privileged --env DEBUG=1 kylemanna/openvpn
[snip]
+ ARGS+=("${arg}")
+ '[' 2 -ge 1 ']'
+ ARGS+=("${val}")
+ '[' -z '' ']'
+ OVPN_NATDEVICE=eth0
+ '[' 1 '!=' 0 ']'
+ setupIptablesAndRouting
+ iptables -t nat -C POSTROUTING -s 192.168.255.0/24 -o eth0 -j MASQUERADE
iptables: No chain/target/match by that name.
+ iptables -t nat -A POSTROUTING -s 192.168.255.0/24 -o eth0 -j MASQUERADE
+ for i in '"${OVPN_ROUTES[@]}"'
+ iptables -t nat -C POSTROUTING -s 192.168.254.0/24 -o eth0 -j MASQUERADE
iptables: No chain/target/match by that name.
+ iptables -t nat -A POSTROUTING -s 192.168.254.0/24 -o eth0 -j MASQUERADE
+ '[' /etc/openvpn/pki/crl.pem -nt /etc/openvpn/crl.pem ']'
+ '[' -r /etc/openvpn/crl.pem ']'
[snip]
Cannot access Internet through the VPN.
Any updates?
Most helpful comment
Same here when running the following command:
docker run --volumes-from ovpn-data --rm --publish 1194:1194/udp --cap-add=NET_ADMIN --privileged --env DEBUG=1 kylemanna/openvpnCannot access Internet through the VPN.