ipsec V P N + gre 隧道配置命令

大家好,最近学习ipsec V P N +gre 隧道的配置,下面是我配置的命令,希望可以帮助到大家
ipsec V P N + gre 隧道配置命令
R1:
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.2 255.255.255.252
R1(config-if)#no sh
R1(config-if)#int lo 0
R1(config-if)#ip add 2.2.2.2 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
R1(config)#crypto isakmp policy 10
R1(config-isakmp)#authentication pre-share //验证方式为预共享密钥
R1(config-isakmp)#encryption 3des //加密算法为3des
R1(config-isakmp)#hash md5 //完整性校验算法为md5
R1(config-isakmp)#group 2 //DH组为2
R1(config-isakmp)#exit
R1(config)#crypto isakmp key cisco11 address 192.168.2.2 //配置Key 0 表示不加密,address 为对端加密点,cisco11是共享秘钥,两端要相同
R1(config)#crypto ipsec transform-set test esp-3des esp-md5-hmac //配置第二阶段策略,设置交换集,注意这里的要和上面policy 10里的加密算法和校验算法相对应
R1(cfg-crypto-trans)#exit
R1(config)#access-list 110 petmit gre host 192.168.1.2 host 192.168.2.2//定义一个扩展的ACL,即编写隧道感兴趣流
R1(config)#crypto map ××× 1 ipsec-isakmp //定义一个map(名称等本地有效)
R1(config-crypto-map)#set transform-set test //关联第二阶段的策略,test就是交换集名称
R1(config-crypto-map)#set peer 192.168.2.2 //指定对端地址
R1(config-crypto-map)#match address 110 //关联ACL
R1(config-crypto-map)#exit
R1(config)#int f0/0
R1(config-if)#crypto map ××× //在接口端使用map
R1(config)#int tunnel0 //定义进入tunnel 0 隧道
R1(config-if)#ip address 10.1.1.1 255.255.255.0 //隧道两头的ip要在相同的网段
R1(config-if)#tunnel source 192.168.1.2
R1(config-if)#tunnel destination 192.168.2.2
R1(config-if)#exit
R1(config)#router eigrp 10
R1(config-router)#no auto-summary
R1(config-router)#net 10.1.1.0
R1(config-router)#net 2.2.2.0

R2:
R2(config)#int f0/0
R2(config-if)#ip address 192.168.1.1 255.255.255.252
R2(config-if)#int f0/1
R2(config-if)#ip address 192.168.2.1 255.255.255.252

R3:配置基本和R1相同,配置方向是相反的,我在不一样的语句后面打上 //,大家注意一下
R3#conf t
R3(config)#int f0/0
R3(config-if)#ip add 192.168.2.2 255.255.255.252 //
R3(config-if)#no sh
R3(config-if)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.0 //
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1 //
R3(config)#crypto isakmp policy 10
R3(config-isakmp)#authentication pre-share
R3(config-isakmp)#encryption 3des
R3(config-isakmp)#hash md5
R3(config-isakmp)#group 2
R3(config-isakmp)#exit
R3(config)#crypto isakmp key cisco11 address 192.168.1.2 //
R3(config)#crypto ipsec transform-set test esp-3des esp-md5-hmac
R3(cfg-crypto-trans)#exit
R3(config)#access-list 110 petmit gre host 192.168.2.2 host 192.168.1.2 //
R3(config)#crypto map ××× 1 ipsec-isakmp
R3(config-crypto-map)#set transform-set test
R3(config-crypto-map)#set peer 192.168.1.2 //
R3(config-crypto-map)#match address 110
R3(config-crypto-map)#exit
R3(config)#int f0/0
R3(config-if)#crypto map ×××
R3(config)#int tunnel0
R3(config-if)#ip address 10.1.1.2 255.255.255.0 //
R3(config-if)#tunnel source 192.168.2.2 //
R3(config-if)#tunnel destination 192.168.1.2 //
R3(config-if)#exit
R3(config)#router eigrp 10
R3(config-router)#no auto-summary
R3(config-router)#net 10.1.1.0
R3(config-router)#net 3.3.3.0 //

配置完成后,可以使用trace 3.3.3.3 source loopback 0
ipsec V P N + gre 隧道配置命令
值得注意的是,如果不通,请先在R1上ping 192.168.1.1,在R3 上ping 192.168.2.1,差不多就是这样了,感谢大家观看!

猜你喜欢

转载自blog.51cto.com/13941583/2398404