Linux

Ubuntu vpn connects successfully and shortly thereafter fails – network traffic stops – either VPN and local network

I’ve started to use Ubuntu for my job needs and experienced first pretty annoying challenge with VPN connection.
I’m using openvpn client with network manager. After successfull connect to VPN server I can use local and remote networks with no problem. After a while – like 1 -10 minutes , sometimes a bit longer up to couple hours or sometimes immediately – all network interfaces stop functioning – either no VPN and no local network.
I ‘ve googled a lot and found a confirmed network-manager package bug with very similar behaviour described – Bug #991666 . But the bug is unresolved so far.
Nevertheless I was trying to find the reason and workaround for this issue. And found a problem in routing table.

  • My routing table before connection to VPN (local network works OK):

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.100.1   0.0.0.0         UG    0      0        0 eth0
192.168.100.0   0.0.0.0         255.255.255.0   U     1      0        0 eth0

  •    My routing table after connection to VPN (all network traffic stops working after a short time):

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.100.1   0.0.0.0         UG    0      0        0 eth0
10.242.2.1      10.242.2.21     255.255.255.255 UGH   0      0        0 tun0
10.242.2.21     0.0.0.0         255.255.255.255 UH    0      0        0 tun0
78.47.224.80    10.242.2.21     255.255.255.248 UG    0      0        0 tun0
80.249.167.64   10.242.2.21     255.255.255.192 UG    0      0        0 tun0
82.195.75.160   10.242.2.21     255.255.255.224 UG    0      0        0 tun0
82.195.78.142   192.168.100.1   255.255.255.255 UGH   0      0        0 eth0
172.16.10.0     10.242.2.21     255.255.254.0   UG    0      0        0 tun0
192.168.1.0     10.242.2.21     255.255.255.0   UG    0      0        0 tun0
192.168.100.0   10.242.2.21     255.255.255.0   UG    0      0        0 tun0

192.168.100.0   0.0.0.0         255.255.255.0   U     1      0        0 eth0

10.242.2.21 – my VPN gateway
192.168.100.0 – my local network

As you see two strange static routes are pushed by server (marked in red). The green one (192.168.100.0) – my network points to default destination. One of the red ones (192.168.100.0) points to the VPN gateway. I’m really not a network guy and it is not my strength, but it looks for me suspicious. Probably some kind of collision happens when OS does not know where to forward packets when routing table shows two directions. As far as I know Metric should help to make this decision, but maybe it is not interpreted correctly, whatever… What I did – just asked network admin to remove those two extra static routes and thereafter everything started to function properly… Those routes were not needed and used for any puposes anyway – some legacy stuff…
If there is possibility that you experience similar reason, some test can be made by manually locally removing particular routing records, or by connecting some intermediate router.

So thats my story with happy-end  after long fustrating hours of investigation. Good luck!

Ubuntu 14.04