Устанавливаем mpd5 из портов

cd /usr/ports/net/mpd5

make install clean

Включаем mpd в /etc/rc.conf

ee /etc/rc.conf

mpd_enable="YES"

ee /usr/local/etc/mpd5/mpd.conf

startup:
set user foo bar admin
set console self 127.0.0.1 5005
set console open
default:
load pptp_client
pptp_client:
create bundle static B1
set iface route default
set iface up-script /usr/local/etc/mpd5/up-script.sh
set iface down-script /usr/local/etc/mpd5/down-script.sh
set ipcp ranges 0.0.0.0/0 0.0.0.0/0
create link static L1 pptp
set link action bundle B1
set auth authname #ваш логин
set auth password #ваш пароль
set link max-redial 0
set link mtu 1460
set link keep-alive 20 75
set pptp peer 192.168.31.1 #ваш впн сервер
set pptp disable windowing
open


/usr/local/etc/mpd5/up-script.sh


#!/bin/sh

/sbin/route delete default

/sbin/route add 192.168.0.0/16 192.168.17.1 #ваш шлюз в локальную сеть 

/sbin/route add default 1.1.1.1#ваш шлюз в интернет сеть


/usr/local/etc/mpd5/down-script.sh

#!/bin/sh

/sbin/route delete default

/sbin/route delete 192.168.0.0/16 192.168.17.1 #ваш шлюз в локальную сеть  

/sbin/route add default 192.168.17.1 #ваш шлюз в локальную сеть

далее идем в

cd /usr/local/etc/mpd5

chmod 755 up-script.sh

chmod 755 down-script.sh