当前位置:中国易下载软件教材中心文章中心网络技术VPN技术 → VPN实例配置方案-中文详细注解一(图)

VPN实例配置方案-中文详细注解一(图)

减小字体 增大字体 作者:佚名  来源:不详  发布时间:2007-12-8 0:16:58
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
喜欢这些内容嘛,请告诉你身边的朋友,易下载中心-QQ资源-itnetcn.com一起享受这份乐趣,本站内容来源互联网
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


  Router:sam-i-am(VPN Server)
  
  Current configuration:
  !
  version 12.2
  service timestamps debug uptime
  service timestamps log up time
  no service password-encryption
  !
  hostname sam-i-am
  !
  ip subnet-zero
  
  !--- IKE配置
  
  sam-i-am(config)#crypto isakmp policy 1 //定义策略为1
  sam-i-am(isakmp)#hash md5 //定义MD5散列算法
  sam-i-am(isakmp)#authentication pre-share //定义为预共享密钥认证方式
  sam-i-am(config)#crypto isakmp key cisco123 address 0.0.0.0 0.0.0.0
  
  !--- 配置预共享密钥为cisco123,对等端为所有IP
  
  !--- IPSec协议配置
  
  sam-i-am(config)#crypto ipsec transform-set rtpset esp-des esp-md5-hmac
  
  !--- 创建变换集 esp-des esp-md5-hmac
  
  sam-i-am(config)#crypto dynamic-map rtpmap 10 //创建动态保密图rtpmap 10
  san-i-am(crypto-map)#set transform-set rtpset //使用上面的定义的变换集rtpset
  san-i-am(crypto-map)#match address 115 //援引访问列表确定受保护的流量
  sam-i-am(config)#crypto map rtptrans 10 ipsec-isakmp dynamic rtpmap
  
  !--- 将动态保密图集加入到正规的图集中
  
  !
  interface Ethernet0
  ip address 10.2.2.3 255.255.255.0
  no ip directed-broadcast
  ip nat inside
  
  no mop enabled
  !
  interface Serial0
  ip address 99.99.99.1 255.255.255.0
  no ip directed-broadcast
  ip nat outside
  crypto map rtptrans //将保密映射应用到S0接口上
  
  !
  ip nat inside source route-map nonat interface Serial0 overload
  !--- 这个NAT配置启用了路由策略,内容为10.2.2.0到10.1.1.0的访问不进行地址翻译
  !--- 到其他网络的访问都翻译成SO接口的IP地址
  
  ip classless
  ip route 0.0.0.0 0.0.0.0 Serial0 //配置静态路由协议
  no ip http server
  !
  access-list 115 permit ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255
  access-list 115 deny ip 10.2.2.0 0.0.0.255 any
  !
  access-list 120 deny ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255
  access-list 120 permit ip 10.2.2.0 0.0.0.255 any
  !
  sam-i-am(config)#route-map nonat permit 10 //使用路由策略
  sam-i-am(router-map)#match ip address 120
  !
  line con 0
  transport input none
  line aux 0
  line vty 0 4
  password ww
  login
  !
  end
  
  Router:dr_whoovie(VPN Client)
  
  Current configuration:
  !
  version 12.2
  service timestamps debug uptime
  service timestamps log uptime
  no service password-encryption
  !
  hostname dr_whoovie
  !
  ip subnet-zero
  !
  dr_whoovie(config)#crypto isakmp policy 1 //定义策略为1
  dr_whoovie(isakmp)#hash md5 //定义MD5散列算法
  dr_whoovie(isakmp)#authentication pre-share //定义为预共享密钥认证方式
  dr_whoovie(config)#crypto isakmp key cisco123 address 99.99.99.1
  
  !--- 配置预共享密钥为cisco123,对等端为服务器端IP99.99.99.1
  
  !--- IPSec协议配置
  
  dr_whoovie(config)#crypto ipsec transform-set rtpset esp-des esp-md5-hmac
  
  !--- 创建变换集 esp-des esp-md5-hmac
  
  dr_whoovie(config)#crypto map rtp 1 ipsec-isakmp
  
  !--- 使用IKE创建保密图rtp 1
  
  dr_whoovie(crypto-map)#set peer 99.99.99.1 //确定远程对等端
  dr_whoovie(crypto-map)#set transform-set rtpset //使用上面的定义的变换集rtpset
  dr_whoovie(crypto-map)#match address 115 //援引访问列表确定受保护的流量
  
  !
  interface Ethernet0
  ip address 10.1.1.1 255.255.255.0
  no ip directed-broadcast
  ip nat inside
  
  no mop enabled
  !
  interface Serial0
  ip address negotiated //IP地址自动获取
  no ip directed-broadcast
  ip nat outside
  encapsulation ppp //S0接口封装ppp协议
  no ip mroute-cache
  no ip route-cache
  crypto map rtp //将保密映射应用到S0接口上
  
  !
  ip nat inside source route-map nonat interface Serial0 overload
  !--- 这个NAT配置启用了路由策略,内容为10.1.1.0到10.2.2.0的访问不进行地址翻译
  !--- 到其他网络的访问都翻译成SO接口的IP地址
  
  ip classless
  ip route 0.0.0.0 0.0.0.0 Serial0 //配置静态路由协议
  no ip http server
  
  !
  access-list 115 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255
  access-list 115 deny ip 10.1.1.0 0.0.0.255 any
  
  access-list 120 deny ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255
  access-list 120 permit ip 10.1.1.0 0.0.0.255 any
  
  !
  dialer-list 1 protocol ip permit
  dialer-list 1 protocol ipx permit
  route-map nonat permit 10 //使用路由策略
  match ip address 120
  !
  line con 0
  transport input none
  line aux 0
  line vty 0 4
  password ww
  login
  !
  end
  


  -----------IKE配置----------------
  
  IPSec VPN对等端为了建立信任关系,必须交换某种形式的认证密钥。
  
  Internet 密钥交换(Internet Key Exchange,IKE)是一种为IPSec管理和交换密钥的标准方法。
  
  一旦两个对等端之间的IKE协商取得成功,那么IKE就创建到远程对等端的安全关联(security association,SA)。SA是单向的;在两个对等端之间存在两个SA。
  
  IKE使用UDP端口500进行协商,确保端口500不被阻塞。
  
  配置
  
  1、(可选)启用或者禁用IKE
  
  (global)crypto isakmp enable
  或者
  (global)no crypto isakmp enable
  默认在所有接口上启动IKE
  
  2、创建IKE策略
  
  (1)定义策略
  
  (global)crypto isakmp policy priority
  注释:policy 1表示策略1,假如想多配几个VPN,可以写成policy 2、policy3┅
  
  (2)(可选)定义加密算法
  
  (isakmp)encryption {des | 3des}
  加密模式可以为56位的DES-CBC(des,默认值)或者168位的3DES(3des)
  
  (3)(可选)定义散列算法
  
  (isamkp)hash {sha | md5}
  默认sha
  
  (4)(可选)定义认证方式
  
  (isamkp)authentication {rsa-sig | rsa-encr | pre-share}
  rsa-sig 要求使用CA并且提供防止抵赖功能;默认值
  rsa-encr 不需要CA,提供防止抵赖功能
  pre-share 通过手工配置预共享密钥
  
  (5)(可选)定义Diffie-Hellman标识符
  
  (isakmp)group {1 | 2}
  注释:除非购买高端路由器,或是VPN通信比较少,否则最好使用group 1长度的密钥,group命令有两个参数值:1和2。参数值1表示密钥使用768位密钥,
  
  参数值2表示密钥使用1024位密钥,显然后一种密钥安全性高,但消耗更多的CPU时间。
  
  (6)(可选)定义安全关联的生命期
  
  (isakmp)lifetime seconds
  注释:对生成新SA的周期进行调整。这个值以秒为单位,默认值为86400,也就是一天。值得注意的是两端的路由器都要设置相同的SA周期,否则VPN在正
  
  常初始化之后,将会在较短的一个SA周期到达中断。