Setting up a connection to a Windows VPN from the command line

I, like many people, work at a place that uses a Microsoft-based VPN, but I want to use Linux to do it. Recently, I was trying to VPN in to work to get some, well, work done. So I retackled the whole problem again. I tried two GUI utilities to set this up. I couldn’t get K/NetworkManager to do it and I only got KVPNC to work after mucking around in some configuration files. Ultimately, after a great deal of googling and experimenting I used this sequence of steps to get up and running, all command line. In the long run, this is nicer anyway as I often like to configure these kinds of things over SSH.

Command line setup notes:

1. Make sure that pptpclient, ppp, and pptpd are all installed
2. Set the following options in /etc/ppp/options.pptp:
lock
noauth
refuse-eap
refuse-chap
refuse-mschap
nobsdcomp
nodeflate
3. Add a line of the following form to /etc/ppp/chap_secrets
DOMAIN\\USERNAME REMOTENAME password ips
where remotename is the name that you want to show up for your computer on the remote network, password is your plaintext password, and ips are the addresses (set to * on mine)
4. Chmod previous file 600
5. Create a file named after your connection in /etc/ppp/peers with the following options
remotename REMOTENAME
ipparam [the file name of the connection]
pty “pptp vpnserver –nolaunchpppd”
name DOMAIN\\USERNAME
usepeerdns
require-mppe-128
refuse-eap
noauth
file /etc/ppp/options.pptp
6. Run pon [connection name]
7. Add DNS servers to the end of /etc/resolv.conf
8. Add routes with the command:
route add -net .0 netmask 255.255.255.0 dev ppp0
9. To log off the VPN, run poff [file name of the connection]

References

http://ubuntuforums.org/showthread.php?t=91249&page=4

http://wiki.archlinux.org/index.php/Microsoft_VPN_client_setup_with_pptpclient#Configuring_and_Connecting