Skip to content

Bug: OpenVPN tried to add an IP route which already exists #1939

@WINOFFRG

Description

@WINOFFRG

Is this urgent?

Yes

Host OS

Ubuntu 20.04.6 LTS

CPU arch

x86_64

VPN service provider

Custom

What are you using to run the container

docker-compose

What is the version of Gluetun

Running version latest built on 2023-04-12T12:34:51.538Z (commit d4f8eea)

What's the problem 🤔

In my docker-compose I have multiple OpenVPN configs, And only one of them is able to connect, Is it because of -/dev/net/tun:/dev/net/tun That maybe something gets locked, Don't have much idea of this. Please check the logs shared below.

Things to note:

2023-11-01T19:09:38Z ERROR [openvpn] OpenVPN tried to add an IP route which already exists (RTNETLINK answers: File exists)
2023-11-01T19:09:38Z WARN [openvpn] Previous error details: Linux route add command failed: external program exited with error status: 2

Share your logs (at least 10 lines)

========================================
========================================
=============== gluetun ================
========================================
=========== Made with ❤️ by ============
======= https://github.com/qdm12 =======
========================================
========================================

Running version latest built on 2023-04-12T12:34:51.538Z (commit d4f8eea)

🔧 Need help? https://github.com/qdm12/gluetun/discussions/new
🐛 Bug? https://github.com/qdm12/gluetun/issues/new
✨ New feature? https://github.com/qdm12/gluetun/issues/new
☕ Discussion? https://github.com/qdm12/gluetun/discussions/new
💻 Email? quentin.mcgaw@gmail.com
💰 Help me? https://www.paypal.me/qmcgaw https://github.com/sponsors/qdm12
2023-11-01T19:09:27Z INFO [routing] default route found: interface eth0, gateway 172.18.0.1 and assigned IP 172.18.0.3
2023-11-01T19:09:27Z INFO [routing] local ethernet link found: eth0
2023-11-01T19:09:27Z INFO [routing] local ipnet found: 172.18.0.0/16
2023-11-01T19:09:27Z INFO [firewall] enabling...
2023-11-01T19:09:27Z DEBUG [firewall] iptables --policy INPUT DROP
2023-11-01T19:09:27Z DEBUG [firewall] iptables --policy OUTPUT DROP
2023-11-01T19:09:27Z DEBUG [firewall] iptables --policy FORWARD DROP
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --policy INPUT DROP
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --policy OUTPUT DROP
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --policy FORWARD DROP
2023-11-01T19:09:27Z DEBUG [firewall] iptables --append INPUT -i lo -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --append INPUT -i lo -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] iptables --append OUTPUT -o lo -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --append OUTPUT -o lo -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] iptables --append OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --append OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] iptables --append INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --append INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] iptables --append OUTPUT -o eth0 -s 172.18.0.3 -d 172.18.0.0/16 -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --append OUTPUT -o eth0 -d ff02::1:ff/104 -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] iptables --append INPUT -i eth0 -d 172.18.0.0/16 -j ACCEPT
2023-11-01T19:09:27Z INFO [firewall] enabled successfully
2023-11-01T19:09:27Z INFO [storage] merging by most recent 13064 hardcoded servers and 13064 servers read from /gluetun/servers.json
2023-11-01T19:09:27Z DEBUG [netlink] IPv6 is not supported after searching 2 links and 0 routes
2023-11-01T19:09:27Z INFO Alpine version: 3.17.3
2023-11-01T19:09:27Z INFO OpenVPN 2.4 version: 2.4.12
2023-11-01T19:09:27Z INFO OpenVPN 2.5 version: 2.5.8
2023-11-01T19:09:27Z INFO Unbound version: 1.17.1
2023-11-01T19:09:27Z INFO IPtables version: v1.8.8
2023-11-01T19:09:27Z INFO Settings summary:
├── VPN settings:
|   ├── VPN provider settings:
|   |   ├── Name: custom
|   |   └── Server selection settings:
|   |       ├── VPN type: openvpn
|   |       └── OpenVPN server selection settings:
|   |           ├── Protocol: UDP
|   |           └── Custom configuration file: /gluetun/AAA.conf
|   └── OpenVPN settings:
|       ├── OpenVPN version: 2.5
|       ├── User: [not set]
|       ├── Password: [not set]
|       ├── Custom configuration file: /gluetun/AAA.conf
|       ├── Network interface: tun0
|       ├── Run OpenVPN as: root
|       └── Verbosity level: 1
├── DNS settings:
|   ├── DNS server address to use: 127.0.0.1
|   ├── Keep existing nameserver(s): no
|   └── DNS over TLS settings:
|       ├── Enabled: yes
|       ├── Update period: every 24h0m0s
|       ├── Unbound settings:
|       |   ├── Authoritative servers:
|       |   |   └── cloudflare
|       |   ├── Caching: yes
|       |   ├── IPv6: no
|       |   ├── Verbosity level: 1
|       |   ├── Verbosity details level: 0
|       |   ├── Validation log level: 0
|       |   ├── System user: root
|       |   └── Allowed networks:
|       |       ├── 0.0.0.0/0
|       |       └── ::/0
|       └── DNS filtering settings:
|           ├── Block malicious: yes
|           ├── Block ads: no
|           ├── Block surveillance: no
|           └── Blocked IP networks:
|               ├── 127.0.0.1/8
|               ├── 10.0.0.0/8
|               ├── 172.16.0.0/12
|               ├── 192.168.0.0/16
|               ├── 169.254.0.0/16
|               ├── ::1/128
|               ├── fc00::/7
|               ├── fe80::/10
|               ├── ::ffff:7f00:1/104
|               ├── ::ffff:a00:0/104
|               ├── ::ffff:a9fe:0/112
|               ├── ::ffff:ac10:0/108
|               └── ::ffff:c0a8:0/112
├── Firewall settings:
|   └── Enabled: yes
├── Log settings:
|   └── Log level: DEBUG
├── Health settings:
|   ├── Server listening address: 127.0.0.1:9999
|   ├── Target address: cloudflare.com:443
|   ├── Read header timeout: 100ms
|   ├── Read timeout: 500ms
|   └── VPN wait durations:
|       ├── Initial duration: 6s
|       └── Additional duration: 5s
├── Shadowsocks server settings:
|   └── Enabled: no
├── HTTP proxy settings:
|   ├── Enabled: yes
|   ├── Listening address: :8888
|   ├── User: 
|   ├── Password: [not set]
|   ├── Stealth mode: yes
|   ├── Log: yes
|   ├── Read header timeout: 1s
|   └── Read timeout: 3s
├── Control server settings:
|   ├── Listening address: :8000
|   └── Logging: yes
├── OS Alpine settings:
|   ├── Process UID: 1000
|   └── Process GID: 1000
├── Public IP settings:
|   ├── Fetching: every 12h0m0s
|   └── IP file path: /tmp/gluetun/ip
└── Version settings:
    └── Enabled: yes
2023-11-01T19:09:27Z INFO [routing] default route found: interface eth0, gateway 172.18.0.1 and assigned IP 172.18.0.3
2023-11-01T19:09:27Z DEBUG [routing] ip rule add from 172.18.0.3/32 lookup 200 pref 100
2023-11-01T19:09:27Z INFO [routing] adding route for 0.0.0.0/0
2023-11-01T19:09:27Z DEBUG [routing] ip route replace 0.0.0.0/0 via 172.18.0.1 dev eth0 table 200
2023-11-01T19:09:27Z INFO [firewall] setting allowed subnets...
2023-11-01T19:09:27Z INFO [routing] default route found: interface eth0, gateway 172.18.0.1 and assigned IP 172.18.0.3
2023-11-01T19:09:27Z DEBUG [routing] ip rule add to 172.18.0.0/16 lookup 254 pref 98
2023-11-01T19:09:27Z INFO [http server] http server listening on [::]:8000
2023-11-01T19:09:27Z INFO [firewall] allowing VPN connection...
2023-11-01T19:09:27Z DEBUG [firewall] iptables --append OUTPUT -d 103.125.147.49 -o eth0 -p udp -m udp --dport 443 -j ACCEPT
2023-11-01T19:09:27Z INFO [dns over tls] using plaintext DNS at address 1.1.1.1
2023-11-01T19:09:27Z INFO [http proxy] listening on :8888
2023-11-01T19:09:27Z INFO [healthcheck] listening on 127.0.0.1:9999
2023-11-01T19:09:27Z DEBUG [firewall] iptables --append OUTPUT -o tun0 -j ACCEPT
2023-11-01T19:09:27Z DEBUG [firewall] ip6tables --append OUTPUT -o tun0 -j ACCEPT
2023-11-01T19:09:27Z INFO [openvpn] DEPRECATED OPTION: --cipher set to 'AES-128-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'AES-128-CBC' to --data-ciphers or change --cipher 'AES-128-CBC' to --data-ciphers-fallback 'AES-128-CBC' to silence this warning.
2023-11-01T19:09:27Z INFO [openvpn] OpenVPN 2.5.8 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Nov  2 2022
2023-11-01T19:09:27Z INFO [openvpn] library versions: OpenSSL 3.0.8 7 Feb 2023, LZO 2.10
2023-11-01T19:09:27Z INFO [openvpn] TCP/UDP: Preserving recently used remote address: [AF_INET]103.125.147.49:443
2023-11-01T19:09:27Z INFO [openvpn] UDP link local: (not bound)
2023-11-01T19:09:27Z INFO [openvpn] UDP link remote: [AF_INET]103.125.147.49:443
2023-11-01T19:09:27Z INFO [openvpn] [server] Peer Connection Initiated with [AF_INET]103.125.147.49:443
2023-11-01T19:09:28Z ERROR [openvpn] Unrecognized option or missing or extra parameter(s) in [PUSH-OPTIONS]:6: block-outside-dns (2.5.8)
2023-11-01T19:09:28Z INFO [openvpn] TUN/TAP device tun0 opened
2023-11-01T19:09:28Z INFO [openvpn] /sbin/ip link set dev tun0 up mtu 1500
2023-11-01T19:09:28Z INFO [openvpn] /sbin/ip link set dev tun0 up
2023-11-01T19:09:28Z INFO [openvpn] /sbin/ip addr add dev tun0 local 10.11.0.26 peer 10.11.0.25
2023-11-01T19:09:31Z INFO [openvpn] UID set to nonrootuser
2023-11-01T19:09:31Z INFO [openvpn] Initialization Sequence Completed
2023-11-01T19:09:31Z INFO [dns over tls] downloading DNS over TLS cryptographic files
2023-11-01T19:09:34Z INFO [healthcheck] program has been unhealthy for 6s: restarting VPN (see https://github.com/qdm12/gluetun/wiki/Healthcheck)
2023-11-01T19:09:34Z INFO [vpn] stopping
2023-11-01T19:09:34Z ERROR [vpn] cannot get version information: Get "https://api.github.com/repos/qdm12/gluetun/commits": context canceled
2023-11-01T19:09:34Z INFO [vpn] starting
2023-11-01T19:09:34Z INFO [firewall] allowing VPN connection...
2023-11-01T19:09:34Z INFO [openvpn] DEPRECATED OPTION: --cipher set to 'AES-128-CBC' but missing in --data-ciphers (AES-256-GCM:AES-128-GCM). Future OpenVPN version will ignore --cipher for cipher negotiations. Add 'AES-128-CBC' to --data-ciphers or change --cipher 'AES-128-CBC' to --data-ciphers-fallback 'AES-128-CBC' to silence this warning.
2023-11-01T19:09:34Z INFO [openvpn] OpenVPN 2.5.8 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Nov  2 2022
2023-11-01T19:09:34Z INFO [openvpn] library versions: OpenSSL 3.0.8 7 Feb 2023, LZO 2.10
2023-11-01T19:09:34Z INFO [openvpn] TCP/UDP: Preserving recently used remote address: [AF_INET]103.125.147.49:443
2023-11-01T19:09:34Z INFO [openvpn] UDP link local: (not bound)
2023-11-01T19:09:34Z INFO [openvpn] UDP link remote: [AF_INET]103.125.147.49:443
2023-11-01T19:09:34Z INFO [openvpn] [server] Peer Connection Initiated with [AF_INET]103.125.147.49:443
2023-11-01T19:09:36Z WARN [dns over tls] cannot update files: Get "https://www.internic.net/domain/named.root": dial tcp: lookup www.internic.net on 127.0.0.11:53: write udp 172.18.0.3:40503->1.1.1.1:53: write: operation not permitted
2023-11-01T19:09:36Z INFO [dns over tls] attempting restart in 10s
2023-11-01T19:09:36Z ERROR [openvpn] Unrecognized option or missing or extra parameter(s) in [PUSH-OPTIONS]:6: block-outside-dns (2.5.8)
2023-11-01T19:09:36Z INFO [openvpn] TUN/TAP device tun0 opened
2023-11-01T19:09:36Z INFO [openvpn] /sbin/ip link set dev tun0 up mtu 1500
2023-11-01T19:09:36Z INFO [openvpn] /sbin/ip link set dev tun0 up
2023-11-01T19:09:36Z INFO [openvpn] /sbin/ip addr add dev tun0 local 10.11.0.30 peer 10.11.0.29
2023-11-01T19:09:38Z ERROR [openvpn] OpenVPN tried to add an IP route which already exists (RTNETLINK answers: File exists)
2023-11-01T19:09:38Z WARN [openvpn] Previous error details: Linux route add command failed: external program exited with error status: 2
2023-11-01T19:09:38Z INFO [openvpn] UID set to nonrootuser
2023-11-01T19:09:38Z INFO [openvpn] Initialization Sequence Completed
2023-11-01T19:09:45Z INFO [healthcheck] program has been unhealthy for 11s: restarting VPN (see https://github.com/qdm12/gluetun/wiki/Healthcheck)
2023-11-01T19:09:45Z INFO [vpn] stopping
2023-11-01T19:09:45Z INFO [vpn] starting

Share your configuration

proxy-in2:
  image: qmcgaw/gluetun
  container_name: ovpn-AAA
  cap_add:
    - NET_ADMIN
  devices:
    - /dev/net/tun:/dev/net/tun
  ports:
    - 7100:8888/tcp
  volumes:
    - ./data/AAA.conf:/gluetun/AAA:ro
  environment:
    - VPN_SERVICE_PROVIDER=custom
    - OPENVPN_CUSTOM_CONFIG=/gluetun/AAA.conf
    # - HTTPPROXY_LOG=on
    - HTTPPROXY=ON
    - HTTPPROXY_STEALTH=on
  restart: always 

proxy-in3:
  image: qmcgaw/gluetun
  container_name: ovpn-BBB
  cap_add:
    - NET_ADMIN
  devices:
    - /dev/net/tun:/dev/net/tun
  ports:
    - 7200:8888/tcp
  volumes:
    - ./data/BBB.conf:/gluetun/BBB.conf
  environment:
    - VPN_SERVICE_PROVIDER=custom
    - OPENVPN_CUSTOM_CONFIG=/gluetun/BBB.conf
    - HTTPPROXY_LOG=on
    - HTTPPROXY=ON
    - HTTPPROXY_STEALTH=on
    - LOG_LEVEL=debug
  restart: always

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions