Install mpd5 pptp server on FreeBSD 9.2 and FreeBSD10

MPD (http://mpd.sourceforge.net/) Is a netgraph(http://www.freebsd.org/cgi/man.cgi?query=netgraph&sektion=4) based implementation of the multi-link PPP protocol for FreeBSD. 
If you want know more about mpd, you may visit mpd official site. 

I will introduce you how to setup pptp server with mpd on freebsd.


Pre Requirement


  1. FreeBSD 9.2 installed
  2. KVM based vps or dedicted server with FreeBSD 9.2
  3. you may know how to login ssh to configure your vps or server box.
  4. you may know how to compile software via freebsd ports http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html
  5. you may know how to search the answer via Google (http://www.google.com)

Notify


replace your IP with 

27.12.32.17



Step


cd /usr/ports/net/mpd5make configmake install clean

2. enable boot configure at the rc.conf

add this lines append to /etc/rc.conf

mpd_enable=\"YES\"gateway_enable=\"YES\"

gateway must enable for pptp, or you may failed to surfing the web

3. check ip forwarding


sysctl -a | grep ip.forwarding


if not 1, you may set it with:

sysctl net.inet.ip.forwarding=1


4. configure the mpd

cd /usr/local/etc/mpd5
create file named mpd.conf


startup:    set user netroby password admin    set console self 127.0.0.1 5005    set console open    set web self 0.0.0.0 5006    set web opendefault:    load pptp_serverpptp_server:    set ippool add pool1 192.168.88.50 192.168.88.99    create bundle template B    set iface enable proxy-arp    set iface idle 1800    set iface enable tcpmssfix    set iface route 192.168.88.1    set ipcp yes vjcomp    set ipcp ranges 192.168.88.1/32 ippool pool1    set ipcp dns 4.2.2.1    set ipcp dns 4.2.2.2    set ipcp nbns 192.168.88.1    set bundle enable compression    set ccp yes mppc    set mppc yes e40    set mppc yes e128    set mppc yes stateless    create link template L pptp    set link fsm-timeout 5    set link action bundle B    set link enable multilink    set link yes acfcomp protocomp    set link no pap chap eap chap-msv2    set link enable chap chap-msv2 eap    set link accept chap-msv2     set link keep-alive 10 60    set link mtu 1460    set pptp self 27.12.32.17    set link enable incoming


and create file mpd.secret 


netroby \"mypassword\"

mpd.secret file contains the pptp login information. username then password

5. add logging to syslog configure

add following lines to the end of /etc/syslog.conf


!mpd*.* /var/log/mpd.log!*


if the last line !* exists, just put 


!mpd*.* /var/log/mpd.log


before 

!*

6. configure the pf configure

my /etc/pf.conf


my_int = \"vtnet0\"internal_net = \"192.168.0.0/16\"external_addr = \"27.12.32.17\"nat on $my_int from $internal_net to any -> $external_addrset skip on loblock in log allpass in on $my_int proto tcp from any to any port 1723 keep statepass in on $my_int proto tcp from any to any port 22 keep statepass in on $my_int proto tcp from any to any port 80 keep statepass in on $my_int proto tcp from any to any port 443 keep statepass in quick on $my_int proto icmp all keep statepass in proto gre all keep statepass in from any to $internal_netpass in from $internal_net to anypass out proto { gre, tcp, udp, icmp } all keep state

the pf configure may be load on boot time. it enabled in with the internal ip range 192.168.0.0/16, 

7. reboot your vps

8. using your iphone or other vpn client to connect your pptp server

As the default configure as this tutorial, the pptp user name was netroby and the password is mypassword

Update:

[20140415]

Tested on FreeBSD 10.0




分类: 默认 标签: 发布于: 2013, 点击数: