A-A+

神州数码路由器上的l2tp实验

2015年11月26日 站长资讯 暂无评论

学生按照神码的配置手册和实验项目手册做l2tp,结果又么有成。还是信任自己,不信任神码手册,继续总结。

一、什么是l2tp

l2tp(Layer 2 Tunneling Protocol第二层隧道协议)

L2TP是一种虚拟专用网络协议,已成为IETF有关二层隧道协议的工业标准。L2TP将PPP(Point-to-Point Protocol)帧封装后,L2TP使用的是UDP封装,端口号1701,可通过IP,X.25,帧中继或ATM等网络进行传送。该协议是一种工业标准的Internet隧道协议,功能大致和PPTP协议类似,比如同样可以对网络数据流进行加密。不过也有不同之处,比如PPTP要求网络为IP网络,L2TP要求面向数据包的点对点连接;PPTP使用单一隧道,L2TP使用多隧道;L2TP提供包头压缩、隧道验证,而PPTP不支持。

二、l2tp的一些名词解释

LAC(L2TP Access Concentrator),L2TP访问集中器:LAC作为L2TP隧道的一侧端点,是LNS的对端设备。LAC在LNS和远端系统之间传递信息包,将从远端系统收到的信息包按照L2TP协议进行封装并送往LNS,将从LNS收到的信息包进行解封装并送往远端系统。

LNS(L2TP Network Server),L2TP网络服务器:LNS作为L2TP隧道的另一侧端点,是LAC的对端设备,是被LAC进行隧道传输的PPP会话的逻辑终止端点。

PPP(Point-to-Point Protocol),点对点协议:PPP协议是为在两点之间传输数据包的简单链路设计的,这些链路提供全双工的同时双向操作,而且按顺序传送数据包。

Peer,对端设备:在L2TP协议中,对端设备指LAC或LNS中的任意一个。LAC的对端设备是LNS,反之亦然。

Tunnel,隧道:L2TP隧道(Tunnel)建立在LAC和LNS之间,由一个控制连接和n个(n≥0)个会话(Session)组成。控制消息和PPP数据包都在隧道上传输。

Session,会话:会话是建立于LAC和LNS之间的逻辑连接,它必须在隧道建立成功之后(包括身份保护、L2TP版本、帧类型、硬件传输类型等信息的交换)进行。每个会话连接对应于LAC和LNS之间的一个PPP数据流。

虚端口:用户配置完一条L2TP隧道的相关参数后,系统自动生成一个虚端口用来传输数据,该虚端口只能由该用户使用,其他用户不能使用。

监听:虚端口的一种工作状态,在该状态下,LAC和LNS之间并未建立真正的隧道,虚端口一直监听是否有用户的数据包需要传送。

UP:隧道处于连接状态时,路由状态为UP状态,表示该路由正在被使用。

DOWN:隧道处于未连接状态时,路由状态为DOWN状态,表示该路由未被使用。

MTU(Maximum Transmission Unit),最大发送单元:物理端口可以发送的最大数据包长度。

MRU(Maximum Receive Unit),最大接收单元:物理端口可以接收的最大数据包长度。

PAP(Password Authentication Protocol),口令验证协议:PPP协议中对通信双方身份认证的安全性协议之一,是一种简单的明文验证协议。PAP认证仅在PPP连接建立时进行。

CHAP(Challenge Handshake Authentication Protocol),质询握手验证协议:PPP协议中对通信双方身份认证的安全性协议之一,是一种加密的验证方式,能够避免建立连接时传送用户的真实密码。CHAP认证可以在整个通信过程中进行。

MS-CHAP(Microsoft- Challenge Handshake Authentication Protocol),微软质询握手验证协议:PPP协议中对通信双方身份认证的安全性协议之一,与CHAP类似,它也是一种加密的验证方式,能够避免建立连接时传送用户的真实密码。MS-CHAP使用基于MPPE(微软点对点加密协议)的数据加密。

Fragment,分段:是指在源主机或路由器处,将一个数据包分割成多个数据包的一种过程。经过分段后,每个包都单独传送,并在目的地(目标主机)处重组。

Reassemble,重组:在数据目的地(目标主机)把所有分段重新组合起来的过程。

MD5(Message Digest 5),消息摘要版本5:从任意长度信息和16 字节密钥生成128 位散列(也称作数字签名或信息整理)的算法。所生成的散列(如同输入的指印)用于验证内容和来源的真实性和完整性。

AAA(Authentication Authorization Accounting),认证授权和记帐:AAA提供了一个用来对认证、授权和记帐这三种安全功能进行配置的一致性框架。

RADIUS(Remote Access Dial-In User Service),远程访问拨号用户服务:RADIUS是一个远程访问协议,它通过Internet传送认证、授权和记帐信息到远程用户的主网络中。

三、具体实验

实验环境中,有两台路由器,R1模拟LAC,R2模拟LNS,目的是为了分支机构和总部之间进行l2tp的通信。192.168.0.0网段为分支机构内网,192.168.1.0网段模拟internet,192.168.2.0模拟总部内网。172.16.1.0网段为l2tp隧道利用。

实验完成后R1的配置文件。

  1. R1_config#        
  2. !version 1.3.3H  
  3. service timestamps log date  
  4. service timestamps debug date  
  5. no service password-encryption  
  6. !  
  7. hostname R1  
  8. !  
  9. gbsc group default  
  10. !  
  11. aaa authentication ppp default local      ;  
  12. !  
  13. username 123 password 0 123  
  14. !  
  15. interface Virtual-tunnel0                                              ;  
  16.  ip address 172.16.1.2 255.255.255.0  
  17.  no ip directed-broadcast  
  18.   
  19.   
  20.  ppp chap hostname 123  
  21.  ppp chap password 0 123  
  22.  peer default ip address 172.16.1.1                             ;  
  23. !  
  24. interface FastEthernet0/0  
  25.  ip address 192.168.0.1 255.255.255.0  
  26.  no ip directed-broadcast  
  27.  ip nat inside  
  28. !  
  29. interface FastEthernet0/3  
  30.  ip address 192.168.1.1 255.255.255.0  
  31.  no ip directed-broadcast  
  32.  ip nat outside  
  33. !  
  34. interface Serial0/1  
  35.  no ip address  
  36.  no ip directed-broadcast  
  37. !  
  38. interface Serial0/2  
  39.  no ip address  
  40.  no ip directed-broadcast  
  41. !  
  42. interface Async0/0  
  43.  no ip address  
  44.  no ip directed-broadcast  
  45. !  
  46. ip route 192.168.2.0 255.255.255.0 Virtual-tunnel0      ;  
  47. !  
  48. ip access-list standard 999   
  49.  permit any   
  50. !  
  51. vpdn enable  
  52. !  
  53. vpdn-group 0  
  54.  request-dialin                                                                   ;  
  55.  no domain  
  56.  protocol l2tp                                                                       ;  
  57.  local-name R1                                                                    ;   
  58.  initiate-to ip 192.168.1.2 priority 1                                  ;  
  59. !  
  60. !  
  61. ip nat inside source list 999 interface FastEthernet0/3          ;  
  62. !  

实验完成后R2的配置文件。

R2_config#show running-config

正在收集配置...

当前配置:

  1. !  
  2. !version 1.3.3H  
  3. service timestamps log date  
  4. service timestamps debug date  
  5. no service password-encryption  
  6. !  
  7. hostname R2  
  8. !  
  9. gbsc group default  
  10. !  
  11. ip local pool 000 172.16.1.50 50                                          ;  
  12. !  
  13. aaa authentication ppp default local                                     ;   
  14. username 123 password 0 123  
  15. !  
  16. interface Virtual-template0  
  17.  ip address 172.16.1.1 255.255.255.0  
  18.  no ip directed-broadcast  
  19.  ppp authentication chap                                                         ;  
  20.  ppp chap hostname 123  
  21.  ppp chap password 0 123  
  22.  peer default ip address 172.16.1.2                                            ;  
  23. !  
  24. interface FastEthernet0/0  
  25.  ip address 192.168.2.1 255.255.255.0  
  26.  no ip directed-broadcast   
  27.  ip nat inside  
  28. !  
  29. interface FastEthernet0/3  
  30.  ip address 192.168.1.2 255.255.255.0  
  31.  no ip directed-broadcast  
  32.  ip nat outside  
  33. !  
  34. interface Serial0/1  
  35.  no ip address  
  36.  no ip directed-broadcast  
  37. !  
  38. interface Serial0/2  
  39.  no ip address  
  40.  no ip directed-broadcast  
  41. !  
  42. interface Async0/0  
  43.  no ip address  
  44.  no ip directed-broadcast  
  45. !  
  46. ip route 192.168.0.0 255.255.255.0 Virtual-access0                       ;  
  47. !  
  48. !  
  49. ip access-list standard 999  
  50.  permit any   
  51. !  
  52. !  
  53. !  
  54. vpdn enable  
  55. !  
  56. vpdn-group 0  
  57.  accept-dialin                                                    ;   
  58.  port Virtual-template0                                  ;  
  59.  protocol l2tp                                                        ;  
  60.  local-name default                                       ;  
  61.  terminate-from R1                                        ;   
  62. !  
  63. ip nat inside source list 999 interface FastEthernet0/3        ;  
  64. !  

R1:显示虚拟接口

  1. R1_config#show interface virtual-tunnel 0  
  2. Virtual-tunnel0 is up, line protocol is up                                       ;  
  3.   Hardware is Unknown device  
  4.   MTU 1500 bytes, BW 100000 kbit, DLY 10000 usec  
  5.   Interface address is 172.16.1.2/24  
  6.   Encapsulation PPP, loopback not set  
  7.   Keepalive set(10 sec)  
  8.   LCP  Opened  
  9.   CHAP Opened, Message: ' Welcome to Digital China Router'  
  10.   IPCP Opened  
  11.        local IP address: 172.16.1.2  remote IP address: 172.16.1.1                ;  

显示路由表项

  1. R1_config#show ip route   
  2. Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected  
  3.        D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area  
  4.        ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2  
  5.        OE1 - OSPF external type 1, OE2 - OSPF external type 2  
  6.        DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2  
  7. VRF ID: 0  
  8. C      172.16.1.0/24        is directly connected, Virtual-tunnel0                       ;  
  9. C      172.16.1.1/32        is directly connected, Virtual-tunnel0  
  10. C      192.168.0.0/24       is directly connected, FastEthernet0/0   
  11. C      192.168.1.0/24       is directly connected, FastEthernet0/3  
  12. S      192.168.2.0/24       is directly connected, Virtual-tunnel0                 ;  
  13. R2:  
  14. R2_config# show interface virtual-access 0  
  15. Virtual-access0 is up, line protocol is up                               ;  
  16.   Hardware is Virtual access interface  
  17.   MTU 1500 bytes, BW 100000 kbit, DLY 10000 usec  
  18.   Interface address is 172.16.1.1/24  
  19.   Encapsulation PPP, loopback not set  
  20.   Keepalive set(10 sec)  
  21.   LCP  Opened  
  22.   CHAP Opened, Message: 'Request timeout'  
  23.   IPCP Opened  
  24.        local IP address: 172.16.1.1  remote IP address: 172.16.1.2        ;   
  25. R2_config#show ip route   
  26. Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected  
  27.        D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area  
  28.        ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2  
  29.        OE1 - OSPF external type 1, OE2 - OSPF external type 2  
  30.        DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2  
  31. VRF ID: 0  
  32. C      172.16.1.0/24        is directly connected, Virtual-access0            ;  
  33. C      172.16.1.2/32        is directly connected, Virtual-access0  
  34. S      192.168.0.0/24       is directly connected, Virtual-access0           ;   
  35. C      192.168.1.0/24       is directly connected, FastEthernet0/3  
  36. C      192.168.2.0/24       is directly connected, FastEthernet0/0  

未完待续。。。。。。。。。。。

标签:

给我留言