摘要:L2TP 提供隧道建立或封裝,以及第二層驗證。L2TP提供了一種遠程接入訪問控制的手段,其典型的應(yīng)用場景是:某公司員工通過PPP撥入公司本地的網(wǎng)絡(luò)訪問服務(wù)器(NAS),以此接入公司內(nèi)部網(wǎng)絡(luò),獲取IP地址并訪問相應(yīng)權(quán)限的網(wǎng)絡(luò)資源。該文通過分析L2TP協(xié)議,給出如何利用廣域網(wǎng)在總公司與分支機構(gòu)之間架設(shè)VPN應(yīng)用的方案。
關(guān)鍵詞:L2TP;VPN;遠程接入
中圖分類號:TP393 文獻標(biāo)識碼:A 文章編號:1009-3044(2013)12-2774-02
1 L2TP協(xié)議簡介
L2TP是IETF綜合兩種已有的隧道協(xié)議即Cisco公司的L2F協(xié)議與微軟公司的PPTP協(xié)議而提出的一項具有標(biāo)準(zhǔn)意義的隧道協(xié)議。L2TP是對PPP的一種擴展,他依靠利用PPP實現(xiàn)用戶身份驗證和傳輸數(shù)據(jù)。與PPTP不同的是,L2TP使用UDP作為控制消息與數(shù)據(jù)消息的傳輸協(xié)議。L2TP也是實現(xiàn)VPN的一種重要和有效的方法。VPN使得網(wǎng)絡(luò)用戶訪問公司內(nèi)部網(wǎng)更方便與安全,無論 撥號用戶還是其他網(wǎng)絡(luò)接入方式的用戶都可以通過VPN輕松達到這個目的。
2 構(gòu)建拓撲結(jié)構(gòu)
3 路由器RB中L2TP客戶端的配置
路由器RB充當(dāng)L2TP客戶端時,將主動發(fā)起協(xié)商與遠程L2TP服務(wù)器建立隧道。
3.1 創(chuàng)建并配置l2tp-class接口
對于L2TP客戶端而言,這項配置操作主要用來設(shè)置L2TP控制連接的相關(guān)參數(shù),是可選的。
其配置內(nèi)容如下:
1)創(chuàng)建l2tp-class接口
在RB路由器中,l2tp-class接口被主要用于設(shè)定L2TP協(xié)議的控制連接參數(shù)。創(chuàng)建l2tp-class接口,可以在全局模式下執(zhí)行命令
RB(config)#l2tp-class l2tp-class-name
2)設(shè)置L2TP控制連接的時間參數(shù)
RB(config-l2tp-class)#receive-windows size
RB(config-l2tp-class)#timeout setup seconds
3)設(shè)置L2TP控制連接驗證參數(shù)
RB(config-l2tp-class)#authentication
RB(config-l2tp-class)#no hostname
RB(config-l2tp-class)#hostname host-name
RB(config-l2tp-class)#password pass-words
3.2 創(chuàng)建并配置pseudowire-class
在RB路由器中,pseudowire-class接口被主要用于設(shè)定L2TP數(shù)據(jù)傳輸?shù)南嚓P(guān)參數(shù)。
1)創(chuàng)建pseudowire-class接口
創(chuàng)建pseudowire-class接口,可以在全局模式下執(zhí)行命令:
RB(config)#pseudowire-class pseudowire-class-name
2)設(shè)置L2TP數(shù)據(jù)傳輸封裝模式
RB(config-pw-class)#encapsulation l2tpv2
3)設(shè)置L2TP數(shù)據(jù)傳輸IP參數(shù)
RB(config-pw-class)#ip dfbit set
RB(config-pw-class)#ip ttl ttl-value
RB(config-pw-class)#ip local interface interface-name
3.3 創(chuàng)建并配置virtual-ppp接口
virtual-ppp接口是L2TP客戶端負責(zé)與L2TP服務(wù)器端建立L2TP會話的接口,對于L2TP客戶端而言,這項配置是必須的,它將創(chuàng)建一個指定的L2TP會話。
1)設(shè)置virtual-ppp接口
創(chuàng)建virtual-ppp接口,可以在全局模式下執(zhí)行命令:
RB(config)#interface virtual-ppp number
2)設(shè)置pseudowire規(guī)則
在virtual-ppp接口上設(shè)置建立L2TP會話的pseudowire規(guī)則,可以執(zhí)行命令:
RB(config-if)# pseudowire peer-ip-address vcid {encapsulation l2tpv2}
3)設(shè)置IP地址
RB(config-if)#ip address ip-address sub-mask
4)設(shè)置身份驗證參數(shù)
RB(config-if)#ppp pap sent-username username [password encryption-type password]
4 RA路由器中L2TP服務(wù)器端的配置
1)設(shè)置L2TP控制連接參數(shù)
RA(config-vpdn)#l2tp tunnel anthentication \\啟用通道驗證
RA(config-vpdn)# l2tp tunnel hello internal \\設(shè)置hello發(fā)送間隔
RA(config-vpdn)# l2tp tunnel password pass-word \\設(shè)置通道口令
RA(config-vpdn)# l2tp tunnel receive-windows size \\設(shè)置通道控制連接接收窗口尺寸大小
RA(config-vpdn)# l2tp tunnel retransmit {retries number | timeout {min | max} seconds} //設(shè)置通道控制消息重傳參數(shù)
RA(config-vpdn)# l2tp tunne了timeout {no-session | setup} seconds \\設(shè)置通道最大的無會話/控制連接建立時間間隔
2)設(shè)置L2TP數(shù)據(jù)傳輸參數(shù)
RA(config-vpdn)# l2tp ip udp checksum \\要求UDP校驗和非空
RA(config-vpdn)#ip tos tos-value \\設(shè)置IP TOS域
RA(config-vpdn)#ip precedence value \\設(shè)置IP Precedence域
參考文獻:
[1] 張衛(wèi),王能.計算機網(wǎng)絡(luò)工程[M].北京:清華大學(xué)出版社,2004.
[2] Nojeong Heo,Pramod K.Energy-Effieient Deployment of Intelligent Mobile Sensor Networks[J].IEEE Transactions on Systems,MAN,And Cybemetics-PartA:Systems and Humans,2008,35(1):156-162.
[3] 陶利軍.構(gòu)建虛擬專用通道——OpenVPN服務(wù)器詳解與架設(shè)指南:基于Linux[M].北京:清華大學(xué)出版社,2012.
[4] 金漢均,汪雙頂.VPN虛擬專用網(wǎng)安全實踐教程[M].北京:清華大學(xué)出版社,2011.