Tuesday, February 22, 2011

Setting up a VPN-client in FreeBSD

A few days ago I posted about using VPN to get country-restricted webpages in your country.
For this, you need to set up a VPN-pptp client in your OS. To do this in OS X or in Ubuntu is a piece of cake as it's GUI-driven in both OSes.
However, to set this up in FreeBSD is considerably more challenging.
So much so, in fact, that up to now, I haven't managed it at all.
As usual when this happens, I post to a forum and here's the thread I created which contains a lot of the detail on my progress, or lack of it, up to now.
I had initially followed this very old guide which advocates the pptpclient which is available at /usr/ports/net/
What I kept in mind was that to get the clients working in either OS X or Ubuntu, only three parameters needed to be specified. These were the username and password that the VPN server guys sent me by email as well as the server adress (either hostname or IP address).
Therefore, I could not see why anyfurther infomation would need to be entered in the /etc/ppp/ppp.conf file which is how you tell the /usr/local/sbin/pptp app what you want it to do.
Well, in short I didn't get it to work, BUT, I did manage to get a tun0 (pptp tunnel) connection to show up in "ifconfig" by using the following ppp.conf and command:

LABEL:
set authname MyLogin
set authkey MyPassword
set timeout 0
set ifaddr ***.***.***.*** ##this is the IP address of the VPN server
add 192.168.0.1/24 HISADDR ##these internal IPs showed up in Ubuntu when VPN connected
alias enable yes

The command were either
/usr/local/sbin/pptp LABEL

or
/usr/local/sbin/pptp ***.***.***.*** LABEL

where the asterisks represent the same IP as shown in the ppp.conf file.
Nevertheless, despite the new tun0 connection, "netstat -rn" showed no change in routing tables. In other words, no VPN connection was made.
Now, if I opened the network manager with "#network-admin", I could see the point-to-point connection indicated alongside the Wired connection which works perfectly.
However, both were indicated to be "not configured". Yes, even the Wired connection which works fine.
Another problem was that, even though the pptp command generated the tun0 connection, the pptp program stopped in less than 2-3 minutes.
The mpd5 program, which is also available in ports at /net/mpd5, seemed easier to set up in that I could eventually get a conf file (usr/local/etc/mpd5/mpd.conf) that caused /usr/local/sbin/mpd5 to run without errors and without stopping (as pptp did). Unfortunately, it didn't actually do anything, not even create a non-functional tun0 connection.
More details are available in my latest post to the forum thread I linked to above.
This is an ongoing saga and more will undoubtedly appear.

No comments:

Post a Comment