Using a VPN in Ubuntu Linux when your network is controlled by ifupdown

‹ Using a Cisco compatible (vpnc) VPN from the command line in Linux | Dropping partial InnoDB tables left from a crash ›

According to this bug and this bug, it's not possible to use a VPN through NetworkManager (the GUI for managing networking in Ubuntu) if your wireless or ethernet networking is configured using ifupdown aka /etc/network/interfaces. An example of this situation is if you're using NFS shared folders in Vagrant. When I tried using NetworkManager to connect to a VPN in Vagrant with sudo nmcli con up id MyVpnName, I got:

Error: No suitable device found: no active connection or device.

To work around this, it's possible to use the underlying VPN software directly instead of NetworkManager. For example, for a Cisco-compatible VPN, you can put this file contents into /etc/vpnc/mycompany.conf

IPSec gateway [IP address]
IPSec ID [Group name]
IPSec secret [Shared secret]
Xauth username [Your account name]
Xauth password [Your password]
# Might be needed:
# NAT Traversal Mode cisco-udp

and then start up your VPN with sudo vpnc-connect mycompany

Subscribe to All Posts - Wesley Tanaka