How to use vpn on linux

Connect to a VPN

A VPN (or Virtual Private Network ) is a way of connecting to a local network over the internet. For example, say you want to connect to the local network at your workplace while you’re on a business trip. You would find an internet connection somewhere (like at a hotel) and then connect to your workplace’s VPN. It would be as if you were directly connected to the network at work, but the actual network connection would be through the hotel’s internet connection. VPN connections are usually encrypted to prevent people from accessing the local network you’re connecting to without logging in.

There are a number of different types of VPN. You may have to install some extra software depending on what type of VPN you’re connecting to. Find out the connection details from whoever is in charge of the VPN and see which VPN client you need to use. Then, go to the software installer application and search for the NetworkManager package which works with your VPN (if there is one) and install it.

If there isn’t a NetworkManager package for your type of VPN, you will probably have to download and install some client software from the company that provides the VPN software. You’ll probably have to follow some different instructions to get that working.

To set up the VPN connection:

  1. Open the Activities overview and start typing Network .
  2. Click on Network to open the panel.
  3. At the bottom of the list on the left, click the + button to add a new connection.
  4. Choose VPN in the interface list.
  5. Choose which kind of VPN connection you have.
  6. Fill in the VPN connection details, then press Add once you are finished.
  7. When you have finished setting up the VPN, open the system menu from the right side of the top bar, click VPN off and select Connect . You may need to enter a password for the connection before it is established. Once the connection is made, you will see a lock shaped icon in the top bar.
  8. Hopefully you will successfully connect to the VPN. If not, you may need to double-check the VPN settings you entered. You can do this from the Network panel that you used to create the connection. Select the VPN connection from the list, then press the button to review the settings.
  9. To disconnect from the VPN, click the system menu on the top bar and click Turn Off under the name of your VPN connection.
Читайте также:  Linux replace all spaces

More Information

  • Wired networking — Use a wired internet connection and set a static IP address.
  • Wireless networking — Connect to wireless networks, including hidden networks and networks created from phone tethering.

You can choose the displayed language by adding a language suffix to the web address so it ends with e.g. .html.en or .html.de.
If the web address has no language suffix, the preferred language specified in your web browser’s settings is used. For your convenience:
[ Change to English Language | Change to Browser’s Preferred Language ]

The material in this document is available under a free license, see Legal for details.
For information on contributing see the Ubuntu Documentation Team wiki page. To report errors in this documentation, file a bug.

Источник

How to set up a VPN on Linux in 5 minutes for free

0jQRz8Lq5TMnub3QwzWsGrIL01QvcvqLVsu3

How to set up a VPN on Linux in 5 minutes for free

In this short and overdue tutorial, we will set up a virtual private network (VPN) to help protect your online anonymity. I will not be covering much on what a VPN is or what these settings are. We’re going to set one up. Let’s get straight to it.

Windows Version:

Update:

If you have any issues run a test on ipleak.net to find out what exactly is leaking information then view this response and the one linked in it. If it doesn’t help solve your problem then post a comment with as much information as possible.

  • Computer with Linux OS. I’m using Ubuntu. The commands may be different if you’re not on a Debian based distro.
  • Admin/Sudo privileges
  • Basic computer skills
  • Basic knowledge of what a VPN is

Take note of everything you change and make backups in case something goes wrong. Also, for the record, I’m not affiliated with any of the sites linked here. Follow this tutorial at your own risk since you could mess up some settings.

Читайте также:  Симс для линукс минт

Part 1: Changing your DNS

Your domain name server (DNS) can give away some information about you, so we will want to change that. Start by using a tool such as DNS leak test to see what information is visible. Then work on hiding it.

  1. We’re going to use OpenDNS. Head to their website and grab their two name server IP addresses that can be found on their Setup Guide Page
  • 208.67.222.222
  • 208.67.220.220

2. Edit: /etc/dhcp/dhclient.conf

In your terminal type or copy/paste the command below. Nano is a text editor in the terminal. If the file is located somewhere else on your machine google or look for it.

sudo nano /etc/dhcp/dhclient.conf

Look for the line that says “prepend domain-name-servers.” If it’s commented out with a # symbol at the beginning of the line, uncomment it by removing the #. Now change the line so it uses the IP addresses from OpenDNS, and add one more 8.8.8.8 like mine below. Your internet may temporarily stop working at this point!

prepend domain-name-servers 208.67.222.222, 208.67.220.220, 8.8.8.8;

That line means it will use the first address, then the second if the first one fails, and finally 8.8.8.8 if the first two fail. This usually will not happen. We add 8.8.8.8 because by default it uses 3 addresses. If we don’t add the third one and the first two fail then your real address gets used. Now save and exit as shown below:

Press CTRL + O
Press ENTER
Press CTRL + X

This will save and close the file. Now we’ll need to restart network-manager with the next command.

sudo service network-manager restart

You should now check to see if it works. Enter the command below, and see if the nameservers show up. Do a DNS leak test on the website linked above.

NAPB3f48SQnp8IewjzDWYOK9B67XUaO1rs9w

Potential Issues

I did the steps, but the cat command only shows nameserver 127.0.1.1
Thanks to Dietmar and AnalyzeTrades for this issue/solution
Try commenting/removing dns=dnsmasq from /etc/NetworkManager/NetworkManager.conf

Part 2: Setting up a VPN

Fixing a DNS leak in web browser:

  1. In Firefox type about:config in your address bar and press Enter.
  2. On the config page search for: media.peerconnection.enabled
  3. Change it to false by double clicking on it.
  4. Restart Firefox.

I don’t know how this is done in other browsers.

Читайте также:  Установка драйверов линукс убунту

Getting a Free VPN

HchTObMrt8AW80L6ym8DZsDVa3ozXUYKt4cC

  1. Google for a free VPN, and make sure it’s good. I’ll be using VPNBook for the rest of the steps.
  2. On VPNBook, you just download the config file for the VPN you want. Copy the username and password. The password changes periodically, so you will need to get it again later. It doesn’t matter where you are located when choosing your config file. You can be in the U.S., download the Euro one, and appear to be from Europe.

3. After you extract the downloaded zip file, open your terminal again. Change to the directory where you extracted it, or right click and choose “Open in Terminal.” We have just a few more steps now.

4. Install OpenVPN to use the config.

sudo apt-get install openvpn

5. Close your browser and anything connected to the internet. To use OpenVPN, enter the command below to run the config you want. Once it says “Initialization Complete,” you’re all set. You should keep the terminal open. If it fails, try a different VPN, or read the error and try to figure it out.

sudo openvpn vpnbook-ca1-tcp443.ovpn

6. Finally, test if it works by doing another DNS leak test.

LqnoSqqFtiI9sJ1GeDKJpf7X4YAOZ8J4cHQkwjW6bJS4FWl1cZN1uBifZbaWTdl1xirUYkmf

Congratulations if you made it this far and it works! Here’s a bonus simple bash script that you can run. You just need to change the password when needed.

Bash Script 1
credits to Adnan Rahić

cd /path/to/VPNBook.com-OpenVPN-Euro1username="vpnbook"password="he2qv5h"read -sp "Enter Sudo Password: " sudopassword
spawn sudo openvpn vpnbook-euro1-tcp443.ovpnexpect "password for $USER: "send "$sudopassword\r"expect "Enter Auth Username: "send "$username\r"expect "Enter Auth Password: "send "$password\r"expect "$ "

This will start the VPN without the need to enter the username and password manually. The VPN will also stay running in the background. Here’s a script for killing it if the need arises.

Bash Script 2

#!/bin/bashecho "user: vpnbook"echo "pass: 5VHZEps"sudo openvpn vpnbook-ca1-tcp443.ovpn

Just put that into a new file, right click > properties > permissions, and allow executing file as a program. This example uses the Canada tcp 443 config.

Further Reading

Here are a few great articles by Quincy Larson that talk about VPNs, internet privacy, and security.

If you’re interested in ethical hacking and security, there’s a free 15 hour course on YouTube.

Источник

Оцените статью
Adblock
detector