如何建立 FreeBSD VPN
我們使用 poptop 這個軟體來建立 PPTP 的 VPN 連線
PPTP 是 windows 所使用的 VPN,我們在 FreeBSD 上建立 VPN
之後,使用者可以自遠端使用 Windows 連到公司的內部區網
基本架構如下:
┌──────────┐
│ Windows │
│ 或 │==========================Freebsd NAT server=====公司區網
│ FreeBSD │ Internet 安裝了 poptop 192.168.1.0/24
└──────────┘ 對內 192.168.1.1
對外 61.58.73.188
1.4.x 版,先確認在 Kernel 中有下列這一行
pseudo-device tun # Packet tunnel.
2.在 FreeBDS NAT 上安裝ppptop
# cd /usr/ports/net/poptop
# make install clean
3.ee /usr/local/etc/pptpd.conf
option /etc/ppp/ppp.conf
# turn debugging on only if you need it
debug
# if you have multiple addresses and only want to "listen" on one:
##listen 208.212.80.82
localip 192.168.1.1 #NAT server 所使用的區網 IP
remoteip 192.168.1.200-223 # 要給遠端的 Ip
pidfile /var/run/pptpd.pid
4.ee /etc/ppp/ppp.conf
loop:
set timeout 0
set log phase chat connect lcp ipcp command
set device localhost:pptp
set dial
set login
# Server (local) IP address, Range for Clients, and Netmask
set ifaddr 192.168.1.129 192.168.1.130-192.168.1.139 255.255.255.255
set server /tmp/loop "" 0177
loop-in:
set timeout 0
set log phase lcp ipcp command
allow mode direct
pptp:
load loop
enable chap
disable pap
#
#Authenticate against /etc/passwd
##
enable passwdauth
enable proxy
accept dns
# DNS Servers to assign client
set dns 192.168.1.1
# NetBIOS/WINS Servers to assign client
set device !/etc/ppp/secure
5.ee /etc/ppp/secure
#!/bin/sh
exec /usr/sbin/ppp -direct loop-in
6.ee /etc/ppp/ppp.secret 來存放使用者的帳號及密碼
bill Saxophone
jimmy Peanuts
george HorseShoes
7.啟動
# /usr/local/etc/rc.d/pptpd.sh start
8.windows 的設定
建立一個新的 VPN 連線後
[內容]-[安全性]->要求資料加密 的選項不要打勾