神州数码路由器上的l2tp实验
学生按照神码的配置手册和实验项目手册做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的配置文件。
- R1_config#
- !version 1.3.3H
- service timestamps log date
- service timestamps debug date
- no service password-encryption
- !
- hostname R1
- !
- gbsc group default
- !
- aaa authentication ppp default local ;
- !
- username 123 password 0 123
- !
- interface Virtual-tunnel0 ;
- ip address 172.16.1.2 255.255.255.0
- no ip directed-broadcast
- ppp chap hostname 123
- ppp chap password 0 123
- peer default ip address 172.16.1.1 ;
- !
- interface FastEthernet0/0
- ip address 192.168.0.1 255.255.255.0
- no ip directed-broadcast
- ip nat inside
- !
- interface FastEthernet0/3
- ip address 192.168.1.1 255.255.255.0
- no ip directed-broadcast
- ip nat outside
- !
- interface Serial0/1
- no ip address
- no ip directed-broadcast
- !
- interface Serial0/2
- no ip address
- no ip directed-broadcast
- !
- interface Async0/0
- no ip address
- no ip directed-broadcast
- !
- ip route 192.168.2.0 255.255.255.0 Virtual-tunnel0 ;
- !
- ip access-list standard 999
- permit any
- !
- vpdn enable
- !
- vpdn-group 0
- request-dialin ;
- no domain
- protocol l2tp ;
- local-name R1 ;
- initiate-to ip 192.168.1.2 priority 1 ;
- !
- !
- ip nat inside source list 999 interface FastEthernet0/3 ;
- !
实验完成后R2的配置文件。
R2_config#show running-config
正在收集配置...
当前配置:
- !
- !version 1.3.3H
- service timestamps log date
- service timestamps debug date
- no service password-encryption
- !
- hostname R2
- !
- gbsc group default
- !
- ip local pool 000 172.16.1.50 50 ;
- !
- aaa authentication ppp default local ;
- username 123 password 0 123
- !
- interface Virtual-template0
- ip address 172.16.1.1 255.255.255.0
- no ip directed-broadcast
- ppp authentication chap ;
- ppp chap hostname 123
- ppp chap password 0 123
- peer default ip address 172.16.1.2 ;
- !
- interface FastEthernet0/0
- ip address 192.168.2.1 255.255.255.0
- no ip directed-broadcast
- ip nat inside
- !
- interface FastEthernet0/3
- ip address 192.168.1.2 255.255.255.0
- no ip directed-broadcast
- ip nat outside
- !
- interface Serial0/1
- no ip address
- no ip directed-broadcast
- !
- interface Serial0/2
- no ip address
- no ip directed-broadcast
- !
- interface Async0/0
- no ip address
- no ip directed-broadcast
- !
- ip route 192.168.0.0 255.255.255.0 Virtual-access0 ;
- !
- !
- ip access-list standard 999
- permit any
- !
- !
- !
- vpdn enable
- !
- vpdn-group 0
- accept-dialin ;
- port Virtual-template0 ;
- protocol l2tp ;
- local-name default ;
- terminate-from R1 ;
- !
- ip nat inside source list 999 interface FastEthernet0/3 ;
- !
R1:显示虚拟接口
- R1_config#show interface virtual-tunnel 0
- Virtual-tunnel0 is up, line protocol is up ;
- Hardware is Unknown device
- MTU 1500 bytes, BW 100000 kbit, DLY 10000 usec
- Interface address is 172.16.1.2/24
- Encapsulation PPP, loopback not set
- Keepalive set(10 sec)
- LCP Opened
- CHAP Opened, Message: ' Welcome to Digital China Router'
- IPCP Opened
- local IP address: 172.16.1.2 remote IP address: 172.16.1.1 ;
显示路由表项
- R1_config#show ip route
- Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
- D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area
- ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
- OE1 - OSPF external type 1, OE2 - OSPF external type 2
- DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2
- VRF ID: 0
- C 172.16.1.0/24 is directly connected, Virtual-tunnel0 ;
- C 172.16.1.1/32 is directly connected, Virtual-tunnel0
- C 192.168.0.0/24 is directly connected, FastEthernet0/0
- C 192.168.1.0/24 is directly connected, FastEthernet0/3
- S 192.168.2.0/24 is directly connected, Virtual-tunnel0 ;
- R2:
- R2_config# show interface virtual-access 0
- Virtual-access0 is up, line protocol is up ;
- Hardware is Virtual access interface
- MTU 1500 bytes, BW 100000 kbit, DLY 10000 usec
- Interface address is 172.16.1.1/24
- Encapsulation PPP, loopback not set
- Keepalive set(10 sec)
- LCP Opened
- CHAP Opened, Message: 'Request timeout'
- IPCP Opened
- local IP address: 172.16.1.1 remote IP address: 172.16.1.2 ;
- R2_config#show ip route
- Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected
- D - BEIGRP, DEX - external BEIGRP, O - OSPF, OIA - OSPF inter area
- ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2
- OE1 - OSPF external type 1, OE2 - OSPF external type 2
- DHCP - DHCP type, L1 - IS-IS level-1, L2 - IS-IS level-2
- VRF ID: 0
- C 172.16.1.0/24 is directly connected, Virtual-access0 ;
- C 172.16.1.2/32 is directly connected, Virtual-access0
- S 192.168.0.0/24 is directly connected, Virtual-access0 ;
- C 192.168.1.0/24 is directly connected, FastEthernet0/3
- C 192.168.2.0/24 is directly connected, FastEthernet0/0
未完待续。。。。。。。。。。。