1、VPN配置实例模板篇VPN配置实例(模板)篇PPTP(Point-to-Point Tunneling Protocol)PPTP使得远程用户通过Microsoft Windows NT Workstation, Windows 95, Windows 98 和Windows 2000以及其它具备ppp功能的系统拨入到本地ISP,就能跨越Internet安全地连接并访问公司网络。其标准说明文档为RFC 2637。VPN服务端路由器配置config t! 进入全局模式hostname PPTPserver! 主机名设置为PPTPserverenable secret 0 star! 特权口令设置
2、为staraccess-list 1 permit any! 建立acl1,用来nat规则关联vpdn enable! 使能vpdn功能vpdn-group pptp! Default PPTP VPDN group,设置vpdn-group 接口,名为pptp accept-dialin ! 允许接受远程客户端拨入protocol pptp! 设置隧道协议为pptpvirtual-template 1! 使用虚模板接口1 exit!username pptp password 0 pptp! 设置用户信息(创建pptp/pptp帐号)ip local pool vpn_add 10.32.0
3、.200 10.32.0.254! 创建本地地址池,分配给拨入的远程VPN客户端,10.32.0.200-10.32.0.254interface FastEthernet 1/0! 设置FastEthernet1/0口,用于连接Internet ip nat outside ! 指定此接口连接外网 ip address 192.168.33.39 255.255.255.0 ! 为此接口分配IP地址192.168.33.39/24 no shutdown ! 启用此接口 exit!interface FastEthernet 1/1! 设置FastEthernet 1/1口,用于连接本地局域
4、网(内网) ip nat inside ! 指定此接口连接内网 ip address 10.32.0.1 255.255.255.0 ! 为此接口分配IP地址10.32.0.1/24no shutdown! 启用此接口 exit!interface Virtual-Template 1! 创建虚模板接口1,使之成为绑定并负载PPTP会话的virtual-access接口模板 ppp authentication pap ! 启动PPP验证,并指定身份验证模式为PAP ip unnumbered FastEthernet 1/1 ! 设置此无编号接口关联的接口为FastEthernet 1/1
5、peer default ip address pool vpn_add ! 为拨入的用户选择分配IP地址的策略,使用地址池vpn_add ip nat inside ! 设置此虚模板接口参与nat,使远程客户端拨号到VPDN路由器之后通过此路由上网 exit!ip nat inside source list 1 interface FastEthernet 1/0 overload! 设置nat规则,关联ACL1,允许所有源主机进行natip route 0.0.0.0 0.0.0.0 192.168.33.1! 设置缺省路由即网关192.168.33.1line vty 0 4! 设置v
6、ty 0-4的密码 即telnet口令 login password 0 star ! telnet口令设置为star exitendwrite! 保存配置远程VPN客户端设置方法VPN服务端路由器的查看信息PPTPserver#show vpdn session%No active L2TP tunnelsPPTP Session Information Total sessions 1LocID RemID TunID Intf Username State Last Chg31 256 30 Va0 pptp connected 00:00:15PPTPserver#show ip ro
7、uteCodes: C - connected, S - static, R - RIP O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 * - candidate defaultGateway of last resort is 192.168.33.1 to network 0.0.0.0S* 0.0.0.0/0 1/0 via 192.168.3
8、3.1C 10.32.0.0/24 is directly connected, FastEthernet 1/1C 10.32.0.1/32 is local host.C 10.32.0.200/32 is directly connected, virtual-access 0C 192.168.33.0/24 is directly connected, FastEthernet 1/0C 192.168.33.39/32 is local host.PPTPserver#L2TP(Layer 2 Tunneling Protocol)L2TP作为一种二层隧道协议,结合了PPTP(Po
9、int to Point Tunneling Protocol,点对点隧道协议)和L2F(Layer 2 Forwarding,二层转发协议)的优点。L2TP是对Point-to-Point Protocol(PPP)的一种扩展,它依靠利用PPP实现用户身份验证和传输数据。与PPTP不同的是,L2TP使用UDP作为控制消息与数据消息的传输协议。 L2TP也是实现VPN的一种重要和有效的方法。VPN使得网络用户访问公司内部网更方便与安全,无论是拨号用户还是其他网络接入方式的用户都可以通过VPN轻松达到这个目的。 VPN服务端路由器配置config t! 进入全局模式hostname L2TPse
10、rver! 主机名设置为L2TPserverenable secret 0 star! 特权口令设置为staraccess-list 1 permit any! 建立acl1,用来nat规则关联vpdn enable! 使能vpdn功能vpdn-group l2tp! Default L2TP VPDN group, 设置vpdn-group 接口,名为l2tp accept-dialin ! 允许接受远程客户端拨入protocol l2tp! 设置隧道协议为l2tpvirtual-template 2! 使用虚模板接口2exit!username l2tp password 0 l2tp!
11、设置用户信息(创建l2tp/l2tp帐号)ip local pool l2tppool 10.32.1.100 10.32.1.200! 创建本地地址池l2tppool,分配给拨入的远程VPN客户端,10.32.1.100-10.32.1.200interface FastEthernet 1/0 ! 设置FastEthernet1/0口,用于连接Internet ip nat outside ! 指定此接口连接外网 ip address 192.168.33.39 255.255.255.0 ! 为此接口分配IP地址192.168.33.39/24 no shutdown ! 启用此接口 e
12、xit!interface FastEthernet 1/1! 设置FastEthernet 1/1口,用于连接本地局域网(内网) ip nat inside ! 指定此接口连接内网 ip address 10.32.0.1 255.255.255.0 ! 为此接口分配IP地址10.32.0.1/24no shutdown! 启用此接口 exit!interface Virtual-Template 2! 创建虚模板接口2,使之成为绑定并负载L2TP会话的virtual-access接口模板 ppp authentication chap ! 启动PPP验证,并指定身份验证模式为CHAP ip
13、 unnumbered FastEthernet 1/1 ! 设置此无编号接口关联的接口为FastEthernet 1/1 peer default ip address pool l2tppool ! 为拨入的用户选择分配IP地址的策略,使用地址池l2tppool ip nat inside ! 设置此虚模板接口参与nat,使远程客户端拨号到VPDN路由器之后通过此路由上网 exit!ip nat inside source list 1 interface FastEthernet 1/0 overload! 设置nat规则,关联ACL1,允许所有源主机进行natip route 0.0.
14、0.0 0.0.0.0 192.168.33.1! 设置缺省路由即网关192.168.33.1line vty 0 4! 设置vty 0-4的密码 即telnet口令 login password 0 star ! telnet口令设置为star exitendwrite! 保存配置远程VPN客户端设置方法Windows上L2TP是与IPSec/IKE绑定使用的,而大多数的L2TP设备没有将L2TP与IPSec/IKE绑定。可以通过修改Windows的注册表来解除此限制:首先点击”开始”,然后选中”运行”,接着键入”regedit”进入注册表编辑器找到这个目录”HKEY_LOCAL_MACHI
15、NE/SYSTEM/CurrentControlSet/Services/RasMan/Parameters”然后在这个目录下Windows 2000创建一个名称为” Prohibitipsec”的双字节值并设其值为1,在WindowsXP中,创建的项目为DWORD类型的,按F5刷新注册表,最后重启你的Windows。C:Documents and SettingsRedGiantipconfig/allWindows IP Configuration Host Name . . . . . . . . . . . . : cs Primary Dns Suffix . . . . . . .
16、 : Node Type . . . . . . . . . . . . : Unknown IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : NoEthernet adapter 本地连接: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Realtek RTL8139 Family PCI Fast Ethernet NIC Physical Address. . . . . . . . . : 0
17、0-15-F2-DC-96-B4 Dhcp Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.168.33.31 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.33.1 DNS Servers . . . . . . . . . . . : 202.101.98.55 Ethernet adapter 8D69DFE8-6751-483F-96BE-4753
18、99C6E2FB: Media State . . . . . . . . . . . : Media disconnected Description . . . . . . . . . . . : VCD VNC Adapter - 数据包计划程序微型端口 Physical Address. . . . . . . . . : 02-50-F2-3D-00-01PPP adapter l2tp: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : WAN (PPP/SLIP) Interface Ph
19、ysical Address. . . . . . . . . : 00-53-45-00-00-00 Dhcp Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 10.32.1.100 Subnet Mask . . . . . . . . . . . : 255.255.255.255 Default Gateway . . . . . . . . . : 10.32.1.100VPN服务端路由器的查看信息L2TPserver#sh vpdn tunnelL2TP Tunnel Information
20、 Total tunnels 1LocID RemID Remote Name State Remote Address Port Sessions L2TP Class/ VPDN Group20 22 cs est 192.168.33.31 1701 1 l2tp%No active PPTP tunnelsL2TPserver#sh vpdn sessionL2TP Session Information Total sessions 1LocID RemID TunID Username, Intf/ State Last Chg Vcid, Circuit1 1 20 l2tp,v
21、a0 est 00:00:20%No active PPTP tunnelsL2TPserver#sh ip routeCodes: C - connected, S - static, R - RIP O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 * - candidate defaultGateway of last resort is 192.
22、168.33.1 to network 0.0.0.0S* 0.0.0.0/0 1/0 via 192.168.33.1C 10.32.1.0/24 is directly connected, FastEthernet 1/1C 10.32.1.1/32 is local host.C 10.32.1.100/32 is directly connected, virtual-access 0C 192.168.33.0/24 is directly connected, FastEthernet 1/0C 192.168.33.29/32 is local host.L2TPserver#
23、路由器同时作为PPTP Server与L2TP Server实例 VPN服务端路由器配置config t!进入全局配置模式hostname vpnserver! 设置路由器主机名为vpnserverenable password 0 star ! 设置enable口令为staraccess-list 1 permit any! 定义acl1,允许所有源地址(用来关联nat)vpdn enable! 使能VPDN功能vpdn source-ip 192.168.33.39! 设置使用本地源地址,这样远程客户端的隧道目的地址必须与本地地址一致才可以建立隧道vpdn-group star-l2tp!
24、 设置vpdn-group 接口star-l2tp accept-dialin ! 允许接受远程客户端拨入protocol l2tp! 设置隧道协议为l2tpvirtual-template 20! 使用虚模板接口2 exit local name l2tp_server ! 设置本地名称为l2tp_server,隧道建立时作为本地的记录性属性发送给对端 l2tp tunnel authentication ! 启动通道验证 l2tp tunnel password pass ! 设置通道验证口令为pass exit!vpdn-group star-pptp! 设置vpdn-group 接口s
25、tar-pptp accept-dialin protocol pptp virtual-template 10 exit local name pptp_server source-ip 192.168.33.39 exit!username rgnos password 0 rgnos! 设置用户信息(创建rgnos/rgnos帐号)ip local pool l2tppool 192.168.0.201 192.168.0.210! 创建本地地址池l2tppool,分配给拨入的L2TP远程VPN客户端,192.168.0.201-192.168.0.210ip local pool pp
26、tppool 192.168.1.211 192.168.1.220! 创建本地地址池pptppool,分配给拨入的PPTP远程VPN客户端,192.168.1.211-192.168.1.220interface FastEthernet 1/1! 设置FastEthernet1/1口,用于连接本地局域网 ip nat inside ! 指定此接口连接内网 ip address 192.168.1.1 255.255.255.0 ! 为此接口分配IP地址192.168.1.1/24 no shutdown ! 启用此接口 exit!interface FastEthernet 1/0 ! 设
27、置FastEthernet1/0口,用于连接Internet ip nat outside ! 指定此接口连接外网 ip address 192.168.33.39 255.255.255.0 ! 为此接口分配IP地址192.168.33.39/24 no shutdown ! 启用此接口 exit!interface loopback 1! 设置回环口loopback1,用来作为L2TP客户端拨入VPDN服务端路由器之后网关 ip address 192.168.0.1 255.255.255.0 ! 为此接口分配IP地址 exit!interface Virtual-Template 20
28、! 建虚模板接口20,使之成为绑定并负载L2TP会话的virtual-access接口模板 ppp authentication chap ! 启动PPP验证,并指定身份验证模式为CHAP ip unnumbered loopback 1 ! 设置此无编号接口关联的接口为loopback1 peer default ip address pool l2tppool! 为拨入的用户选择分配IP地址的策略,使用地址池l2tppool exit!interface Virtual-Template 10! 建虚模板接口10,使之成为绑定并负载PPTP会话的virtual-access接口模板 ppp
29、 authentication pap ! 启动PPP验证,并指定身份验证模式为PAP ip unnumbered FastEthernet 1/1 ! 设置此无编号接口关联的接口为FastEthernet 1/1 peer default ip address pool pptppool ! 为拨入的用户选择分配IP地址的策略,使用地址池pptppool ip nat inside ! 设置此虚模板接口参与nat,使远程客户端拨号到VPDN路由器之后通过此路由上网 exitip nat inside source list 1 interface fast1/0 overload! 设置na
30、t规则,关联ACL1,允许所有源主机进行natip route 0.0.0.0 0.0.0.0 FastEthernet 1/0 192.168.33.1! 设置缺省路由即网关192.168.33.1line vty 0 4! 设置vty 0-4的密码 即telnet口令 login password 0 star ! telnet口令设置为star exitendwrite! 保存配置VPN客户端路由器配置config t! 进入全局配置模式hostname R1762! 设置路由器主机名为R1762enable password 0 star! 设置enable口令为star,即特权口令access-list 1 permit anyaccess-list 2 permit any! 定义ACL1/ACL2,允许所有源地址(用来关联nat)l2tp-class l2x ! 创建名为l2x的l2tp-class,设定L2TP控制连接相关参数,将被pseudowire-class引用 authentication ! 使用通道身份验证 hostname L2TP_client ! 设置本地主机名为L2
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1