As a newbie, after spending a few hours trying to figure out what it takes to connect to a Microsoft PPTP VPN server from FreeBSD, sharing this small piece of knowledge:
Step #1: Install mpd5(8).
Step #2: Create /usr/local/etc/mpd5/mpd.conf (you can base it upon the .sample that is in the same folder after installation)
(Change strings in caps.)
Note I use iface up-script and down-script to set routing tables. My scripts below emulate Windows/OSX behavior, making the newly established VPN tunnel to be the default gateway when it's up. The down-script restores the original default gateway.
Step #3: Create the up- and down-scripts. I store them in my home.
vpn.up to set VPN tunnel as the default route, and also make sure the WAN route is preserved for the VPN server:
vpn.down to restore WAN as the default route:
Step #4: Run mpd5(8) and the VPN tunnel should appear as ng0.
Step #1: Install mpd5(8).
Step #2: Create /usr/local/etc/mpd5/mpd.conf (you can base it upon the .sample that is in the same folder after installation)
Code:
startup:
set user LOGIN PASSWORD admin
set console self 127.0.0.1 5005
set console open
set web self 0.0.0.0 5006
set web open
default:
load pptp_client
pptp_client:
create bundle static B1
set ipcp ranges 0.0.0.0/0 0.0.0.0/0
set iface up-script /home/blackhaz/vpn.up
set iface down-script /home/blackhaz/vpn.down
set bundle enable compression
set ccp yes mppc
set mppc accept compress
set mppc yes e40 e56 e128
set mppc yes stateless
create link static L1 pptp
set link action bundle B1
set link accept chap
set auth authname "VPNLOGIN"
set auth password VPNPASSWORD
set pptp peer VPNSERVER
set pptp disable windowing
set link mtu 1460
open
(Change strings in caps.)
Note I use iface up-script and down-script to set routing tables. My scripts below emulate Windows/OSX behavior, making the newly established VPN tunnel to be the default gateway when it's up. The down-script restores the original default gateway.
Step #3: Create the up- and down-scripts. I store them in my home.
vpn.up to set VPN tunnel as the default route, and also make sure the WAN route is preserved for the VPN server:
Code:
#!/bin/sh
wanip=`route -n get default | sed -rn 's/gateway: (.*)/\1/p'`
echo $wanip > /home/blackhaz/.defaultgateway
localip=`echo $3 | sed -rn 's/(.*).../\1/p'`
route delete default
route delete $4
route add $4 $wanip
route add default $localip
vpn.down to restore WAN as the default route:
Code:
#!/bin/sh
wanip=`cat /home/blackhaz/.defaultgateway`
route delete $4
route delete default
route add default $wanip
rm /home/blackhaz/.defaultgateway
Step #4: Run mpd5(8) and the VPN tunnel should appear as ng0.