VPN各种配置实例.docx
《VPN各种配置实例.docx》由会员分享,可在线阅读,更多相关《VPN各种配置实例.docx(50页珍藏版)》请在冰点文库上搜索。
VPN各种配置实例
VPN配置实例(模板)篇
PPTP(Point-to-PointTunnelingProtocol)
PPTP使得远程用户通过MicrosoftWindowsNT®Workstation,Windows®95,Windows®98和Windows®2000以及其它具备ppp功能的系统拨入到本地ISP,就能跨越Internet平安地连接并访问公司网络。
其标准说明文档为RFC2637。
VPN效劳端路由器配置
configt
!
进入全局模式
hostnamePPTPserver
!
主机名设置为PPTPserver
enablesecret0star
!
特权口令设置为star
access-list1permitany
!
建立acl1,用来nat规那么关联
vpdnenable
!
使能vpdn功能
vpdn-grouppptp
!
DefaultPPTPVPDNgroup,设置vpdn-group接口,名为pptp
accept-dialin
!
允许承受远程客户端拨入
protocolpptp
!
设置隧道协议为pptp
virtual-template1
!
使用虚模板接口1
exit
!
usernamepptppassword0pptp
!
设置用户信息〔创立pptp/pptp〕
iplocalpoolvpn_add10.32.0.20010.32.0.254
!
创立本地地址池,分配给拨入的远程VPN客户端,10.32.0.200-10.32.0.254
interfaceFastEthernet1/0
!
设置FastEthernet1/0口,用于连接Internet
ipnatoutside
!
指定此接口连接外网
ipaddress192.168.33.39255.255.255.0
!
为此接口分配IP地址192.168.33.39/24
noshutdown
!
启用此接口
exit
!
interfaceFastEthernet1/1
!
设置FastEthernet1/1口,用于连接本地局域网(网)
ipnatinside
!
指定此接口连接网
ipaddress10.32.0.1255.255.255.0
!
为此接口分配IP地址10.32.0.1/24
noshutdown
!
启用此接口
exit
!
interfaceVirtual-Template1
!
创立虚模板接口1,使之成为绑定并负载PPTP会话的virtual-access接口模板
pppauthenticationpap
!
启动PPP验证,并指定身份验证模式为PAP
ipunnumberedFastEthernet1/1
!
设置此无编号接口关联的接口为FastEthernet1/1
peerdefaultipaddresspoolvpn_add
!
为拨入的用户选择分配IP地址的策略,使用地址池vpn_add
ipnatinside
!
设置此虚模板接口参与nat,使远程客户端拨号到VPDN路由器之后通过此路由上网
exit
!
ipnatinsidesourcelist1interfaceFastEthernet1/0overload
!
设置nat规那么,关联ACL1,允许所有源主机进展nat
iproute0.0.0.00.0.0.0192.168.33.1
!
设置缺省路由即网关192.168.33.1
linevty04
!
设置vty0-4的密码即telnet口令
login
password0star
!
telnet口令设置为star
exit
end
write
!
保存配置
远程VPN客户端设置方法
VPN效劳端路由器的查看信息
PPTPserver*showvpdnsession
%NoactiveL2TPtunnels
PPTPSessionInformationTotalsessions1
LocIDRemIDTunIDIntfUsernameStateLastChg
3125630Va0pptpconnected00:
00:
15
PPTPserver*showiproute
Codes:
C-connected,S-static,R-RIP
O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2
*-candidatedefault
Gatewayoflastresortis192.168.33.1tonetwork0.0.0.0
S*0.0.0.0/0[1/0]via192.168.33.1
C10.32.0.0/24isdirectlyconnected,FastEthernet1/1
C10.32.0.1/32islocalhost.
C10.32.0.200/32isdirectlyconnected,virtual-access0
C192.168.33.0/24isdirectlyconnected,FastEthernet1/0
C192.168.33.39/32islocalhost.
PPTPserver*
L2TP(Layer2TunnelingProtocol)
L2TP作为一种二层隧道协议,结合了PPTP(PointtoPointTunnelingProtocol,点对点隧道协议)和L2F(Layer2Forwarding,二层转发协议)的优点。
L2TP是对Point-to-PointProtocol(PPP)的一种扩展,它依靠利用PPP实现用户身份验证和传输数据。
与PPTP不同的是,L2TP使用UDP作为控制消息与数据消息的传输协议。
L2TP也是实现VPN的一种重要和有效的方法。
VPN使得网络用户访问公司部网更方便与平安,无论是拨号用户还是其他网络接入方式的用户都可以通过VPN轻松到达这个目的。
VPN效劳端路由器配置
configt
!
进入全局模式
hostnameL2TPserver
!
主机名设置为L2TPserver
enablesecret0star
!
特权口令设置为star
access-list1permitany
!
建立acl1,用来nat规那么关联
vpdnenable
!
使能vpdn功能
vpdn-groupl2tp
!
DefaultL2TPVPDNgroup,设置vpdn-group接口,名为l2tp
accept-dialin
!
允许承受远程客户端拨入
protocoll2tp
!
设置隧道协议为l2tp
virtual-template2
!
使用虚模板接口2
exit
!
usernamel2tppassword0l2tp
!
设置用户信息〔创立l2tp/l2tp〕
iplocalpooll2tppool10.32.1.10010.32.1.200
!
创立本地地址池l2tppool,分配给拨入的远程VPN客户端,10.32.1.100-10.32.1.200
interfaceFastEthernet1/0
!
设置FastEthernet1/0口,用于连接Internet
ipnatoutside
!
指定此接口连接外网
ipaddress192.168.33.39255.255.255.0
!
为此接口分配IP地址192.168.33.39/24
noshutdown
!
启用此接口
exit
!
interfaceFastEthernet1/1
!
设置FastEthernet1/1口,用于连接本地局域网(网)
ipnatinside
!
指定此接口连接网
ipaddress10.32.0.1255.255.255.0
!
为此接口分配IP地址10.32.0.1/24
noshutdown
!
启用此接口
exit
!
interfaceVirtual-Template2
!
创立虚模板接口2,使之成为绑定并负载L2TP会话的virtual-access接口模板
pppauthenticationchap
!
启动PPP验证,并指定身份验证模式为CHAP
ipunnumberedFastEthernet1/1
!
设置此无编号接口关联的接口为FastEthernet1/1
peerdefaultipaddresspooll2tppool
!
为拨入的用户选择分配IP地址的策略,使用地址池l2tppool
ipnatinside
!
设置此虚模板接口参与nat,使远程客户端拨号到VPDN路由器之后通过此路由上网
exit
!
ipnatinsidesourcelist1interfaceFastEthernet1/0overload
!
设置nat规那么,关联ACL1,允许所有源主机进展nat
iproute0.0.0.00.0.0.0192.168.33.1
!
设置缺省路由即网关192.168.33.1
linevty04
!
设置vty0-4的密码即telnet口令
login
password0star
!
telnet口令设置为star
exit
end
write
!
保存配置
远程VPN客户端设置方法
Windows上L2TP是与IPSec/IKE绑定使用的,而大多数的L2TP设备没有将L2TP与IPSec/IKE绑定。
可以通过修改Windows的注册表来解除此限制:
首先点击〞开场〞,然后选中〞运行〞,
接着键入〞regedit〞进入注册表编辑器找到这个目录
〞HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/RasMan/Parameters〞
然后在这个目录下Windows2000创立一个名称为〞Prohibitipsec〞的双字节值并设其值为1,在WindowsXP中,创立的工程为DWORD类型的,按F5刷新注册表,最后重启你的Windows。
C:
\DocumentsandSettings\RedGiant>ipconfig/all
WindowsIPConfiguration
HostName............:
cs
PrimaryDnsSuffix.......:
NodeType............:
Unknown
IPRoutingEnabled........:
No
WINSProxyEnabled........:
No
Ethernetadapter本地连接:
Connection-specificDNSSuffix.:
Description...........:
RealtekRTL8139FamilyPCIFastEthernetNIC
PhysicalAddress.........:
00-15-F2-DC-96-B4
DhcpEnabled...........:
No
IPAddress............:
192.168.33.31
SubnetMask...........:
255.255.255.0
DefaultGateway.........:
192.168.33.1
DNSServers...........:
202.101.98.55
Ethernetadapter{8D69DFE8-6751-483F-96BE-475399C6E2FB}:
MediaState...........:
Mediadisconnected
Description...........:
VCDVNCAdapter-数据包方案程序微型端口
PhysicalAddress.........:
02-50-F2-3D-00-01
PPPadapterl2tp:
Connection-specificDNSSuffix.:
Description...........:
WAN(PPP/SLIP)Interface
PhysicalAddress.........:
00-53-45-00-00-00
DhcpEnabled...........:
No
IPAddress............:
10.32.1.100
SubnetMask...........:
255.255.255.255
DefaultGateway.........:
10.32.1.100
VPN效劳端路由器的查看信息
L2TPserver*shvpdntunnel
L2TPTunnelInformationTotaltunnels1
LocIDRemIDRemoteNameStateRemoteAddressPortSessionsL2TPClass/
VPDNGroup
2022csest192.168.33.3117011l2tp
%NoactivePPTPtunnels
L2TPserver*shvpdnsession
L2TPSessionInformationTotalsessions1
LocIDRemIDTunIDUsername,Intf/StateLastChg
Vcid,Circuit
1120l2tp,va0est00:
00:
20
%NoactivePPTPtunnels
L2TPserver*shiproute
Codes:
C-connected,S-static,R-RIP
O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2
*-candidatedefault
Gatewayoflastresortis192.168.33.1tonetwork0.0.0.0
S*0.0.0.0/0[1/0]via192.168.33.1
C10.32.1.0/24isdirectlyconnected,FastEthernet1/1
C10.32.1.1/32islocalhost.
C10.32.1.100/32isdirectlyconnected,virtual-access0
C192.168.33.0/24isdirectlyconnected,FastEthernet1/0
C192.168.33.29/32islocalhost.
L2TPserver*
路由器同时作为PPTPServer与L2TPServer实例
VPN效劳端路由器配置
configt
!
进入全局配置模式
hostnamevpnserver
!
设置路由器主机名为vpnserver
enablepassword0star
!
设置enable口令为star
access-list1permitany
!
定义acl1,允许所有源地址〔用来关联nat〕
vpdnenable
!
使能VPDN功能
vpdnsource-ip192.168.33.39
!
设置使用本地源地址,这样远程客户端的隧道目的地址必须与本地地址一致才可以建立隧道
vpdn-groupstar-l2tp
!
设置vpdn-group接口star-l2tp
accept-dialin
!
允许承受远程客户端拨入
protocoll2tp
!
设置隧道协议为l2tp
virtual-template20
!
使用虚模板接口2
exit
localnamel2tp_server
!
设置本地名称为l2tp_server,隧道建立时作为本地的记录性属性发送给对端
l2tptunnelauthentication
!
启动通道验证
l2tptunnelpasswordpass
!
设置通道验证口令为pass
exit
!
vpdn-groupstar-pptp
!
设置vpdn-group接口star-pptp
accept-dialin
protocolpptp
virtual-template10
exit
localnamepptp_server
source-ip192.168.33.39
exit
!
usernamergnospassword0rgnos
!
设置用户信息〔创立rgnos/rgnos〕
iplocalpooll2tppool192.168.0.201192.168.0.210
!
创立本地地址池l2tppool,分配给拨入的L2TP远程VPN客户端,192.168.0.201-192.168.0.210
iplocalpoolpptppool192.168.1.211192.168.1.220
!
创立本地地址池pptppool,分配给拨入的PPTP远程VPN客户端,192.168.1.211-192.168.1.220
interfaceFastEthernet1/1
!
设置FastEthernet1/1口,用于连接本地局域网
ipnatinside
!
指定此接口连接网
ipaddress192.168.1.1255.255.255.0
!
为此接口分配IP地址192.168.1.1/24
noshutdown
!
启用此接口
exit
!
interfaceFastEthernet1/0
!
设置FastEthernet1/0口,用于连接Internet
ipnatoutside
!
指定此接口连接外网
ipaddress192.168.33.39255.255.255.0
!
为此接口分配IP地址192.168.33.39/24
noshutdown
!
启用此接口
exit
!
interfaceloopback1
!
设置回环口loopback1,用来作为L2TP客户端拨入VPDN效劳端路由器之后网关
ipaddress192.168.0.1255.255.255.0
!
为此接口分配IP地址
exit
!
interfaceVirtual-Template20
!
建虚模板接口20,使之成为绑定并负载L2TP会话的virtual-access接口模板
pppauthenticationchap
!
启动PPP验证,并指定身份验证模式为CHAP
ipunnumberedloopback1
!
设置此无编号接口关联的接口为loopback1
peerdefaultipaddresspooll2tppool
!
为拨入的用户选择分配IP地址的策略,使用地址池l2tppool
exit
!
interfaceVirtual-Template10
!
建虚模板接口10,使之成为绑定并负载PPTP会话的virtual-access接口模板
pppauthenticationpap
!
启动PPP验证,并指定身份验证模式为PAP
ipunnumberedFastEthernet1/1
!
设置此无编号接口关联的接口为FastEthernet1/1
peerdefaultipaddresspoolpptppool
!
为拨入的用户选择分配IP地址的策略,使用地址池pptppool
ipnatinside
!
设置此虚模板接口参与nat,使远程客户端拨号到VPDN路由器之后通过此路由上网
exit
ipnatinsidesourcelist1interfacefast1/0overload
!
设置nat规那么,关联ACL1,允许所有源主机进展nat
iproute0.0.0.00.0.0.0FastEthernet1/0192.168.33.1
!
设置缺省路由即网关192.168.33.1
linevty04
!
设置vty0-4的密码即telnet口令
login
password0star
!
telnet口令设置为star
exit
end
write
!
保存配置
VPN客户端路由器配置
configt
!
进入全局配置模式
hostnameR1762
!
设置路由器主机名为R1762
enablepassword0star
!
设置enable口令为star,即特权口令
access-list1permitany
access-list2permitany
!
定义ACL1/ACL2,允许所有源地址〔用来关联nat〕
l2tp-classl2x
!
创立名为l2x的l2tp-class,设定L2TP控制连接相关参数,将被pseudowire-class引用
authentication
!
使用通道身份验证
hostnameL2TP_client
!
设置本地主机名为L2TP_client
passwordpass
!
设置通道口令为pass,与效劳端一致
exit
!
pseudowire-classpw
!
创立名为pw的pseudowire-