歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> 關於Unix >> freebsd下pppoe的安裝

freebsd下pppoe的安裝

日期:2017/2/28 11:09:09   编辑:關於Unix


一、概述
Poptop ,官方網站上的定義是The PPTP Server for Linux,就是利用PPTP(Point to Point Tunneling Protocol,點到點隧道協議)通過Internet訪問VPN(Virtual Private Network,虛擬局域網),他允許遠程用戶安全、花費低廉地從Internet上的任何地方訪問公司內部網絡。
依據連接方式劃分,VPN能夠分為Lan to Lan模式和client to Lan模式兩種。前者能夠將兩個彼此單獨的局域網連接起來,就像同屬於一個局域網內相同,能夠利用OpenVPN來實現。而後者就該用到Poptop了。
PPTP使用了client-server模式來建立VPN連接。大多數微軟操作系統都內置了PPTP客戶端,所以就無需安裝第三方客戶端軟件,這就比其他VPN技術有了便於安裝的優勢。有關PPTP的周詳描述見RFC 2367。 在Poptop出現以前,並沒有使用PPTP客戶端連接Linux主機的方法存在。使用Poptop,Linux主機能夠立即在一個PPTP VPN環境下進行工作。
二、vpn服務器端的安裝和配置
首先確認在 Kernel 中有下列這行設定:
# 如果您使用的是 FreeBSD 4.x
pseudo-device tun # Packet tunnel.

# 如果您使用的是 FreeBSD 5.x以上版本N26Linux聯盟
device tun # Packet tunnel.

1、安裝 ppptop:
freebsd# cd /usr/ports/net/poptop
freebsd# make install clean
加入:
debug #把任何的debug信息寫入系統日志/var/log/messages
Logwtmp #使用/var/log/wtmp記錄客戶連接和斷開。
listen 218.XXX.XXX.18 //VPN服務器的外網IP
localip 172.20.1.1
remoteip 172.20.1.10-20 //定義分配給客戶端的DHCP池
pidfile /var/run/pptpd.pid
保存,退出
freebsd# cd /etc/ppp/
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 172.20.1.1 172.20.1.10-172.20.1.20 255.255.255.0
set server /tmp/loop "" 0177
loop-in:
set timeout 0
set log phase lcp ipcp command
allow mode direct
pptp:
load loop
enable chap
enable MSCHAPv2
disable deflate pred1
deny deflate pred1
set mppe 128 stateless //默認是用40位的加密,為了安全,這裡用128位的加密(在用windows創建撥號連接時,選上"安全"裡的"高級")
enable MPPE
accept MPPE
enable chap81
disable pap
enable proxy
accept dns
# DNS Servers to assign client
set dns 172.16.1.100
set device !/etc/ppp/secure
4、配置secure執行文檔:
freebsd# ee /etc/ppp/secure
加入:
#!/bin/sh
exec /usr/sbin/ppp -direct loop-in
保存退出
freebsd# chmod 755 /etc/ppp/secure
5、建立用戶:
加入:
#user #passoword
user1 password "172.20.1.16" //172.20.1.16是固定分配給user1的IP
user2 password "172.20.1.17"
保存
6. 確認IP轉發已經打開:
freebsd# sysctl net.inet.ip.forwarding
1
如果不是1,可以用下面命令手動打開:
freebsd# sysctl net.inet.ip.forwarding=1
gateway_enable="YES"
就可以隨機開啟。
7、打開 proxy arp
arpproxy_all="YES"
8、啟動PPTP:
freebsd# cd /usr/local/etc/rc.d
freebsd# cp pptpd.sh.sample pptpd.sh
freebsd# /usr/local/etc/rc.d/pptpd.sh start
9、log存放在:/var/log/ppp.log
10、默認情況下,開放四個tunl,只能同時四個用戶連接,如要讓更多的用戶連接,請按如下方法:
創建一個文件:create_tun.sh
加入:
#/bin/sh
cd /dev
/dev/MAKEDEV tun4
/dev/MAKEDEV tun5
/dev/MAKEDEV tun6
/dev/MAKEDEV tun7
/dev/MAKEDEV tun8
/dev/MAKEDEV tun9
/dev/MAKEDEV tun10
/dev/MAKEDEV tun11
/dev/MAKEDEV tun12
/dev/MAKEDEV tun13
/dev/MAKEDEV tun14
/dev/MAKEDEV tun15
/dev/MAKEDEV tun16
/dev/MAKEDEV tun17
/dev/MAKEDEV tun18
/dev/MAKEDEV tun19
/dev/MAKEDEV tun20
/dev/MAKEDEV tun21
/dev/MAKEDEV tun22
/dev/MAKEDEV tun23
/dev/MAKEDEV tun24
/dev/MAKEDEV tun25
/dev/MAKEDEV tun26
/dev/MAKEDEV tun27
/dev/MAKEDEV tun28
/dev/MAKEDEV tun29
/dev/MAKEDEV tun30
保存退出
freebsd# sh create_tun.sh
Copyright © Linux教程網 All Rights Reserved