Ubuntu: How do I confirm my VPN connection is working and make it start automatically on 12.04 server via commandline?



Question:

I'm using vyprvpn as a VPN provider and I would like to make my Ubuntu 12.04 server connect to it via pptp-linux. I only have the option of using the command line to connect so I used this guide: https://wiki.ubuntu.com/VPN

And it seems to work, but, I don't think I'm sending my data through the connection. My server has a static IP and I tried putting that IP in the settings. I'm trying w3m on ipchicken and not noticing any changes. How do I make sure its traffic is going through the VPN?

Once this works, how do I make the VPN client connect automatically whenever it has internet?

Cheers (finally, as a bonus, how do I update my nameservers? Will it work with the VPNs address?)


Solution:1

I've mostly solved this except for making the VPN start when the computer does, but here is my solution.

I originally was using the link above, but after a week of learning and mucking about, I have my own solution using the link above as a starting point (thanks Eliah for reminding me)

So, following the link above, I installed pptp-linux and then I edited /etc/ppp/peers/vpnconfigname to this:

sudo nano /etc/ppp/peers/vpnconfigname  pty "pptp vpndomain --nolaunchpppd"  noproxyarp  ipparam vpnname  remotename vpnname  name vpnuser  require-mppe-128  nobsdcomp  nodeflate  defaultroute  replacedefaultroute  persist  lock  noauth  passive  multilink  refuse-eap  refuse-chap  refuse-mschap  

then in this /etc/ppp/chap-secrets:

sudo nano /etc/ppp/chap-secrets  # Secrets for authentication using CHAP  # client        server  secret                  IP addresses  vpnusername        *    vpnpassword            *  

Finally to make it run on boot edit /etc/rc.local:

sudo nano /etc/rc.local  #!/bin/sh -e  #  # rc.local  #  # This script is executed at the end of each multiuser runlevel.  # Make sure that the script will "exit 0" on success or any other  # value on error.  #  # In order to enable or disable this script just change the execution  # bits.  #  # By default this script does nothing.    pon vpnconfigname   exit 0  

Now start it with sudo pon vpnconfigname (whatever the file is called at /etc/ppp/peers/ ) stop it with sudo poff vpnconfigname If you need debug, add it to the config file before launching. Once it's on, you can use ifconfig and route to check if it's connected, then I use tracepath and w3m ipchicken.com to check if I'm going through the vpn or not.

Cheers!


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »