您的当前位置:首页正文

VPN实例

来源:好兔宠物网
 CISCO VPN配置教程 1 启用IKE协商 routerA(config)#crypto isakmp policy 1 建立IKE协商策略(1是策略编号1-1000,号 越小,优先级越高 routerA(config-isakmap)#hash md5 密钥认证的算法 routerA(config-isakmap)#authentication pre-share 告诉路由使用预先共享的密钥 routerA(config)#crypto isakmp key 123456 address 20.20.20.22 (123456是设置的共享密钥, 20.20.20.22是对端的IP地址)。 routerB(config)#crypto isakmp policy 1 routerB(config-isakmap)#hash md5 routerB(config-isakmap)#authentication pre-share routerB(config)#crypto isakmp key 123456 address 20.20.20.21 (路由B和A的配置除了这里的对端IP地址变成了20.20.20.21,注册用户 注册日期: Oct 2008 住址: 河南郑州 帖子: 6 现金:522金币 资产:522金币 声望力: 0 声望: 10 声望力: 0 其他都要一样的)。 2 配置IPSec相关参数 routerA(cnfog)#crypto ipsec transform-set test ah-md5-hamc esp-des (test传输模式的名 称。ah-md5-hamc esp-des表示传输模式中采用的验证和加 密参数 )。 routerA(config)#acess-list 101 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 (定义哪些地址的报文加密或是不加密) routerB(config)#crypto ipsec transform-set test ah-md5-hamc esp-des routerB(config)#acess-list 101 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255 (路由器B和A的配置除了这里的源和目的IP地址变了,其他都一样) 3 设置crypto map (目的把IKE的协商信息和IPSec的参数,整合到一起,起一个名字) routerA(config)#crypto map testmap 1 ipsec-isakmp (testmap:给crypto map起的名字。 1:优先级。ipsec-isakmp:表示此IPSec链接采用IKE自动协商) routerA(config-crypto-map)#set peer 20.20.20.22 (指定此VPN链路,对端的IP地址)。 routerA(config-crypto-map)#set transform-set test (IPSec传输模式的名字) routerA(config-crypto-map)#match address 101 (上面定义的ACL列表号) routerB(config)#crypto map testmap 1 ipsec-isakmp routerB(config-crypto-map)#set peer 20.20.20.21 (和A路由的

配置只有这里的对端IP不一样)

routerB(config-crypto-map)#set transform-set test routerB(config-crypto-map)#match address 101 4 把crypto map 的名字应用到端口

routerA(config)#inter s0/0 (进入应用VPN的接口)

routerA(config-if)#crypto map testmap (testmap:crypto map的名字)

B路由和A完全一样

查看VPN的配置 查看安全联盟(SA)

Router#show crypto ipsec sa 显示crypto map 内的所有配置 router#show crypto map 查看优先级

router#show crypto isakmp policy 没做vpn之前 r1 en conf t int fa0/0

ip add 2.2.2.1 255.255.255.0 no shu int fa1/0

ip add 1.1.1.1 255.255.255.0 no shu exit

ip route 3.3.3.0 255.255.255.0 1.1.1.2 end r2 en conf t int fa 1/0

ip add 1.1.1.2 255.255.255.0 no shu int fa0/0

ip add 3.3.3.1 255.255.255.0 no shu exit

ip route 2.2.2.0 255.255.255.0 1.1.1.1 end vpc 1

ip 2.2.2.2 2.2.2.1 24 2

ip 3.3.3.2 3.3.3.1 24

交换机抓包 默认可以抓自己接收或者发送的报文,以及广播报文 如果想抓另外两台机子通信的内容,应该做端口镜像 命令如下 en conf t

monitor session 1 source int fa0/0 monitor session 1 destination int fa0/2

两台路由器之间做ipsec vpn后 r1 en conf t

crypto isakmp enable crypto isakmp policy 1 authentication pre-share hash md5 encryption 3des lifetime 86400 exit

crypto isakmp key benet add 1.1.1.2

crypto ipsec transform-set test ah-md5 esp-aes exit

access-list 100 permit ip 2.2.2.0 0.0.0.255 3.3.3.0 0.0.0.255 crypto map cisco 1 ipsec-isakmp match add 100 set peer 1.1.1.2 set transform-set test exit int fa1/0

crypto map cisco end

r2 en conf t

crypto isakmp enable crypto isakmp policy 1 authentication pre-share hash md5 encryption 3des lifetime 86400 exit

crypto isakmp key benet add 1.1.1.1

crypto ipsec transform-set test ah-md5 esp-aes exit

access-list 100 permit ip 3.3.3.0 0.0.0.255 2.2.2.0 0.0.0.255 crypto map cisco 1 ipsec-isakmp match add 100 set peer 1.1.1.1 set transform-set test exit int fa1/0

crypto map cisco end

因篇幅问题不能全部显示,请点此查看更多更全内容