CentOS 6.x 快速安装L2TP ***
一、簡介
? ? L2TP是一種工業(yè)標(biāo)準(zhǔn)的Internet隧道協(xié)議,功能大致和PPTP協(xié)議類似,比如同樣可以對網(wǎng)絡(luò)數(shù)據(jù)流進(jìn)行加密。不過也有不同之處,比如PPTP要求網(wǎng)絡(luò)為IP網(wǎng)絡(luò),L2TP要求面向數(shù)據(jù)包的點(diǎn)對點(diǎn)連接;PPTP使用單一隧道,L2TP使用多隧道;L2TP提供包頭壓縮、隧道驗證,而PPTP不支持。
? ? L2TP 是一個數(shù)據(jù)鏈路層協(xié)議。其報文分為數(shù)據(jù)消息和控制消息兩類。數(shù)據(jù)消息用投遞 PPP 幀,該幀作為L2TP報文的數(shù)據(jù)區(qū)。L2TP不保證數(shù)據(jù)消息的可靠投遞,若數(shù)據(jù)報文丟失,不予重傳,不支持對數(shù)據(jù)消息的流量控制和擁塞控制。控制消息用以建立、維護(hù)和終止控制連接及會話,L2TP確保其可靠投遞,并支持對控制消息的流量控制和擁塞控制。
二、L2TP與PPTP的不同
? ? PPTP和L2TP都使用PPP協(xié)議對數(shù)據(jù)進(jìn)行封裝,然后添加附加包頭用于數(shù)據(jù)在互聯(lián)網(wǎng)絡(luò)上的傳輸。盡管兩個協(xié)議非常相似,但是仍存在以下幾方面的不同:
PPTP要求互聯(lián)網(wǎng)絡(luò)為IP網(wǎng)絡(luò)。L2TP只要求隧道媒介提供面向數(shù)據(jù)包的點(diǎn)對點(diǎn)的連接。L2TP可以在IP(使用UDP),幀中繼永久虛擬電路(PVCs),X.25虛擬電路(VCs)或ATM VCs網(wǎng)絡(luò)上使用。
PPTP只能在兩端點(diǎn)間建立單一隧道。L2TP支持在兩端點(diǎn)間使用多隧道。使用L2TP,用戶可以針對不同的服務(wù)質(zhì)量創(chuàng)建不同的隧道。
L2TP可以提供包頭壓縮。當(dāng)壓縮包頭時,系統(tǒng)開銷(overhead)占用4個字節(jié),而PPTP協(xié)議下要占用6個字節(jié)。
L2TP可以提供隧道驗證,而PPTP則不支持隧道驗證。但是當(dāng)L2TP或PPTP與IPSEC共同使用時,可以由IPSEC提供隧道驗證,不需要在第2層協(xié)議上驗證隧道
L2TP訪問集中器(L2TP Access Concentrator,LAC)是一種附屬在網(wǎng)絡(luò)上的具有PPP端系統(tǒng)和L2Tpv2協(xié)議處理能力的設(shè)備,它一般就是一個網(wǎng)絡(luò)接入服務(wù)器軟件,在遠(yuǎn)程客戶端完成網(wǎng)絡(luò)接入服務(wù)的功能。
L2TP網(wǎng)絡(luò)服務(wù)器(L2TP Network Server,LNS)是用于處理L2TP協(xié)議服務(wù)器端的軟件。
三、L2TP的安裝
1、環(huán)境準(zhǔn)備
#安裝epel源 rpm?-ivh?http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm #關(guān)閉防火墻 service?iptables?stop #關(guān)閉SELinux setenforce?0 #開啟數(shù)據(jù)包轉(zhuǎn)發(fā) sysctl?-w?net.ipv4.ip_forward=12、軟件安裝
yum?install?xl2tpd?-y四、L2TP的配置
1、配置xl2tpd.conf主配置文件
#?vim /etc/xl2tpd/xl2tpd.conf
[lns?default] ip?range?=?10.8.0.100-200????????????#***客戶的分配的IP地址 local?ip?=?10.8.0.1??????????????????#L2TP?***服務(wù)器的地址 require?chap?=?yes refuse?pap?=?yes require?authentication?=?yes name?=?L2TP***server ppp?debug?=?yes pppoptfile?=?/etc/ppp/options.xl2tpd length?bit?=?yes2、配置options.xl2tpd文件
#?vim /etc/ppp/options.xl2tpd
ipcp-accept-local ipcp-accept-remote ms-dns??114.114.114.114 #?ms-dns??192.168.1.1 #?ms-dns??192.168.1.3 #?ms-wins?192.168.1.2 #?ms-wins?192.168.1.4 noccp auth crtscts idle?1800 mtu?1410 mru?1410 nodefaultroute debug lock proxyarp connect-delay?5000 logfile?/var/log/xl2tpd.log3、配置賬號密碼
# vim /etc/ppp/chap-secrets
#?Secrets?for?authentication?using?CHAP #?client??????server????secret????IP?addresses***???????????*???????123456???????????*4、配置IP映射
iptables?-t?nat?-A?POSTROUTING?-s?10.8.0.0/24?-o?eth0?-j?MASQUERADE五、L2TP啟動
service?xl2tpd?start# netstat -antup
Active?Internet?connections?(servers?and?established) Proto?Recv-Q?Send-Q?Local?Address?????Foreign?Address?????State???PID/Program?name??? tcp????????0??????0?0.0.0.0:22????????0.0.0.0:*???????????LISTEN??????1026/sshd??????????? tcp????????0??????0?127.0.0.1:25??????0.0.0.0:*???????????LISTEN??????1114/master????????? tcp????????0?????52?192.168.1.10:22???192.168.1.36:62256??ESTABLISHED?1733/sshd??????????? udp????????0??????0?0.0.0.0:1701??????0.0.0.0:*???????????????????????2378/xl2tpd# 鏈接查看日志
# tail -f /var/log/message
Jan 17 14:25:21 node1 xl2tpd[2373]: L2TP kernel support not detected (try modprobing l2tp_ppp and pppol2tp)
Jan 17 14:25:21 node1 xl2tpd[2378]: xl2tpd version xl2tpd-1.3.6 started on node1.wzlinux.com PID:2378
Jan 17 14:25:21 node1 xl2tpd[2378]: Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.
Jan 17 14:25:21 node1 xl2tpd[2378]: Forked by Scott Balmos and David Stipp, (C) 2001
Jan 17 14:25:21 node1 xl2tpd[2378]: Inherited by Jeff McAdams, (C) 2002
Jan 17 14:25:21 node1 xl2tpd[2378]: Forked again by Xelerance (www.xelerance.com) (C) 2006
Jan 17 14:25:21 node1 xl2tpd[2378]: Listening on IP address 0.0.0.0, port 1701
Jan 17 14:27:29 node1 xl2tpd[2378]: Connection established to 192.168.1.36, 1701. ?Local: 345, Remote: 1 (ref=0/0). ?LNS session is 'default'
Jan 17 14:27:29 node1 xl2tpd[2378]: Call established with 192.168.1.36, Local: 51894, Remote: 1, Serial: 0
Jan 17 14:27:29 node1 pppd[2399]: pppd 2.4.5 started by root, uid 0
Jan 17 14:27:29 node1 pppd[2399]: Using interface ppp0
Jan 17 14:27:29 node1 pppd[2399]: Connect: ppp0 <--> /dev/pts/1
Jan 17 14:27:31 node1 pppd[2399]: Cannot determine ethernet address for proxy ARP
Jan 17 14:27:31 node1 pppd[2399]: local ?IP address 10.8.0.1
Jan 17 14:27:31 node1 pppd[2399]: remote IP address 10.8.0.100
總結(jié)
以上是生活随笔為你收集整理的CentOS 6.x 快速安装L2TP ***的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 代码审计1
- 下一篇: Ehcache BigMemory: 摆