Accessing the Stevens Campus Network
over VPN with Linux
Please note that these instructions are now outdated. Stevens has upgraded to a VPN system based around Cisco technologies. The page remains here for reference purposes and as possible help for others connecting to Microsoft-based VPN solutions from Linux machines.
Stevens Campus IT provides access to the campus network exclusively via VPN. While many would like ssh access, the powers that be refuse. Unfortunately, they've failed to provide decent instructions for accessing the campus network from a computer running Linux. What little there is exists here (outdated, distro specific, and sans encryption). Windows documentation has been updated for the new VPN (with encryption) and is available here [PDF].
In the process of trying to gain reliable access to the campus network, I ran into a number of problems due to the configuration of the VPN server. After reaching out to Campus IT and failing to receive meaningful, timely responses, I worked things out on my own. Due to their indifference, I have chosen to document the proper setup here rather than offer Campus IT a How-To which they could distribute.
Basic requirements
To get started you'll need a few different things for compatibility with Stevens' VPN server.
- If your kernel version is below 2.6.15, upgrade it or patch it to add MPPE support.
- If your kernel version is >= 2.6.15 check for MPPE
support:
$ grep -e 'MPPE' /boot/config CONFIG_PPP_MPPE=mYou should see either an 'm' or a 'y'.
- Install the PPTP client, preferably from your Linux distribution. If you need/want the source, the project is hosted at: http://pptpclient.sf.net/.
- A version of pppd newer than v2.4.2.
Configuration files
Once you have all of these setup. You'll need to edit a few files. For starters you'll need a /etc/ppp/chap-secrets containing the following line:
In addition, you'll need to make sure the file /etc/ppp/options.pptp contains the following lines, and that they are uncommented:
Finally, you'll need a file in the /etc/ppp/peers/ directory whose name will be the name of the connection as far as pppd is concerned. For our purposes, we'll use stevensvpn. If you choose to use a different filename, be sure to make the appropriate changes in the scripts below. The file should contain the following:
Test your work
At this point, you're ready to test the connection. Running the following as root will allow you to see if the connection succeeds.
- First, recheck all your configuration files. Also, make sure you have the correct password. Remember, your campus domain password is not necessarily the same as your Pipeline password unless you've set them that way.
- Second, your firewall/router/NAT may be messing up the connection. Make sure that it is configured to allow "established" connections over IP as well as TCP. This is required for the eGRE packets. Additionally, since eGRE doesn't have TCP's connection tear-down to inform the NAT tables that the connection is no longer in use, attempts to connect from different machines behind the NAT, within a short time period will fail due to the NAT continuing to send eGRE packets to the first machine.
Working around the Stevens misconfiguration
Now comes the fun part of this whole exercise. Up until now, the configuration has been fairly standard for a connection to a VPN that authenticates against a Microsoft Domain Controller. The problem is that when pptpclient establishes the connection, it doesn't receive a proper address for the other end of the tunnel. By default it sets up the interface (typically ppp0) as point-to-point between the 155.246.152.xxx client address you received, and the 155.246.151.11 server address. This causes all traffic destined for the VPN server, including the packets that are supposed to tunnel the VPN traffic, to be sent over the VPN interface. This creates a nasty little routing loop that spikes CPU usage to 100%.
Luckily the solution to this is quite simple (once you know the correct configuration). The loop route must be removed, and a route to the desired portion of the campus network must be setup using your client address as the gateway and the VPN interface as the device. For example:
Putting it all together
It is my philosophy that since computers are primarily designed for programmatically repeating tasks, I should never have to do more than issue a single command for anything I will do more than once. As such, I've whipped up a small shell script to handle connecting to the Stevens VPN. Hopefully you'll get some mileage out of it too.
stevensvpn.sh (download)Additional notes
While quickly connecting to the Stevens VPN is relatively easy if you need access intermittently, for those who need more regular access or concurrent access from multiple machines on the same LAN, it can be very helpful to setup your firewall/router/NAT box to connect to the VPN and masquerade all LAN traffic destined for the campus network to the VPN.
There are a few small sticking points which I'll point out here. First, you will need to determine which traffic to NAT over the VPN interface. To make all campus connections over the VPN you would instruct iptables with the following command:
Additionally, due to the many networks that are being traversed, packet size can become a problem since the MTU/MRUs for the different networks are only slightly different. As of June 2008, these problems will crash the pptpclient daemon. To ensure this doesn't happen we have to use the NAT box to regulate MTU/MRU negotiation. The details are beyond the scope of this page. All you need to know is that with iptables, this can be setup with the following:
Don't forget to protect yourself from the wild and wooly world on the other side of the VPN connection. Something like this should be suitable.
NOTE: I am unaware of any Campus IT policy forbidding someone from maintaining a more or less persistent VPN connection. That said, the above technique is to be used at your own risk.