Linux.com

Home Linux Community Community Blogs

Community Blogs



Setting up VPN on Linux

There is definitely a growing trend of people trying out Linux operating systems. The motivation might be the fact that they are free and generally considered superior to Windows when it comes to security and stability. People who want to give Linux a fair shot generally go with Debian-based forks like, Ubuntu, Linux Mint etc.

Although installing some of the most common software like, Skype, Web browsers, Music players are pretty easy using the software repositories, it could be quite intimidating for a newbie to configure VPN or install a new printer if it doesn't work out-of-box.

A VPN comes very handy to protect one's personal information, gain access to geo-restricted content -- for instance, one can use a US VPN to gain access to services like Spotify and Netflix, to secure their internet connection when using unprotected public networks. However, if one looks for the right tutorial or ask for help in discussion boards, one would realize the fact that setting up things on the popular Debian-based distributions is quite easy. There are 2 types of VPN solutions, OpenVPN and PPTP VPN. Today we are going to see how to setup VPN with PPTP on Ubuntu and its derivatives.

If you know a thing or two about Linux, it would only a few minutes to setup VPN. If you are beginner, stop bitting your nails, you are going to do just fine if you are a good at following instructions.

Server side setup

The server will be responsible to assign IP addresses to all the client machines in the network, be it Linux, Windows or Mac clients.

- 1. The very first thing is to install the PPTP package on your server. One can simply use the standard "apt-get" command to install. It is advisable to update the repositories first. Use the following commands. It will only take a few seconds for the installation to complete.

sudo apt-get update
sudo apt-get install pptdp

- 2. Now you will have to edit the pptd.conf file. The file resides in the following path, "/etc/pptpd.conf"
If you have GUI you can do it with your favorite text editor (e.g. Gedit).

sudo gedit /etc/pptpd.conf

Or you could use "nano" to edit the file right from the terminal.

sudo nano /etc/pptpd.conf

If you have not used nano before, you might as well check out this discussion on Ask Ubuntu [http://askubuntu.com/questions/54221/how-to-edit-files-in-a-terminal-with-nano] for help.

- 3. You need to add the following two lines to "pptpd.conf."

localip 172.20.0.1
remoteip 172.20.0.100-300

What does these lines do? The VPN server will use the localip inside the VPN and an IP with in the range 172.20.0.100 to 300 (e.g., 172.20.0.120, 172.20.0.124, etc.,) will be assinged to the clients that connect to the server.

- 4. The next step is to add new users. You will have to use "nano" or a text editor or Gedit like you did with editing the pptpd.config file above. The file will have all the information about users and is stored in the following file, "/etc/ppp/chap-secrets"

Edit this file to add new users. You will have the enter certain details in the right order for this to work. First you will have to enter the client's name, followed by the server, the password and IP address.

So a couple of new client added to the VPN might look like this.

computer1 pptpd password *
computer2 pptpd password *

You can either use a specific IP address, but it is better to use asterisk, which means that any IP address in the range assigned could be used to login.

- 5. This step is optional, but is advised to assign a DNS server. There are several free DNSs out there, the 2 most popular are, OpenDNS and Google's DNS.

If you want to use OpenDNS, you should use these IP addresses 208.67.222.222 & 208.67.220.220. If you would like to use Google's DNS, you will have to use the IPs 8.8.8.8 and 8.8.4.4. To use OpenDNS you can add these lines to the file.

ms-dns 208.67.222.222
ms-dns 208.67.220.220

- 6. Almost everything on the server side is done. Now it is time to wake the daemon. To start PPTPD, you will have to use the following terminal command.

service pptpd start

- 7. Now you need to setup proper forwarding. This time you will have to edit the file "/etc/systl.conf"
There should be the following line in this file.

net.ipv4.ip_forward = 1

If it doesn't exist, copy paste this into the file and save the file and update it using the command,

"sysctl -p"

- 8. Finally if you wish the clients to communicate with one another, you will have to add the following rules.
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save

In the above rule, you will have to replace "eth0" with the internet connection that is used by the server. You can use the commands, iwconfig and ifconfig to figure this out.

# iptables --table nat --append POSTROUTING --out-interface ppp0 -j
# iptables -I INPUT -s 172.20.0.0/20 -i ppp0 -j ACCEPT
# iptables --append FORWARD --in-interface eth0 -j ACCEPT

The above rule also requires you to use the correct internet connection like for the first rule. That's it everything on the server side has been configured and clients could now handshake with the server now.

Client side setup

It really doesn't matter what operating system the clients run. You can find tutorials to configure Windows and Mac OSX on the internet. There are even services like Switch VPN, that can help you connect you Android device to the VPN server quite easily. However, here we are going to see how one can easily setup a Debian-based client for VPN.

- 1. The client should have pptp installed. We have already done this step on the server. You will just have to do this again on your clients with the following terminal commands on Debian-based distros.

sudo apt-get update
sudo apt-get install pptp-linux

- 2. Now you will have to load the ppp_mppe module, which could be triggered with the following command.

modprobe ppp_mppe

- 3. Create client configuration file in the following directory (/etc/ppp/peers/). You can name this file whatever you want. But you will have to remember this file name to connect to the VPN server.

pty "pptp --nolaunchpppd"
name computer1
password password
remotename PPTP
require-mope-128

If you had named this file "vpncomputer1", you should use the following command to connect to the server.

pppd call vpncomputer1

- 4. Finally for proper routing, you will have to execute the following line.

ip route add 172.20.0.0/20 dev ppp0

The above steps can use used several times to add multiple clients to the server.

 

Install EPEL Repo on a CentOS and RHEL 7.x Server

A larger number of packages can be installed from Fedora EPEL repo on a CentOS and Red Hat Enterprise Linux (RHEL) version 7.x. This quick tutorial explains how to enable Fedora EPEL repo on a Red Hat Enterprise Linux server version 7.x or CentOS Linux server version 7.x.

Read more: Install EPEL Repo on a CentOS and RHEL 7.x

 

CentOS and RHEL 7: Install Linux, Apache, MariaDB, PHP (LAMP) Stack

I am new Red Hat Enterprise Linux version 7 user/sysadmin/developer. This version made the big number change for RHEL 7/CentOS 7. How can I install LAMP (Linux, Apache, MariaDB, PHP) stack on a RHEL version 7 or CentOS Linux version 7 using CLI or over ssh based session?

CentOS and RHEL 7: Install Linux, Apache, MariaDB, PHP (LAMP) Stack

 

My first Linux based robot

My Robot

I successfully connected my BeagleBone Black running Angstrom Linux to a Dagu Rover 5 Tracked Chassis using the Rover 5 motor driver board.  I then wrote Python client/server scripts that allowed me to control the robot over a Bluetooth RFComm connection.  The blog posts listed below document the steps I took to create the robot, from start to finish, with videos and images.

 

I just got my BeagleBoard Black, now what?

My first working robot, It’s Alive

My first working robot, It’s Alive – Part 2

My first working robot, It’s Alive – Part 3

 

 

How to disable Ipv6 on Ubuntu, Linux Mint, Debian

Ipv6 Ipv6 is the next version of the addressing scheme Ipv4 that is currently being used to assign numerical address to domain names like google.com over the internet. Ipv6 allows for more addresses than what Ipv4 supports. However it is not yet widely supported and its adoption is still in progress. Does your system support ipv6...
Read more... Comment (0)
 

9 ASCII Games You'll Want to Play Again and Again

Text-based games often receive little coverage in the Linux press. However, there are some real ASCII gems out there waiting to be explored which are immensely addictive and great fun to play.


<A HREF="http://www.linuxlinks.com/article/20140621060017503/9ASCIIGames.html">Read on</A>

 

How to set up KVM Virtualization in RHEL/CentOS 6

Hi Linux fans, I have been using KVM virtualization a lot recently for learning and as a lab set up to try out all my new stuff. I originally started writing articles for KVM in Ubuntu in my Jungle Geek blog. One of my readers wanted to try that out on a CentOS operating system. So I decided to write an article for KVM on CentOS to help him out.

If you are interested in learning about how to setup KVM virtualization on RHEL/CentOS, please visit my blog and the article link is below.

 

Thanks

Venkat Nagappan

 

20 things to do after installing Elementary OS 0.2 Luna

Elementary OS Luna Elementary OS is another very cool linux distro based on Ubuntu. It has an intense focus on visual design and user experience. It comes with its own desktop environment called Pantheon that is designed to resemble mac. In this post we are going to tweak elementary OS right after a fresh installation and also install some essential apps to fully load the desktop for the best experience. 1. Enable all software repositories Launch...
Read more... Comment (0)
 

My Recent Linux Journey

A journey from Windows through doubt, frustration and despair to relief and a finally joy. This journey started on 31 May 2014 the day after the release of Linux Mint 17 “Qiana” Cinnamon and finished on the 17 June 2014. I worked on this continually for 8 or more hours a day over this time can’t work at the moment so I had time on my side.

I was excited at the prospect of the new Mint 17 “Qiana” Cinnamon release I had been waiting for a while I was running Petra with Cinnamon for some time with limited success just minor crashes delays and freezes was busy then so I didn't have the time to spend on it. I have been interested in Linux for some time and on another older PC some years ago ran with Mandrake and also SUSE.

My System

Mainboard Asus P6X58D Premium with 64 bit architecture

BIOS Version/Date American Megatrends Inc. 1501, 10/05/2011

Processor Intel(R) Core(TM) i7 CPU 950 @ 3.07GHz, 3068 Mhz, 4 Core(s), 8 Logical Processor(s)

Socket LGA 1366 with water cooling

Memory 32 G DDR 3 1600MHz Comprising 4x Corsair Vengeance Ver 2.12 1.50 v sticks

Power supply Sea sonic X series Model SS 750 KM Active PFC F3

Display NVIDIA GeForce GTX 560 Ti 1 GB DDR5

On windows 8 this card has diver issues with propriety drivers after the 314.22 desktop driver

Hard Drives Model Seagate ST31000528AS 1TB

Mounted as sda ( Partioned for different storage options movie's Digital Photos etc) this is connected to a 3gb data port on the main drive

Model Western Digital WDC WD1002FAEX-00Y9A0 1TB

Mounted as sdb (this drive held my windows 8 operating system and was partioned to run linux behind it with Root Swap and home partions) the other factor with this drive was it is connected to a 6g Sata port on the mainboard

Model Western Digital WDC WD1002FAEX-00Y9A0 1TB

Mounted as sda ( Partioned for different storage options movie's Digital Photos etc) the other factor with this drive was it is connected to a 6g Sata port on the mainboard

All of this is wrapped up in a nice Lain li allow modular type case. I use Logitech peripherals such as

Wireless (Mouse keyboard headset) and speakers

So with a fresh download of Linux Mint 17 Cinnamon burnt to a live dvd via power iso 5.7

my journey commenced, I partitioned sdb behind the windows partition ( where mint 16 had been ) expecting to be done in no time and happy and excited to explore

the latest version, well how wrong could I be. Things did not go at all well the install was fine but as I started into the system to personalise there were continual freezes lock ups and restarts (hard reboots) I read all I could an could not find any of the same issues except for my NVIDIA driver so I tried using generic one then slowly moved up but the same things continued to happen I could not get 10 minutes use out of the system.

So I re-downloaded the ISO file and re burnt it figuring something had gone wrong in that process but again the same issues raised their heads. I was not feeling at all happy at this point. Liking mint so much I decided to try the mate version after a few more hours of reading. This time I set the partitions up on sdc and download another ISO different desktop so things just might go better for me and they did for a while but then again once I had customised to the way I wanted given just a few crashes and hard restarts along the way mint mate to became unusable.

Not being one to give up and liking the Ubuntu / Mint way of installing packages I then tried several other distros to see if I could get a working Linux system, however to my dismay that was not to be. After using every version of Ubuntu L K I then tried Open suse for sure this would work another download. The system installed but would not boot past x so it just had to be my Graphics card.

I had another one here an older ATI card so I changed that and tried Pclinuxos this came close to working but still the same issue I put my NVIDIA card back in and tried a few more distros like Bodhi no joy there the live dvd would not even work. Onto Magei 4 and through Makulu Mate but no joy by this time it was its easier to forget linux than it is to proceed. I tried one more distro Lxle I set this one up on sda the Seagate drive it configured my NVIDIA card along the way and the distro seemed to work with my system or at least it did for a while, along the way through all this I had to reconfigure my windows boot loader to get the windows system to boot so it was a learning experience. However once again the system was not good.

I remembered that my system was over-clocked so I changed the memory settings and it seemed to work a little better but not much very long lag times and still system freezes. By this Time I am really thinking it will never happen I had used acronis for years to back up windows 8 and it had served me well so I was not really afraid to do anything as as I always had a fail-safe (well I thought so). After hitting the “return the system to default” in the bios I found out my fail-safe no longer worked and I had just crashed my whole system. Despair had set in.

So a day to rebuild my windows system then not to be beaten I tried Lxle again mainly because of the way it installed I had also installed it on my latop and it was the only Distro to pick up the wifi and use it during the installation. So back to it and to my ultimate surprise it installed well and ran even better. Wow this seems great then I went to open some files stored on other drives and to my surprise I could not see either of the two western digital drives sdb sdc on the system. Thinking of what had gone right with the install and why I couldn't see the other drives I read my motherboard manual and figured out I had those two hard drives connected to the 6gb sata connectors was this why I could not see them. A few checks of the bios and a quick change to have the drives recognised as AHCI as opposed to IDE and my whole system opened up.

I have now reinstalled Linux Mint 17 Cinnamon on my Seagate drive sda and the system runs perfectly. So now joy in fact I have written this on LibreOffice Writer. After spend so much time thinking my NVIDIA card was the issue I have solved to problem and I am not sure what exactly it was. I just wanted to share my experience as sometimes it can get frustrating but if you work through the issues you will find as I have a Linux system that works on pair if not better than windows and is far more enjoyable. My laptop remains with Lxle.

 

Demo film about the new features of Univention Corporate Client 2.0

There is a new demo film about the features of the recently released desktop operating system Univention Corporate Client (UCC) 2.0 at:

http://www.univention.com/products/ucc/

 

Add a Printer On Linux With CUPS Web Utility

Apple Inc, is seen by many in the open source world as a power hungry and closed technology company. Although it might be the case to some extent, Apple has in fact contributed quite some open source code. The Darwin kernel based on FreeBSD, Webkit which is a open source browser engine and CUPS web utility to name a few are some of the projects Apple has released under GPL. The CUPS web utility is one project that many Linux users simply can't live without. Based on the Internet Printing Protocol (IIP), CUPS has become a standard printing service in many Linux distros, especially the ones that are based no Debian. Many Debian-based distributions like Ubuntu, Linux Mint, Elementary OS, etc are now bundled with the Common Unix Printing System. It was originally developed for Mac OS X and since it was made open source is now used by UNIX like operating systems.

If ou are using a Linux computer and wish to print from it, you should make use of CUPS to configure your printer. Let us take a look at how you can connect a printer with this print server.

  • 1. Most of the popular Linux operating system are pre-loaded with CUPS. To check if your Linux box has CUPS, open up a browser and load the following address, http://localhost:631/

CUPS

img: https://db.tt/BG4yWNPY

If you get a page that looks something like in the image above, congratulations, you already have CUPS in your system. If you get an error, you should probably install it. For Ubuntu and and its derivative, you can use the following code to install it.

sudo apt-get update

sudo apt-get install cups

You should also check if all the CUPS dependensies are also installed and check its status.

dpkg -l cups

service cups status

  • 2. Once you have CUPS installed, visit the address mentioned above from your favorite web browser. Under administrator click on Add Printers and Classes. In the next page click on Add printers and you will have a page that looks like this. You might be asked to enter your username and password to security reasons.

add printer

Image source: https://db.tt/VnVXRJy0

Choose “Internet Printing Protocol (https)” or “HP Printer (HPLIP)” if you have an HP machine. You can also use the https method to install your HP Printer.

  • 3. In the next page you will be required to add an IP address. This is the IP address of your printer. The IP of your printer could be easily found out using the following terminal commands.

ifconfig

iwconfig

If the printer is connected to a server the IP address of the server is going to the the IP of the printer, as well. It could look something like this, socket://10.34.23.21, along with the port number if need be.

  • 4. You will now be asked for a Name, Description and Location of the printer. You can enter whatever you want in this these fields and also choose sharing option.

Add printer

Img: https://db.tt/q0f9Ve0n

  • 5. In the next page, you will be able to choose your printer using the Make and Model name. If you don't find your model in the printer, you can use your PPD file to configure the machine. Most of the PPD files could be downloaded from the printer manufacturers support website, a simple Google search will help you find the necessary PPDs. Once you have downloaded the PPD, you can browse to the folder using the CUPS interface and add the printer.
  • 6. Once the printer has been added, you can find your printer in the CUPS home page, using the following address http://localhost:631/

The machine is now ready for printing. You can now configure it, and queue jobs. Using the above steps, you will be able to add multiple printers to your Linux machine.

With the help of CUPS, installing a printer in a Linux machine is not as intimidating as it used to be in the old days even though you might have to use the terminal a couple of times. However on the downside, it might be impossible for you to find the ink level in your printer directly from the machine, like how you could do it with proprietary software provided by the manufacturer for Windows. So the next time you are buying printer ink, make sure you buy more supplies from Ink Station and Amazon for backup.

 
Page 2 of 138

Upcoming Linux Foundation Courses

  1. LFD320 Linux Kernel Internals and Debugging
    04 Aug » 08 Aug - Virtual
    Details
  2. LFD405 Embedded Linux Development with Yocto Project
    04 Aug » 07 Aug - Santa Clara, CA
    Details
  3. LFD312 Developing Applications For Linux
    18 Aug » 22 Aug - Virtual
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board