Connect to Windows VPN server (PPTP) with Ubuntu Gutsy

Date November 28, 2007

UPDATE - for VPN on Hardy Heron, see my new post here

Ubuntu makes it simple to connect to a Microsoft Windows VPN server at your workplace with NetworkManager and the pptp plugin. Luckily for us Ubuntu users, the right tools are just a couple of clicks or commands away. The first step is to install the network-manager-pptp package. I’ve broken this down into two sections: GUI and CLI installation methods, and Configuration.

Install PPTP with GUI (requires reboot)

Go to the Applications menu, then select Add/Remove… and enter pptp in the search bar.

Add/Remove Programs - pptp plugin

There it is! Add a checkmark, and hit apply changes. Once the install has completed, reboot your machine and move on to the configuration portion of this guide.

Install PPTP CLI (no reboot required)>

Execute the following commands to:

  • install network-manager-pptp
  • restart NetworkManager daemon
  • restart nm-applet and begin configuring


sudo apt-get install network-manager-pptp
killall nm-applet
sudo /etc/init.d/dbus restart
nm-applet --sm-disable &

Configure Your VPN

After rebooting or restarting NetworkManager and nm-applet, a single click on the nm-applet should reveal a new option, VPN Connections.

New VPN Connections Option

Follow the menu, and select Configure VPN then Add a new connection.

Click Forward to begin the configuration. Go ahead and name your connection, then enter the IP address or DNS hostname of the VPN gateway under the Connection tab.

Next, move to the Authentication tab and activate Refuse CHAP.

At this point, the basic configuration is complete. I like to add one more step, however, to ensure that not all of my traffic is routed over the VPN. This can be detrimental for performance. If you’d rather limit your VPN traffic to a specific subnet, go ahead and execute the following:

Under the Routing tab, disable Peer DNS through tunnel (if desired) and enable the option to only use VPN connection for these addresses and enter your network subnet. If the machines on your network use addresses like 192.168.100.X, use something like the following:

Subnetting

192.168.100.0/24

That’s it! You’re done. To connect to the VPN, click the NetworkManager applet, and follow the menus to your newly configured connection. Enter your username, password, and domain, and you should be in business.

Leave comments below if the procedure was any different for you. I’ve tested this on Ubuntu Gutsy 7.10 32 bit and 64 bit.

51 Responses to “Connect to Windows VPN server (PPTP) with Ubuntu Gutsy”

  1. Demiare said:

    Thank you for good manual for beginners! It really works=)

  2. Tmanisaur said:

    In the very last step, you indicate ” Enter your username, password, and domain, and you should be in business.”

    I do not see any where (in config or login) to enter Domain information.

    Can you help?

    Cheers,
    T,

  3. alonushhh said:

    I think you want to try

    DOMAIN/username

  4. Seth Ladd said:

    I only see “Manual Configuration” when I click on my network manager applet. I have definitely installed the vpn and pptp components, and have rebooted my machine. Can you think of a reason why I don’t see any VPN configuration options when I click network manager applet? Thanks!

  5. mshade said:

    Seth, if you’re on Kubuntu, you’ll need to install the gnome-network-manager package as well, otherwise I think you get symptoms like you describe. Are you Kubuntu or Ubuntu?

  6. Cecco said:

    Seth, I have read around that there is a bug filed out about network-manager-pptp… It’s only show out if you have at least one interface in dhcp… I can’t check out because i can’t set my interface to dhcp… So i use “pon” from command line

  7. Toppie said:

    Running Gutsy right here… VPN connection is a piece of cake with network-manager..
    ubuntu makes Toppie very happy ;)

  8. Charlie Kang said:

    To add to Cecco
    Just make sure to enable roaming mode.
    I had mine set to DHCP manually and it didnt show until I changed it to roaming mode

  9. Charlotte said:

    Wow, that was so easy! Thanks for writing some instructions for beginners like me!

  10. Martin said:

    Great tutorial! I got connected!

    Just one question. I also want to use vpn just for 1 ip adress. So i disabled dns through peer and enabled only use VPN connection for these addresses. But how do i know the number behind the /

    i got 10.128.4.1/????

    Thanks

  11. mshade said:

    Martin,

    If you’re specifying a single IP address, you can leave off the /24 (or /xx) as it only denotes a subnet.

    A single IP does not require a specified subnet, since you’re not specifying a range of IPs, just one machine. Cool?

    – Mike

  12. Martin said:

    sorry not cool :)

    when i leave out the /xx my apply button gets disabled :-(

  13. mshade said:

    Ah, no good! Looks like you can only specify a subnet. Better hope it’s a different private subnet than your own ;)
    In your case, Martin, I’d use 10.128.4.0/24 as well.

  14. Joachim Durchholz said:

    Martin, try 10.128.4.1/32

  15. Sujith said:

    Hi,

    Thanks for the great tutorial some one like me who has used Ubuntu for few days.

    I followed this exact steps in “Create VPN Connection” and finally how do you save the settings??, because I only got “Cancel” and “Back” buttons enabled.

    I have Gusty.

    Thanks,

    Sujith

  16. Sujith said:

    Hi,

    Thought more information on this is helpful for me to get a reply.

    When I enable the option to only use VPN connection for these addresses, is when the Apply button disables itself. When I uncheck that, the Apply button enables.

    I am confused, but hope someone will help me to get over this.

    Thanks,

    Sujith

  17. C,Ho said:

    Hi Sujith,

    This is because you haven’t give up a ip-range, thus like this 192.12.10.0/24 or this 10.32.29.3/32 for one ip.

    BTW I do have a new question for the group. Is it possible to make a second VPN connection at the same time in NM-Applet? Is there any workaround for this?

    Cheers,

    Chi

  18. Ben Hamilton said:

    Ta for the heads up - this is making the switch to Ubuntu MUCH easier as I am still needing to connect to Windows networks in order to support them.

  19. Ubuntu VPN goodness — ben.hamilton.id.au said:

    [...] short set of instructions over at tipotheday were [...]

  20. toppie said:

    although PPTP vpn works great, I have problems with the openVPN… (wich connects but dont seem to have a DNS connection)

    does this sound familiar to some?

  21. kurniawano said:

    Hi,
    I am using Kubunt 7.10, I followed the instruction given. But I encounter this error message:
    “could not start the VPN connection due to a connection error.”

    However, I can connect using my windows OS.

    I am not sure where to log the error. Please advise. Thanks :)

  22. dogbrown said:

    is there a way to check the status of the vpn-connection?

    I choose my vpn connection in the nm-applet, then I enter username and password but then nothing happens.

    I’m sure my settings aren’t right but anyway, can’t I check status of my connection somehow?

  23. Ben said:

    I need to be sudo to get my openvpn connection to work. nm-applet does not ask me for my sudo password. Thoughts?

  24. lambomania said:

    Yes, how DO we check on the status of the vpn connection? I have configured two different connections, both are PTPVPN but I don’t think they work. How do I know if I am connected, and if the connection is rejected, is there any reason provided?

  25. toppie said:

    I use wireless, and when I am connected, I see an small lock combined with the signal strenght (NM-applet)
    When rejected, I get an error message

  26. Ethan said:

    Will this direct all internet traffic through the VPN? My ISP throttles bittorrent traffic, so I need to be able to allow BItTorrent to work through this VPN. IS there any special configuration that I would need, or should this do it all for me?

    Thanks. I know this isn’t a forum, but if anyone has any ideas, I will really appreciate it.

    -Ethan

  27. Ethan said:

    You can disregard my previous post.
    I set up the VPN, and as a result my bittorrent speeds went from a maximum of 22 Kb/s (though averaging around 4 Kb/s, and often going down to 0) to a maximum around 200 Kb/s, averaging 80-100.
    So I think I answered my own question.

  28. Ashish said:

    Thanks! This really works!

    I want to set up a script which will connect to VPN automatically, sync some files and disconnect after that. Do you know the command to connect to VPN using commandline. I tried using the following command but it doesnt seem to work.
    nm-ppp-auth-dialog -s org.freedesktop.NetworkManager.ppp_starter -n
    I think I’m missing a variable needed to disable CHAP.

    -Ashish

  29. Jorj Pimm said:

    Thanks so much… I’ve tried several configurations and tutorials to get this to work… I’ve always fallen down somewhere around the connection… This connected first time… with no restarts.

    Perfect.

    - Jorj

  30. Chris said:

    Nice guide. Super simple, too, once you know what you are doing with the ubuntu tools. It Just Works (for me).

  31. tweedicus said:

    I’ve been trying to get Ubuntu to work on the University of Exeter VPN for months now, and they don’t provide support for Linux. Racked my brains, read tutorials tried a whole lot of stuff. It was all solved in an instant with once sentence you wrote:

    Next, move to the Authentication tab and activate Refuse CHAP

    Ticked the box and I’m surfing as University of Exeter.

    Thank you very much.

    And this is all on the Hardy 8.04 beta.

  32. mshade said:

    Tweedicus — glad to have helped :)

  33. Steve said:

    I am trying to get VPN working on Ubuntu 7.10. I installed network-manager-pptp package, and rebooted, but don’t get a VPN option when I open network setting. I only get the wired and modem connection options. Ideas??/

    Steve

  34. Rob said:

    thanks so much. i was at the point where i had everthing setup and could connect by routing was messed up so couldn’t browse the net via local gateway while connected to the VPN… i messed around with everything and finally followed this to enter “only use VPN Connection for these addresses” i had tried this and thought it was bugged… i was missing the /xx!

    after even trying to manually configer and connect/disconnect and spending hours using PPTP ….i’m very happy to finally have it working. thanks :)

  35. Golan said:

    Thanks. Worked liked a charm for me, but for all people facing this problem:

    “could not start the VPN connection due to a connection error.”

    I unchecked all the options under “Authentication” tab, and only then I was able to connect.

  36. Connect to Windows VPN Server (pptp) with Ubuntu Hardy Heron | Tip o’ the Day said:

    [...] Ubuntu Hardy Heron came out last week, and I thought I’d take a moment to do a new post about connecting to a workplace VPN that uses Windows Server’s built in PPTP ability.  Not a lot has changed, so you can also refer to the older article here. [...]

  37. Lexa said:

    I have same problem as Steve and Seth Ladd. No VPN connection option appears, only
    “Manual configuration”…

  38. Steve said:

    Installed ok, rebooted, created work VPN, selected, entered domain/username and password, click OK .. nothing, have tried checking/unchecking authentication options all do the same .. nothing. where can i check for error logs on this ?

  39. vayu said:

    I have same problem as Steve: I installed network-manager-pptp package, and restarted dbus, but don’t get a VPN option when I open network setting. I only get the wired and modem connection options.
    Single click on nm-applet doesn’t reveal VPN…
    Ubuntu 8.04, Xubuntu 8.04.

  40. gare said:

    I have same problem as others: don’t get a VPN option when I open network setting.

    I am using a static IP on my wired (so not using roaming mode).

    … ?

    (Thanks for writing this tutorial, btw.)

  41. gare said:

    roaming mode / static IP bug here:

    https://bugs.launchpad.net/ubuntu/+source/network-manager-applet/+bug/145107

  42. Shane said:

    This all went well, however if I am using a 3g card with the vodafone drivers - the new VPN config that is created is greyed out and not available fot select - If I am on a wired/wireless network, it can be selected - is this because the 3g card is seen as a modem and how do I change it?

  43. Prakash said:

    I have installed and configured. I am able to connect to PPTP, but it is very very slow. If I connect to the same PPTP server from Microsoft Windows, then it works well and I am able to work on the connection. While connected from ubuntu, it is really slow.

    Any idea what is wrong? I am using 8.04 ubuntu

  44. Stephen Carpenter said:

    I’ve been having no end of difficulty trying to get this to work on a variety of distros. Currently am using 8.04.1 LiveCD - and while i am able to configure through the network-manager, I don’t believe that it is truly connecting. If I go ->Network Manager Applet->VPN Connections configureVPN is enabled but Disconnect is greyed out. No option appears available to start (or attempt to start) the connect.

    eh, help?

  45. Haru said:

    Hey,
    I got my vpn-connection running. But when I connect it only asks me to type in my username and pwd.
    Where can I actually get acces to the drive I want to go to?
    I am very confused about this.

    *hoping for help

  46. Craig’s News/Blog » Blog Archive » VPN Client in Ubuntu 8.04 said:

    [...] http://tipotheday.com/2007/11/28/connect-to-windows-vpn-server-pptp-with-ubuntu-gutsy/ [...]

  47. Abhishek said:

    I need to connect to my company’s vpn.
    I have a pfx file for authentication. How do i connect to vpn using this pfx file?
    any pointers would be appreciated..
    TIA….

  48. 3rB3r said:

    Hey All
    I ‘m Beginner Ubuntu User , And I Want Run My VPN Connection ! I Make It But When I Start It ! OS Throws This Error : VPN Connect Failure,Could not start the VPN connection ‘Ubuntu VPN’ due to a connection error.

    I Have A DSL Modem And In Windows OS My IP Is 192.168.1.100 And My Default Gateway Is 192.168.1.254 And DNS Is 85.15.1.10 And 85.15.1.12. So How Can I Fix My Problem In Ubuntu VPN Connection ! What Insert Into Under Connection Tab / Gateway And What Insert Into Under Routing Tab / Only Use VPN …

    Please Help Me ! My VPN IP Is : 88.XXX.XXX.XXX

    Please Help Me ! Please …

    With Best Regards, 3rB3r

  49. pptp with NetworkManager « Søren Juul said:

    [...] to get a pptp to a VPN server running Microsoft Windows 2003 R2 i finaly found a solution. This article made me aware of a Network Manager pptp plugin, but it seems to have been changed a grate deal [...]

  50. ton said:

    I have the same problem that Tmanisaur said.

    The option Network-applet->VPN Connections->MyVPNName is disabled, and I can not see any option to inform my login DOMAIN\username and password of VPN.

    I already restarted my network with
    sudo /etc/init.d/networking restart

    Can anyone try to help me ?

  51. accigeree said:

    emm… strange..

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>