CentOS 6.x 快速安装L2TP ***
一、簡介
? ? L2TP是一種工業標準的Internet隧道協議,功能大致和PPTP協議類似,比如同樣可以對網絡數據流進行加密。不過也有不同之處,比如PPTP要求網絡為IP網絡,L2TP要求面向數據包的點對點連接;PPTP使用單一隧道,L2TP使用多隧道;L2TP提供包頭壓縮、隧道驗證,而PPTP不支持。
? ? L2TP 是一個數據鏈路層協議。其報文分為數據消息和控制消息兩類。數據消息用投遞 PPP 幀,該幀作為L2TP報文的數據區。L2TP不保證數據消息的可靠投遞,若數據報文丟失,不予重傳,不支持對數據消息的流量控制和擁塞控制。控制消息用以建立、維護和終止控制連接及會話,L2TP確保其可靠投遞,并支持對控制消息的流量控制和擁塞控制。
二、L2TP與PPTP的不同
? ? PPTP和L2TP都使用PPP協議對數據進行封裝,然后添加附加包頭用于數據在互聯網絡上的傳輸。盡管兩個協議非常相似,但是仍存在以下幾方面的不同:
PPTP要求互聯網絡為IP網絡。L2TP只要求隧道媒介提供面向數據包的點對點的連接。L2TP可以在IP(使用UDP),幀中繼永久虛擬電路(PVCs),X.25虛擬電路(VCs)或ATM VCs網絡上使用。
PPTP只能在兩端點間建立單一隧道。L2TP支持在兩端點間使用多隧道。使用L2TP,用戶可以針對不同的服務質量創建不同的隧道。
L2TP可以提供包頭壓縮。當壓縮包頭時,系統開銷(overhead)占用4個字節,而PPTP協議下要占用6個字節。
L2TP可以提供隧道驗證,而PPTP則不支持隧道驗證。但是當L2TP或PPTP與IPSEC共同使用時,可以由IPSEC提供隧道驗證,不需要在第2層協議上驗證隧道
L2TP訪問集中器(L2TP Access Concentrator,LAC)是一種附屬在網絡上的具有PPP端系統和L2Tpv2協議處理能力的設備,它一般就是一個網絡接入服務器軟件,在遠程客戶端完成網絡接入服務的功能。
L2TP網絡服務器(L2TP Network Server,LNS)是用于處理L2TP協議服務器端的軟件。
三、L2TP的安裝
1、環境準備
#安裝epel源 rpm?-ivh?http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm #關閉防火墻 service?iptables?stop #關閉SELinux setenforce?0 #開啟數據包轉發 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?***服務器的地址 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
總結
以上是生活随笔為你收集整理的CentOS 6.x 快速安装L2TP ***的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 代码审计1
- 下一篇: Ehcache BigMemory: 摆