Connecting via VPN on Ubuntu: Quick Reference & useful commandsLast updated:
These are some useful commands and also some useful tips that may come in handy when you need to do remote work via a VPN on Ubuntu (it should mostly work for other Linux-based operation systems as well).
Connecting to a remote VPN server using OpenVPN
You probably have been given (by your network administrator, for instance) a .ovpn file named something like this: my_username@my_vpn_server_address.ovpn (replace the values with you own).
Change into the directory where your .ovpn file is and type:
$ sudo ovpn my_username@my_vpn_server_address.ovpn
You'll probably be asked for a username and a password at this step (and maybe your password for using
sudo). Again, you have probably been supplied with them by your network administrator. You should see something like this:
Sat Mar 1 16:04:00 2014 OpenVPN 2.2.1 i686-linux-gnu [SSL] [LZO2] [POLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Feb 13 2013 Enter Auth Username: my_username Enter Auth Password:
Give both and you'll see a bunch of information on your screen. If it's successful, you will probably have a success message at the end, like this:
Sat Mar 1 16:04:26 2014 Initialization Sequence Completed
Now don't close this tab!. Open other tabs on your terminal or open a new terminal altogether to start doing whatever you need to do. If you close this tab the connection is closed.
Resolve an address supplying a custom DNS server
dig, the address for your DNS server (mine is 172.16.1.1, you should replace it with your own) and supply the address you want resolved.
$ dig @172.16.1.1 your-address-here