路由器-GRE-Over-IPSec典型配置
H3C GRE over Ipsec+ospf穿越NAT到多分支配置
![H3C GRE over Ipsec+ospf穿越NAT到多分支配置](https://img.taocdn.com/s3/m/b3b42f95daef5ef7ba0d3c48.png)
MSR系列路由器
GRE Over IPSec + OSPF穿越NAT多分支互通配置关键词:MSR;IPSec;IKE;野蛮模式;模板;VPN;多分支互通;NA T;穿越;OSPF;GRE
一、组网需求:
总部对多个分支提供IPSec VPN接入,分支出口存在NAT设备,因此总部与分支之间配置成野蛮模式和NAT穿越,总部路由器不配置ACL,而使用安全模板,总部和分支之间通过内网Loopback建立GRE隧道,分支通过建立ACL使分支Loopback和总部Loopback之间的GRE通过IPSec互通,建立好GRE隧道后,在隧道上运行OSPF,使各内部路由互通,分支之间的流量通过总部转发,需要注意的是Loopback口不能添加到OSPF中
设备清单:MSR系列路由器5台
二、组网图:
四、配置关键点:
1) 大部分配置参考IPSec VPN多分支NAT穿越模板方式功能的配置;
2) 分支的ACL可以配置成精确的GRE流量;
3) 建立GRE隧道的地址必须是内网地址;
4) 不能将建立GRE隧道连接的Loopback接口加入到OSPF,否则连接会失效。
gre over ipsec结构
![gre over ipsec结构](https://img.taocdn.com/s3/m/5be3c0ec32d4b14e852458fb770bf78a65293af8.png)
gre over ipsec结构【实用版】目录1.GRE over IPSec 概述2.GRE over IPSec 结构3.GRE over IPSec 的优点4.GRE over IPSec 的应用场景5.GRE over IPSec 的配置示例正文【1.GRE over IPSec 概述】GRE(Generic Routing Encapsulation)是一种通用路由封装协议,用于在不同的网络协议之间进行数据包的封装和传输。
IPSec(Internet Protocol Security)是一种安全协议,用于在互联网协议(IP)网络中实现安全通信。
GRE over IPSec 是一种组合技术,将 GRE 和 IPSec 结合起来,既实现了数据包的封装,又保证了数据通信的安全性。
【2.GRE over IPSec 结构】GRE over IPSec 的结构主要包括三个部分:GRE 头部、IPSec 头部和数据部分。
其中,GRE 头部包含了源地址、目的地址、协议类型等字段,用于标识和路由数据包;IPSec 头部包含了安全参数索引(SPI)、目的网络地址等字段,用于实现数据包的加密和认证;数据部分则是待传输的实际数据。
【3.GRE over IPSec 的优点】GRE over IPSec 具有以下优点:1.提高安全性:通过使用 IPSec 协议,可以对数据包进行加密和认证,有效防止数据在传输过程中的泄露和篡改。
2.降低网络延迟:GRE over IPSec 采用隧道技术,将数据包封装在IPSec 隧道中,可以减少网络传输过程中的路由和处理时间,从而降低网络延迟。
3.支持多种网络协议:GRE 协议可以封装多种网络协议,如 IP、ATM 等,使得 GRE over IPSec 可以广泛应用于各种不同类型的网络环境中。
【4.GRE over IPSec 的应用场景】GRE over IPSec 广泛应用于以下场景:1.虚拟专用网(VPN):通过建立 GRE over IPSec 隧道,可以实现远程用户和公司内部网络之间的安全通信,实现虚拟专用网的功能。
GRE OVER IPSEC配置(第五组3月25日)
![GRE OVER IPSEC配置(第五组3月25日)](https://img.taocdn.com/s3/m/26c698ff700abb68a982fbcd.png)
GRE over IPSEC配置一、技术简介GRE over IPSec的外层ip就是公网的路由IP,GRE over IPSec,是将整个已经封装过的GRE数据包进行加密。
由于IPSec不支持对多播和广播数据包的加密,这样的话,使用IPSec的隧道中,动态路由协议等依靠多播和广播的协议就不能进行正常通告,所以,这时候要配合GRE隧道,GRE隧道会将多播和广播数据包封装到单播包中,再经过IPSec 加密。
此外由于GRE建立的是简单的,不进行加密的VPN隧道,他通过在物理链路中使用ip地址和路由穿越普通网络。
所以很常见的方法就是使用IPSec对GRE 进行加密,提供数据安全保证。
二、设备简介在总部与两个分部的出口路由器之间实施GRE over IPSec技术。
三、基本配置总部配置:Router#conf tRouter(config)#no ip do loRouter(config)#line con 0Router(config-line)#logg syRouter(config-line)#exec-t 0 0Router(config)#ho BJ-R-001BJ-R-001(config)#int lo 0BJ-R-001(config-if)#ip add 192.168.1.1 255.255.255.0 配置loopback口地址BJ-R-001(config-if)#int s0/0BJ-R-001(config-if)#ip add 12.12.12.1 255.255.255.0 配置接口地址BJ-R-001(config-if)#no shBJ-R-001(config-if)#exitBJ-R-001(config)#ip route 0.0.0.0 0.0.0.0 12.12.12.2 配置静态路由BJ-R-001(config)#crypto isakmp policy 10 定义isakmp策略BJ-R-001(config-isakmp)#hash md5BJ-R-001(config-isakmp)#encryption desBJ-R-001(config-isakmp)#group 2BJ-R-001(config-isakmp)#authentication pre-shareBJ-R-001(config-isakmp)#exitBJ-R-001(config)#crypto isakmp key 0 cisco address 23.23.23.3BJ-R-001(config)#crypto isakmp key 0 cisco address 24.24.24.4BJ-R-001(config)#crypto ipsec transform-set beijing esp-des esp-md5-hmac 设置转换集BJ-R-001(cfg-crypto-trans)#exitBJ-R-001(config)#crypto ipsec profile cisco 定义配置文件BJ-R-001(ipsec-profile)#set transform-set beijingBJ-R-001(ipsec-profile)#exitBJ-R-001(config)#int tunnel 0 配置tunnelBJ-R-001(config-if)#ip add 172.16.1.1 255.255.255.0BJ-R-001(config-if)#tunnel source s0/0BJ-R-001(config-if)#tunnel destination 23.23.23.3BJ-R-001(config-if)#tunnel mode ipsec ipv4BJ-R-001(config-if)#tunnel protection ipsec profile ciscoBJ-R-001(config-if)#no shBJ-R-001(config)#int tunnel 1BJ-R-001(config-if)#ip add 172.16.2.1 255.255.255.0 BJ-R-001(config-if)#tunnel source s0/0BJ-R-001(config-if)#tunnel destination 24.24.24.4BJ-R-001(config-if)#tunnel mode ipsec ipv4BJ-R-001(config-if)#tunnel protection ipsec profile cisco BJ-R-001(config-if)#no shBJ-R-001(config-if)#exitBJ-R-001(config)#router ospf 1BJ-R-001(config-router)#net 172.16.1.1 0.0.0.0 a 0BJ-R-001(config-router)#net 192.168.1.1 0.0.0.0 a 0BJ-R-001(config-router)#net 172.16.2.1 0.0.0.0 a 0BJ-R-001(config-router)#exit分部配置:Router>enRouter#conf tRouter(config)#no ip do loRouter(config)#line con 0Router(config-line)#logg synRouter(config-line)#exec-t 0 0Router(config-line)#exitRouter(config)#ho DL-R-001DL-R-001(config)#int s0/1DL-R-001(config-if)#ip add 23.23.23.3 255.255.255.0 DL-R-001(config-if)#no shDL-R-001(config-if)#ip add 192.168.2.1 255.255.255.0 DL-R-001(config-if)#exitDL-R-001(config)#ip route 0.0.0.0 0.0.0.0 23.23.23.2 DL-R-001(config)#crypto isakmp policy 10DL-R-001(config-isakmp)#hash md5DL-R-001(config-isakmp)#encryption desDL-R-001(config-isakmp)#group 2DL-R-001(config-isakmp)#authentication pre-shareDL-R-001(config-isakmp)#exitDL-R-001(config)#crypto isakmp key 0 cisco address 12.12.12.1DL-R-001(config)#crypto ipsec transform-set dalian esp-des esp-md5-hmac DL-R-001(cfg-crypto-trans)#exitDL-R-001(config)#crypto ipsec profile ciscoDL-R-001(ipsec-profile)#set transform-set dalianDL-R-001(ipsec-profile)#exitDL-R-001(config)#int tunnel 0DL-R-001(config-if)#ip add 172.16.1.2 255.255.255.0DL-R-001(config-if)#no shDL-R-001(config-if)#tunnel source s0/1DL-R-001(config-if)#tunnel destination 12.12.12.1DL-R-001(config-if)#tunnel mode ipsec ipv4DL-R-001(config-if)#tunnel protection ipsec profile ciscoDL-R-001(config-if)#exitDL-R-001(config)#router ospf 1DL-R-001(config-router)#net 192.168.2.1 0.0.0.0 a 0DL-R-001(config-router)#net 172.16.1.2 0.0.0.0 a 0DL-R-001(config-router)#exitRouter>enRouter#conf tRouter(config)#no ip do loRouter(config)#line con 0Router(config-line)#logg synRouter(config-line)#exec-t 0 0Router(config-line)#exitRouter(config)#ho KS-R-001KS-R-001(config-if)#ip add 192.168.3.1 255.255.255.0KS-R-001(config-if)#int s0/2KS-R-001(config-if)#ip add 24.24.24.4 255.255.255.0KS-R-001(config-if)#no shKS-R-001(config-if)#exitKS-R-001(config)#ip route 0.0.0.0 0.0.0.0 24.24.24.2KS-R-001(config)#crypto isakmp policy 10KS-R-001(config-isakmp)#hash md5KS-R-001(config-isakmp)#encryption desKS-R-001(config-isakmp)#group 2KS-R-001(config-isakmp)#authentication pre-shareKS-R-001(config-isakmp)#exitKS-R-001(config)#crypto isakmp key 0 cisco address 12.12.12.1KS-R-001(config)#crypto ipsec transform-set kunshan esp-des esp-md5-hmac KS-R-001(cfg-crypto-trans)#exitKS-R-001(config)#cry ipsec profile ciscoKS-R-001(ipsec-profile)#set transform-set kunshanKS-R-001(ipsec-profile)#exitKS-R-001(config)#int tunnel 0KS-R-001(config-if)#ip add 172.16.2.2 255.255.255.0KS-R-001(config-if)#no shKS-R-001(config-if)#tunnel source s0/2KS-R-001(config-if)#tunnel destination 12.12.12.1KS-R-001(config-if)#tunnel mode ipsec ipv4KS-R-001(config-if)#tunnel protection ipsec profile ciscoKS-R-001(config-if)#exitKS-R-001(config)#router ospf 1KS-R-001(config-router)#net 172.16.2.2 0.0.0.0 a 0 KS-R-001(config-router)#net 192.168.3.1 0.0.0.0 a 0 KS-R-001(config-router)#exit四、验证配置。
H3C v7版本 ipsec over gre配置指导
![H3C v7版本 ipsec over gre配置指导](https://img.taocdn.com/s3/m/d77cd41a83c4bb4cf7ecd1fe.png)
Ipsec over gre配置RT1和RT3用环回口来模拟私网上的接口。
它们的封装方式是先封装ipsec,然后在进行gre的封装,所以在ipsec的ACL中要匹配的事两端私网的地址。
报文的封装格式:指定Tunnel口源接口地址[H3C-Tunnel0]source 10.1.1.1指定Tunnel口目的端地址[H3C-Tunnel0]destination 20.1.1.2[H3C-Tunnel0] quit创建访问控制列表[H3C]acl advanced 3000[H3C-acl-ipv4-adv-3000]rule 0 permit ip source 192.168.1.1 0.0.0.0 destination 1 92.168.2.1 0.0.0.0[H3C-acl-ipv4-adv-3000]quit创建ipsec安全提议tran1[H3C]ipsec transform-set tran1指定安全协议的工作模式为隧道模式[H3C]ike profile profile1绑定ike keychain[H3C-ike-profile-profile1]keychain ike1配置本地封装的IP地址[H3C-ike-profile-profile1]local-identity address 100.1.1.1配置对端封装的IP地址[H3C-ike-profile-profile1]match remote identity address 100.1.1.2 24 [H3C-ike-profile-profile1]quit创建一条ike协商方式的ipsec安全策略,序列号为1,名字为policy1 [H3C]ipsec policy policy1 1 isakmp指定引用ACL3000[H3C-ipsec-policy-isakmp-policy1-1]security acl 3000[H3C-rip-1]network 10.1.1.1RT2的主要配置:<H3C>system-view[H3C]interface GigabitEthernet 0/0[H3C-GigabitEthernet0/0]ip address 10.1.1.2 24[H3C-GigabitEthernet0/0]quit[H3C]interface GigabitEthernet 0/1[H3C-GigabitEthernet0/1] ip address 20.1.1.1 24 [H3C-GigabitEthernet0/1]quit配置rip路由协议[H3C]rip[H3C-rip-1]version 2[H3C-rip-1]undo summary[H3C-rip-1]network 10.1.1.2指定Tunnel口源接口地址[H3C-Tunnel0]source 20.1.1.2指定Tunnel口目的端地址[H3C-Tunnel0]destination 10.1.1.1[H3C-Tunnel0] quit创建访问控制列表[H3C]acl advanced 3000[H3C-acl-ipv4-adv-3000]rule 0 permit ip source 192.168.2.1 0.0.0.0 destination 192.168.1.1 0.0.0.0[H3C-acl-ipv4-adv-3000]quit创建ipsec安全提议tran1[H3C]ipsec transform-set tran1指定安全协议的工作模式为隧道模式[H3C]ike profile profile1绑定ike keychain[H3C-ike-profile-profile1]keychain ike1配置本地封装的IP地址[H3C-ike-profile-profile1]local-identity address 100.1.1.2配置对端封装的IP地址[H3C-ike-profile-profile1]match remote identity address 100.1.1.1 24[H3C-ike-profile-profile1]quit创建一条ike协商方式的ipsec安全策略,序列号为1,名字为policy1[H3C]ipsec policy policy1 1 isakmp指定引用ACL3000[H3C-ipsec-policy-isakmp-policy1-1]security acl 3000[H3C-rip-1]network 20.1.1.2测试从RT1的环回口来ping RT3的环回口[H3C]ping -a 192.168.1.1 192.168.2.1Ping 192.168.2.1 (192.168.2.1) from 192.168.1.1: 56 data bytes, press CTRL_C to breakRequest time out56 bytes from 192.168.2.1: icmp_seq=1 ttl=255 time=2.000 ms56 bytes from 192.168.2.1: icmp_seq=2 ttl=255 time=2.000 ms 56 bytes from 192.168.2.1: icmp_seq=3 ttl=255 time=2.000 ms 56 bytes from 192.168.2.1: icmp_seq=4 ttl=255 time=1.000 ms 说明VPN建立成功。
IPsec over GRE 和GRE over IPsec
![IPsec over GRE 和GRE over IPsec](https://img.taocdn.com/s3/m/2472f481cc22bcd126ff0ca3.png)
IPsec over GRE 和GRE over IPsec比较和区别与配置GRE over IPsec & IPsec over GREI PSec -Over-GRE是先ipsec后gre,这种我没用过。
GRE -Over-IPSec 是先gre后ipsec,也就是说ipsec是最后的承载方式。
一般常用的就是这种,解决了ipsec不支持多播的问题。
另外在mtu上也有一些相关,gre是先分段后封装,而ipsec则是先封装再分段。
个人理解。
IPsec over GRE 和GRE over IPsec在配置上的区别:GRE over IPsec IPsec over GREACL定义:GRE数据流内网数据流IKE Peer中指定的remote-address 对方公网地址对方GRE Tunnel 地址应用端口:公网出口 GRE Tunnel上GRE over IPSEC(传输模式)IPSEC封装GRE好处:可以利用GRE封装组播或广播了以及非IP流量,因为如果不使用GRE的话,IPSEC 是传不了组播或广播IP流量的IPSEC over GRE(里外)(tunel模式)IPSEC over GRE:GRE在IPSEC外面,由GRE来封装IPSEC注意!!!IPSEC over GRE的时候,路由协议流量是明文的注意!!!当指的peer是对等体物理接口地址的时候不是IPSEC over GRE,只有当peer是对等体的lookback是才是真正的IPSEC over GREipsec over gre配置:crypto isakmp policy 10authentication pre-sharecrypto isakmp key cisco address 10.1.1.2!crypto ipsec transform-set myset esp-des esp-sha-hmac!crypto map mymap 10 ipsec-isakmpset peer 10.1.1.2set transform-set mysetmatch address 102!interface Serial0ip address 10.1.1.1 255.255.255.0clockrate 64000crypto map mymap!ip route 0.0.0.0 0.0.0.0 20.1.1.2ip route 40.1.1.0 255.255.255.0 Tunnel0!access-list 102 permit ip 1.1.1.0 0.0.0.255 1.1.2.0 0.0.0.255!interface Tunnel0ip address 100.1.1.1 255.255.255.0tunnel source Serial0tunnel destination 30.1.1.2crypto map mymapGRE OVER IPSEC的配置拓朴结构:R1 F0/0(172.16.1.1/24)->R2 F0/0(172.16.1.2/24) 模拟外网连接R1 F1/0(192.168.1.1/24)模拟内网1R2 F1/0(192.168.2.1/24)模拟内网2R1://定义IKE策略,用于阶段1的SA建立,系统会按对端协商的参数去查找我们定义的policy,直到找到一个各项参数都匹配的policy并使用之,如果没找到会在阶段1失败crypto isakmp policy 10hash md5authentication pre-sharelifetime 3600crypto isakmp key qhtest address 172.16.1.2!//这里定义阶段2所使用的SA,其所使用的加密密钥为随机,并使用阶段1所建立的SA来交换crypto ipsec transform-set myset esp-3des!//定义密码映射crypto map qh 10 ipsec-isakmpset peer 172.16.1.2set transform-set mysetmatch address 102//这里注意引用了访问列表102,这里对gre包进行加密,而不是如上一篇所做的那样是对内网地址段,实际上是去往内网2的数据包先被封装到GRE包里,再从外网接口出去,并被IPSET加密!//下面在接口上应用密码映射interface FastEthernet0/0ip address 172.16.1.1 255.255.255.0duplex fullcrypto map qh!//这里定义GRE隧道接口interface Tunnel0ip address 192.168.100.1 255.255.255.0tunnel source 172.16.1.1tunnel destination 172.16.1.2//由于GRE可以传路由协议,所有我们在隧道接口上启用了路由协议router ospf 100log-adjacency-changesredistribute connected subnetsnetwork 192.168.100.0 0.0.0.255 area 0//这里的访问列表我们定义了针对GRE的包施行IPSEC加密access-list 102 permit gre host 172.16.1.1 host 172.16.1.2R2:crypto isakmp policy 10hash md5authentication pre-sharelifetime 3600crypto isakmp key qhtest address 172.16.1.1!!crypto ipsec transform-set myset esp-3des!crypto map qh 10 ipsec-isakmpset peer 172.16.1.1set transform-set mysetmatch address 102!interface Tunnel0ip address 192.168.100.2 255.255.255.0tunnel source 172.16.1.2tunnel destination 172.16.1.1!interface FastEthernet0/0ip address 172.16.1.2 255.255.255.0duplex fullcrypto map qh!router ospf 100log-adjacency-changesredistribute connected subnetsnetwork 192.168.100.0 0.0.0.255 area 0!access-list 102 permit gre host 172.16.1.2 host 172.16.1.1IPSEC Over GRE与GRE Over IPSEC的区别和好处到底是IPSEC Over GRE好呢,还是GRE Over IPSEC好?以前一直是出于一个模糊的状态,能通就行了么。
RSR系列路由器GRE over IPSEC配置案例
![RSR系列路由器GRE over IPSEC配置案例](https://img.taocdn.com/s3/m/5c2c021da300a6c30c229f40.png)
network 172.16.1.0 0.0.0.255 area 0
�
如果此时用动态路由协议时【以 OSPF 路由协议为例】 ,千万不能将路由器互联的接口 IP 地址宣告进 OSPF【本案例中是 202.100.1.1】 ,否则会导致 OSPF 邻居关系抖动。 步骤三: 创建ISAKMP 策略
crypto isakmp policy 10 authentication pre-share crypto isakmp key 0 ruijie address 202.100.1.2
密级:受控
配置案例
! interface Loopback 1 ip address 2.2.2.2 255.255.255.255 ! interface Loopback 2 ip address 3.3.3.3 255.255.255.255 ! interface Tunnel 0 ip ref ip address 172.16.1.1 255.255.255.0 tunnel source 202.100.1.1 tunnel destination 202.100.1.2 ! ! ! ! ! ! ! ! ! router ospf 1 router-id 1.1.1.1 network 1.1.1.1 0.0.0.0 area 0 network 2.2.2.2 0.0.0.0 area 0 network 3.3.3.3 0.0.0.0 area 0 network 172.16.1.1 0.0.0.0 area 0 ! ! ! ! ! ! ! ref parameter 50 140 line con 0 line aux 0 line vty 0 4 login ! ! end Ruijie# 记录保存期限:2 年 锐捷网络机密,未经许可不得散 第 9页, 共 12页
greoveripsec原理和配置
![greoveripsec原理和配置](https://img.taocdn.com/s3/m/52d2e72df61fb7360b4c65eb.png)
g r e o v e r i p s e c原理和配置(总5页)-CAL-FENGHAI.-(YICAI)-Company One1-CAL-本页仅作为文档封面,使用请直接删除gre over ipsec这里首先补充一下知识吧:1.Ipsec中有2种封装模式:一种是隧道模式,一种是传输模式;当我们使用GRE OVER ipsec时,如果使用隧道模式的话,会多封装 20个字节的ESP头部,其与GRE添加的头部ip完全相同,故而,在GRE over ipsec 时,建议使用传输模式。
(主要是通讯点和传输点之间的关系)2.配置gre over ipsec的时候,可以选择两种的方法,这里都会介绍和给出配置,建议使用第二种方法。
3.第二种配置GRE over IPsec 的方式:profileProfile 可以看做是GRE tunnel中的一种保护机制,在使用profile时,无需配置感兴趣流,无需set peer,如下操作即可:第一种方法:R1:!hostname R1!crypto isakmp policy 10hash md5authentication pre-sharegroup 2crypto isakmp key zhang address!!crypto ipsec transform-set mytrans esp-3des esp-md5-hmac mode transport!crypto map mymap 10 ipsec-isakmpset peerset transform-set mytransmatch address VPN!!!!interface Tunnel0ip addresstunnel source FastEthernet0/0tunnel destinationtunnel key 123!interface Loopback10ip address!interface FastEthernet0/0ip addressduplex autospeed autocrypto map mymap!router ospf 1router-idlog-adjacency-changesnetwork area 0network area 0!ip access-list extended VPNpermit gre!EndR2配置:hostname R2!interface Loopback0ip address!interface FastEthernet0/0ip addressduplex autospeed auto!interface FastEthernet1/0ip addressduplex autospeed auto!EndR3配置:hostname R3!crypto isakmp policy 10hash md5authentication pre-sharegroup 2crypto isakmp key zhang address!!crypto ipsec transform-set mytrans esp-3des esp-md5-hmac mode transport!crypto map mymap 10 ipsec-isakmpset peerset transform-set mytransmatch address VPN!interface Tunnel0ip addresstunnel source FastEthernet0/0tunnel destinationtunnel key 123!interface Loopback10ip address!interface FastEthernet0/0ip addressduplex autospeed autocrypto map mymap!router ospf 1router-idlog-adjacency-changesnetwork area 0network area 0!no ip http serverno ip http secure-serverip route!ip access-list extended VPNpermit gre!End第二种方法:在1实验中的基础上,删徐mymap,access-list VPN,在接口上删徐map的应用。
思科GRE over IPSec VPN配置
![思科GRE over IPSec VPN配置](https://img.taocdn.com/s3/m/78c239830b1c59eef9c7b4d5.png)
一、隧道技术主机配置:1.vpc1set pcname VPC1 //更改主机名ip 10.1.1.1/24 10.1.1.100 //配置主机IP地址和网关2.vpc2set pcname VPC2 //更改主机名ip 20.1.1.1/24 20.1.1.100 //配置主机IP地址和网关配置路由协议(RIP):1.R1:/*基础配置*/R1(config )#int e0/0R1(config-if)#ip add 10.1.1.100 255.255.255.0R1(config-if)#no shutdownR1(config-if)#int e0/1R1(config-if)#ip add 12.1.1.1 255.255.255.0R1(config-if)#no shutdown/*路由协议配置*/R1(config)#router ripR1(config-router)#ver 2//版本2R1(config-router)#no au//关闭自动汇总R1(config-router)#net 12.0.0.0//宣告网段2.R2:/*基础配置*/R2(config )#int e0/0R2(config-if)#ip add 12.1.1.2 255.255.255.0R2(config-if)#no shutdownR2(config-if)#int e0/1R2(config-if)#ip add 23.1.1.2 255.255.255.0R2(config-if)#no shutdown/*路由协议配置*/R2(config)#router ripR2(config-router)#ver 2R2(config-router)#no auR2(config-router)#net 12.0.0.0R2(config-router)#net 23.0.0.03.R3:/*基础配置*/R3(config )#int e0/0R3(config-if)#ip add 23.1.1.3 255.255.255.0R3(config-if)#no shutdownR3(config-if)#int e0/1R3(config-if)#ip add 20.1.1.100 255.255.255.0R3(config-if)#no shutdown/*路由协议配置*/R3(config)#router ripR3(config-router)#ver 2R3(config-router)#no auR3(config-router)#net 23.0.0.0配置隧道:1.R1:R1(config)#interface tun 100//创建隧道R1(config-if)#ip add 13.1.1.1 255.255.255.0R1(config-if)#no shutdownR1(config-if)#tunnel source 12.1.1.1//指定隧道源地址R1(config-if)#tunnel destination 23.1.1.3//指定隧道目的地址R1(config)#ip route 0.0.0.0 0.0.0.0 13.1.1.3 //配置默认路由指向隧道2.R3:R3(config)#interface tun 1R3(config-if)#ip add 13.1.1.3 255.255.255.0R3(config-if)#no shutdownR3(config-if)#tunnel source 23.1.1.3R3(config-if)#tunnel destination 12.1.1.1R3(config)#ip route 0.0.0.0 0.0.0.0 13.1.1.1OSPF:Router ospf 1Net 13.1.1.1 0.0.0.0 area 0Net 10.1.1.100 0.0.0.0 ar0Net 20.1.1.100 0.0.0.0 ar0Router ospf 1Net 13.1.1.3 0.0.0.0 area 0Net 30.1.1.100 0.0.0.0 area0Net 40.1.1.100 0.0.0.0 area0第二大阶段:使用VPN保护隧道1.配置VPN,保护隧道:1)第一阶段配置:1 IPSec VPN的第一阶段策略R1(config)#crypto isakmp policy 10//创建策略集,优先级为10R1(config-isakmp)#encryption 3des//定义加密算法为3desR1(config-isakmp)#hash md5//定义HASH算法为MD5R1(config-isakmp)#authentication pre-share//认证方式选择预共享密钥R1(config-isakmp)#group 2//非对称加密算法长度,2表示1024的长度R1(config-isakmp)#exitR1(config)#crypto isakmp key cisco add 0.0.0.02)第二阶段配置:R1(config)#crypto ipsec transform-set 123 esp-3des esp-md5-hmacR1(cfg-crypto-trans)#mode transport //使用传输模式来保护隧道R1(config)#crypto ipsec profile vpn//创建第二阶段配置文件R1(ipsec-profile)#set transform-set 123//设置转换机R1(config-if)#int tunnel 1R1(config-if)#tunnel protection ipsec profile vpn//使用配置文件对隧道进行加密查看加密传输次数R1#show crypto engine connections active动态多点VPN:1、基础环境搭建1.)配置所有设备的IP地址2.)配置RIP协议R1-R2-R3-R4验证:R1 ping 23.1.1.3 和24.1.1.4 均可以通R4 ping 23.1.1.3 可以通2、MGRE的配置方式1.依然是隧道的配置R1:Int tunnel 123Ip add 123.1.1.1 255.255.255.0No shutTunnel source 12.1.1.1Tunnel mode gre multipointIp nhrp network-id 123R3:Int tunnel 123Ip add 123.1.1.3 255.255.255.0No shutTunnel source 23.1.1.3Tunnel mode gre multipointIp nhrp network-id 123R4:Int tunnel 123Ip add 123.1.1.4 255.255.255.0No shutTunnel source 24.1.1.4Tunnel mode gre multipointIp nhrp network-id 1233、NHRP(下一条解析协议)的配置中心点站配置R1:Ip nhrp map multicast dynamic //会把物理接口地址和隧道地址进行动态映射分支站点配置://物理借口地址为真实地址,隧道接口地址为虚拟地址虚真真虚R3:Ip nhrp map 123.1.1.1 12.1.1.1 //我将123.1.1.1映射到12.1.1.1Ip nhrp map multicast 12.1.1.1 //我们会从12.1.1.。
H3CMSR系列路由器IPsec典型配置举例(V7)
![H3CMSR系列路由器IPsec典型配置举例(V7)](https://img.taocdn.com/s3/m/459bd54484254b35effd342f.png)
7 相关资料1 简介本文档介绍IPsec的典型配置举例。
2 配置前提本文档适用于使用Comware V7软件版本的MSR系列路由器,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。
如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文档假设您已了解IPsec特性。
3 使用iNode客户端基于证书认证的L2TP over IPsec功能配置举例3.1 组网需求如图1所示,PPP用户Host与Device建立L2TP隧道,Windows server 2003作为CA服务器,要求:•通过L2TP隧道访问Corporate network。
•用IPsec对L2TP隧道进行数据加密。
•采用RSA证书认证方式建立IPsec隧道。
图1 基于证书认证的L2TP over IPsec配置组网图3.2 配置思路由于使用证书认证方式建立IPsec隧道,所以需要在ike profile中配置local-identity 为dn,指定从本端证书中的主题字段取得本端身份。
3.3 使用版本本举例是在R0106版本上进行配置和验证的。
3.4 配置步骤3.4.1 Device的配置(1) 配置各接口IP地址# 配置接口GigabitEthernet2/0/1的IP地址。
<Device> system-view[Device] interface gigabitethernet 2/0/1[Device-GigabitEthernet2/0/1] ip address 192.168.100.50 24[Device-GigabitEthernet2/0/1] quit# 配置接口GigabitEthernet2/0/2的IP地址。
[Device] interface gigabitethernet 2/0/2[Device-GigabitEthernet2/0/2] ip address 102.168.1.11 24[Device-GigabitEthernet2/0/2] quit# 配置接口GigabitEthernet2/0/3的IP地址。
h3c gre over ipsec配置
![h3c gre over ipsec配置](https://img.taocdn.com/s3/m/44ae44cc6137ee06eff918ae.png)
H3C配置gre ove ipsecRouter0:为端口分配ip地址interface GigabitEthernet0/0ip address 192.168.1.1 24配置ospf连通网络ospf 1area 0network 192.168.1.0 0.0.0.255配置gre隧道interface Tunnel1 mode greip address 10.0.0.1 24source 192.168.1.1destination 192.168.2.1配置acl 定义兴趣流量(在gre over ipsec应用中要设为两端物理接口地址)acl number 3000rule 0 permit gre source 192.168.1.1 0 destination 192.168.2.1 0配置ike对等体ike profile ike-namekeychain keychain-namematch remote identity address 192.168.2.1 24quitike keychain keychain-namepre-shared-key address 192.168.2.1 24 key cipher 123456配置ipsec安全提议ipsec transform-set transform-nameesp encryption-algorithm 3des-cbcesp authentication-algorithm sha1配置ike协商方式的ipsec安全策略ipsec policy policy-name 10 isakmptransform-set transform-namesecurity acl 3000remote-address 192.168.2.1ike-profile ike-name端口下应用策略interface GigabitEthernet0/0ipsec apply policy policy-nameRouter1:为端口分配ip地址interface GigabitEthernet0/0ip address 192.168.1.2 24quitinterface GigabitEthernet0/1ip address 192.168.2.2 24配置ospf连通网络ospf 1area 0network 192.168.1.0 0.0.0.255network 192.168.2.0 0.0.0.255Router2:为端口分配ip地址interface GigabitEthernet0/0ip address 192.168.2.1 24配置ospf连通网络ospf 1area 0network 192.168.2.0 0.0.0.255配置gre隧道interface Tunnel1 mode greip address 10.0.0.2 24source 192.168.2.1destination 192.168.1.1配置acl 定义兴趣流量(在gre over ipsec应用中要设为两端物理接口地址)acl number 3000rule 0 permit gre source 192.168.2.1 0 destination 192.168.1.1 0配置ike对等体ike profile ike-namekeychain keychain-namematch remote identity address 192.168.1.1 24quitike keychain keychain-namepre-shared-key address 192.168.1.1 24 key cipher 123456 配置ipsec安全提议ipsec transform-set transform-nameesp encryption-algorithm 3des-cbcesp authentication-algorithm sha1配置ike协商方式的ipsec安全策略ipsec policy policy-name 10 isakmptransform-set transform-namesecurity acl 3000remote-address 192.168.1.1ike-profile ike-name端口下应用策略interface GigabitEthernet0/0ipsec apply policy policy-name。
GRE Over IPSec+NAT经典配置
![GRE Over IPSec+NAT经典配置](https://img.taocdn.com/s3/m/bc47a241cf84b9d528ea7a6c.png)
GRE Over IPSec VPN+NAT配置
试验拓扑
试验要求
Site1和Site2分别模拟需要建立VPN通讯的两个站点,其中202.100.1.1和61.128.1.1 这两个地址分别为Site1和Site2的VPN加密点,1.1.1.0/24和2.2.2.0/24分别是Site1和Site2的内网地址,用来模拟VPN的通讯点。
要求Site1和Site2之间配置GRE Over IPSec VPN,使两个站点的内网之间通过VPN的方式加密传输,同时要求内网也可以访问互联网上的任何站点。
在配置GRE Over IPSec VPN时采用ISAKMP Profile+IPSEC Profile配置方法
在Site1上发起VPN流量:
在Sit2上查看VPN建立的情况:
以上测试说明现在两个站点之间的内网已经可以通过VPN的方式进行传输。
测试Site1访问互联网的情况:
可以看到内网目前无法访问互联网,原因是没有在Site1上配置NAT。
测试
再次测试两个站点之间内网通讯情况:
测试Site1访问Internet的通讯情况:
通过测试Site1和Site2内网之间可以通过VPN方式传输,同时也可以访问互联网,试验成功!。
GRE OVER IPSEC
![GRE OVER IPSEC](https://img.taocdn.com/s3/m/ea5c55dab14e852458fb5799.png)
第21 章GRE协议GRE协议介绍GRE(Generic Routing Encapsulation)是通用封装路由,是定义了在任意一种网络层协议上封装任意一个其它网络层协议的协议。
StoneOS 支持GRE over IPSec 功能,实现路由协议信息的安全传输。
GRE配置StoneOS 的GRE 配置包括:♦配置GRE 隧道♦绑定GRE 隧道到隧道接口配置GRE隧道GRE 隧道配置需要在GRE 隧道配置模式下进行。
进入GRE 隧道配置模式,在全局配置模式下,使用以下命令:tunnel gre gre-tunnel-name♦gre-tunnel-name –指定将要创建的GRE 隧道的名称。
执行该命令后,系统创建指定名称的GRE 隧道,并且进入GRE 隧道配置模式;如果指定的名称已存在,则直接进入GRE 隧道配置模式。
使用以上命令no 的形式删除指定的GRE 隧道:no tunnel gre gre-tunnel-name进入GRE 隧道配置模式后,用户需要为GRE 隧道配置以下参数:♦指定源接口/地址♦指定目的地址♦指定出接口♦指定IPSec VPN 隧道(可选)指定源地址为GRE 隧道指定源地址,在GRE 隧道配置模式下,使用以下命令:source {interface interface-name | ip-address }♦interface interface-name –指定接口的IP 地址为GRE 隧道的源地址。
通过interface-name 参数指定接口名称。
♦ip-address –为GRE 隧道指定源地址。
Hillstone山石网科多核安全网关使用手册332在GRE 隧道配置模式下使用该命令no 的形式取消源地址的配置:no source指定目的地址为GRE 隧道指定目的地址,在GRE 隧道配置模式下,使用以下命令:destination ip-address♦ip-address –为GRE 隧道指定目的地址。
GRE over IPSEC路由配置
![GRE over IPSEC路由配置](https://img.taocdn.com/s3/m/f6ad8089d4d8d15abe234ebd.png)
GRE over IPSEC路由配置GRE over IPSEC路由配置r1(0/0)——r2——(1/1)r3GRE over IPSEC先ipsec在gre解决了ipsec无法传递多播流量问题,即可以在ipsec中跑路由协议,而且协议是通过加密的!!R1:crypto isakmp policy 10 hash md5 authentication pre-share crypto isakmp key zaq address 2.3.0.1!crypto ipsec transform-set vpn esp-des!crypto map vpn 10 ipsec-isakmp set peer 2.3.0.1 set transform-set vpn match address 101!interface Tunnel0 ip address 1.3.0.1 255.255.255.0 tunnel source FastEthernet0/0 tunnel destination 2.3.0.1!interface Loopback0 ip address 1.1.1.1 255.255.255.255!interface Loopback1 ip address 10.0.0.1 255.255.255.0!interface FastEthernet0/0 ip address 1.2.0.1 255.255.255.0 duplex full crypto map vpn!router ospf 1 log-adjacency-changes!ip route 0.0.0.0 0.0.0.0 1.2.0.2!access-list 101 permit gre host 1.2.0.1 host 2.3.0.1R2:interface FastEthernet0/0 ip address 1.2.0.2 255.255.255.0 duplex full!interface FastEthernet1/1 ip address 2.3.0.2 255.255.255.0 duplex full speed autoR3:crypto isakmp policy 10 hash md5 authentication pre-share crypto isakmp key zaq address 1.2.0.1!crypto ipsec transform-set vpn esp-des!crypto map vpn 10 ipsec-isakmp set peer 1.2.0.1 set transform-set vpn match address 101!interface Tunnel0 ip address 1.3.0.2 255.255.255.0 tunnel source FastEthernet1/1 tunnel destination 1.2.0.1!interface Loopback0 ip address 3.3.3.3 255.255.255.255!interface Loopback1 ip address 30.0.0.1 255.255.255.0!interface FastEthernet1/1 ip address 2.3.0.1 255.255.255.0 duplex full speed auto crypto map vpn!ip route 0.0.0.0 0.0.0.0 2.3.0.2!access-list 101 permit gre host 2.3.0.1 host 1.2.0.1Router#show crypto engine connections active IDInterface IP-Address State Algorithm Encrypt Decrypt 1FastEthernet1/1 2.3.0.1 set HMAC_MD5+DES_56_CB 0 0 2001FastEthernet1/1 2.3.0.1 set DES 0 27 2002FastEthernet1/1 2.3.0.1 set DES 27 0 Router#show crypto isakmp sadst src state conn-id slot status 1.2.0.1 2.3.0.1 QM_IDLE 1 0 ACTIVE Router#show crypto isakmp peers Peer:1.2.0.1 Port:500 Local:2.3.0.1 Phase1 id:1.2.0.1 Router#show crypto ipsec sa interface:FastEthernet1/1 Crypto map tag:vpn,local addr 2.3.0.1 protected vrf:(none)local ident (addr/mask/prot/port):(2.3.0.1/255.255.255.255/47/0)remote ident (addr/mask/prot/port):(1.2.0.1/255.255.255.255/47/0)current_peer 1.2.0.1 port 500 PERMIT,flags={origin_is_acl,} #pkts encaps:44,#pkts encrypt:44,#pkts digest:44 #pkts decaps:44,#pkts decrypt:44,#pkts verify:44 #pkts compressed:0,#pkts decompressed:0 #pkts not compressed:0,#pkts compr. failed:0 #pkts not decompressed:0,#pkts decompress failed:0 #send errors 1,#recv errors 0 local crypto endpt.:2.3.0.1,remote crypto endpt.:1.2.0.1 path mtu 1500,ip mtu 1500,ip mtu idb FastEthernet1/1 current outbound spi:0xEAA8551D(3936900381)inbound esp sas:spi:0x323BE771(842786673)transform:esp-des ,in use settings ={Tunnel,} conn id:2001,flow_id:1,crypto map:vpn sa timing:remaining key lifetime (k/sec):(4493451/2885)IV size:8 bytes replay detection support:N Status:ACTIVE inbound ah sas:inbound pcp sas:outbound esp sas:spi:0xEAA8551D(3936900381)transform:esp-des ,in use settings ={Tunnel,} conn id:2002,flow_id:2,crypto map:vpn sa timing:remaining key lifetime (k/sec):(4493451/2884)IV size:8 bytes replay detection support:N Status:ACTIVE outbound ah sas:outbound pcp sas:还有一种是ipsec over gre 个人认为没有意义,因为虽然解决了多播问题,但是多播是明文传输,所以ipsec就没有意义了,还不如直接用gre就好了!!。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
路由器-GRE-Over-IPSec典型配置【需求】分部1和分部2通过野蛮IPSec的方式连接到中心,采用GRE-Over-IPSec的方式,在tunnel上运行OSPF协议来实现总部和分部之间的互通。
【组网图】【验证】1、中心上的ike sa 状态:disp ike saconnection-id peer flag phase doi----------------------------------------------------------4 202.101.3.2 RD 1 IPSEC5 202.101.3.2 RD 2 IPSEC2 202.101.2.2 RD 1 IPSEC3 202.101.2.2 RD 2 IPSEC flag meaningRD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO—TIMEOUT 2、中心上的IPSec sa状态:disp ipsec sa===============================Interface: Serial2/0/0path MTU: 1500===============================-----------------------------IPsec policy name: "center"sequence number: 10mode: isakmp-----------------------------connection id: 3encapsulation mode: tunnelperfect forward secrecy: Nonetunnel:local address: 202.101.1.2remote address: 202.101.2.2flow: (72 times matched)sour addr: 202.101.1.2/255.255.255.255 port: 0 protocol: GRE dest addr: 202.101.2.2/255.255.255.255 port: 0 protocol: GRE [inbound ESP SAs]spi: 1168206412 (0x45a16a4c)proposal: ESP-ENCRYPT-DES ESP-AUTH-MD5sa remaining key duration (bytes/sec): 1887434028/3365max received sequence-number: 33udp encapsulation used for nat traversal: N[outbound ESP SAs]spi: 2150942891 (0x8034c8ab)proposal: ESP-ENCRYPT-DES ESP-AUTH-MD5sa remaining key duration (bytes/sec): 1887433260/3365max sent sequence-number: 36udp encapsulation used for nat traversal: N-----------------------------IPsec policy name: "center"sequence number: 20mode: isakmp-----------------------------connection id: 4encapsulation mode: tunnelperfect forward secrecy: Nonetunnel:local address: 202.101.1.2remote address: 202.101.3.2flow: (73 times matched)sour addr: 202.101.1.2/255.255.255.255 port: 0 protocol: GRE dest addr: 202.101.3.2/255.255.255.255 port: 0 protocol: GRE [inbound ESP SAs]spi: 2624895419 (0x9c74b9bb)proposal: ESP-ENCRYPT-DES ESP-AUTH-MD5sa remaining key duration (bytes/sec): 1887433796/3385max received sequence-number: 35udp encapsulation used for nat traversal: N[outbound ESP SAs]spi: 1281853764 (0x4c678944)proposal: ESP-ENCRYPT-DES ESP-AUTH-MD5sa remaining key duration (bytes/sec): 1887432856/3385max sent sequence-number: 39udp encapsulation used for nat traversal: N3、中心路由表disp ip routRouting Table: public netDestination/Mask Protocol Pre Cost Nexthop Interface0.0.0.0/0 STATIC 60 0 202.101.1.1 Serial2/0/01.1.1.1/32 DIRECT 0 0 127.0.0.1 InLoopBack02.2.2.2/32 OSPF 10 1563 10.0.0.2 Tunnel03.3.3.3/32 OSPF 10 1563 10.0.0.6 Tunnel110.0.0.0/30 DIRECT 0 0 10.0.0.1 Tunnel010.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0 10.0.0.4/30 DIRECT 0 0 10.0.0.5 Tunnel110.0.0.5/32 DIRECT 0 0 127.0.0.1 InLoopBack0 127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0 127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0 192.168.1.0/24 DIRECT 0 0 192.168.1.1 LoopBack10 192.168.1.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0 192.168.2.0/24 OSPF 10 1563 10.0.0.2 Tunnel0192.168.3.0/24 OSPF 10 1563 10.0.0.6 Tunnel1202.101.1.0/30 DIRECT 0 0 202.101.1.2 Serial2/0/0 202.101.1.1/32 DIRECT 0 0 202.101.1.1 Serial2/0/0 202.101.1.2/32 DIRECT 0 0 127.0.0.1 InLoopBack0 4、分部1的ike sa状态:disp ike saconnection-id peer flag phase doi----------------------------------------------------------2 202.101.1.2 RD|ST 1 IPSEC3 202.101.1.2 RD|ST 2 IPSECflag meaningRD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO—TIMEOUT5、分部1的ipsec sa状态:disp ipsec sa===============================Interface: Serial2/0/0path MTU: 1500===============================-----------------------------IPsec policy name: "branch1"sequence number: 10mode: isakmp-----------------------------connection id: 3encapsulation mode: tunnelperfect forward secrecy: Nonetunnel:local address: 202.101.2.2remote address: 202.101.1.2flow: (82 times matched)sour addr: 202.101.2.2/255.255.255.255 port: 0 protocol: GREdest addr: 202.101.1.2/255.255.255.255 port: 0 protocol: GRE [inbound ESP SAs]spi: 2150942891 (0x8034c8ab)proposal: ESP-ENCRYPT-DES ESP-AUTH-MD5sa remaining key duration (bytes/sec): 1887433256/3293max received sequence-number: 42udp encapsulation used for nat traversal: N[outbound ESP SAs]spi: 1168206412 (0x45a16a4c)proposal: ESP-ENCRYPT-DES ESP-AUTH-MD5sa remaining key duration (bytes/sec): 1887432880/3293max sent sequence-number: 41udp encapsulation used for nat traversal: N6、分部1的路由表:disp ip routRouting Table: public netDestination/Mask Protocol Pre Cost Nexthop Interface0.0.0.0/0 STATIC 60 0 202.101.2.1 Serial2/0/01.1.1.1/32 OSPF 10 1563 10.0.0.1 Tunnel02.2.2.2/32 DIRECT 0 0 127.0.0.1 InLoopBack03.3.3.3/32 OSPF 10 3125 10.0.0.1 Tunnel010.0.0.0/30 DIRECT 0 0 10.0.0.2 Tunnel010.0.0.2/32 DIRECT 0 0 127.0.0.1 InLoopBack0 10.0.0.4/30 OSPF 10 3124 10.0.0.1 Tunnel0127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0 127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0 192.168.1.0/24 OSPF 10 1563 10.0.0.1 Tunnel0192.168.2.0/24 DIRECT 0 0 192.168.2.1 LoopBack10 192.168.2.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0 192.168.3.0/24 OSPF 10 3125 10.0.0.1 Tunnel0202.101.2.0/30 DIRECT 0 0 202.101.2.2 Serial2/0/0 202.101.2.1/32 DIRECT 0 0 202.101.2.1 Serial2/0/0 202.101.2.2/32 DIRECT 0 0 127.0.0.1 InLoopBack0 【提示】1、IPSec-Over-GRE和GRE-Over-IPSec方式配置上的区别为:2、各个分部和总部之间通过OSPF路由来实现互访,如果没有运行OSPF则必需在分部和总部配置静态路由。