乐于分享
好东西不私藏

总部采用策略模板的方式进行建立GRE OVER IPSEC

总部采用策略模板的方式进行建立GRE OVER IPSEC
一、【引言】
本期为GRE OVER IPSEC实验
二、【组网需求】

1、分支1和分支2为企业分支网关(分支1和分钟2使用动态地址接入公网),ZB为企业总部网关,总部提供固定公网IP:100.1.1.1/24,分支与总部通过公网建立通信。

2、企业希望对分支与总部之间相互访问的流量进行安全保护,并且为了安全起见,总部网关能指定符合条件的分支网关接入。

3、由于分支与总部通过公网建立通信,可以在分支网关与总部网关之间建立IPSec隧道来实施安全保护。

三、【IP规划】
接口
IP地址
备注
总部
Tunnel1
10.10.11.1/30
与分支1互联
Tunnel2
10.10.12.1/30
与分支2互联
Lo0
192.168.255.1/32
OSPF RID
Lo2
192.168.1.1/24
模拟业务
G0/0
100.1.1.1/24
公网接口
分支1
Tunnel0
10.10.11.2/30
与总部互联
Lo0
192.168.255.2/32
OSPF RID
Lo2
192.168.2.1/24
模拟业务
G0/0
DHCP
公网接口
分支2
Tunnel0
10.10.12.2/30
与总部互联
Lo0
192.168.255.3/32
OSPF RID
Lo2
192.168.3.1/24
模拟业务
G0/0
DHCP
公网接口
ISP
G0/0(vlan10)
100.1.1.254/24
与总部互联
G0/2(vlan 20)
100.1.2.254/24
与分支1互联
G0/3(vlan 30)
100.1.3.254/24
与分支2互联
Lo202
200.1.1.1/24
模拟公网
四、【组网及说明】:
五、【配置】
总部配置:
 sysname ZB#ospf 1 router-id 192.168.255.1 area 0.0.0.0  network 10.10.11.0 0.0.0.3  network 10.10.12.0 0.0.0.3  network 192.168.1.0 0.0.0.255#interface LoopBack0 ip address 192.168.255.1 255.255.255.255#interface LoopBack2 ip address 192.168.1.1 255.255.255.0#interface GigabitEthernet0/0 port link-mode route combo enable copper ip address 100.1.1.1 255.255.255.0 nat outbound ipsec apply policy ZB#interface Tunnel1 mode gre ip address 10.10.11.1 255.255.255.252 source LoopBack0 destination 192.168.255.2 keepalive 10 3#interface Tunnel2 mode gre ip address 10.10.12.1 255.255.255.252 source LoopBack0 destination 192.168.255.3 keepalive 10 3# ip route-static 0.0.0.0 0 100.1.1.254#ipsec transform-set ZB esp encryption-algorithm 3des-cbc  esp authentication-algorithm sha1 #ipsec policy-template FZ 1 transform-set ZB  ike-profile FZ1#ipsec policy-template FZ 2 transform-set ZB  ike-profile FZ2#ipsec policy ZB 1 isakmp template FZ# ike identity fqdn ZB#ike profile FZ1 keychain FZ1 exchange-mode aggressive local-identity fqdn ZB match remote identity fqdn FZ1 proposal 1 #ike profile FZ2 keychain FZ2 exchange-mode aggressive local-identity fqdn ZB match remote identity fqdn FZ2 proposal 1 #ike proposal 1   //IKE安全提议,可不配置 encryption-algorithm 3des-cbc dh group14 authentication-algorithm md5#ike keychain FZ1  // pre-shared-key hostname FZ1 key simple 123ike keychain FZ2 // pre-shared-key hostname FZ2 key simple 123return
ISP配置:
 sysname ISP# dhcp enable# lldp global enable#vlan 1#vlan 10#vlan 20        #vlan 30# stp global enable#dhcp server ip-pool 20 gateway-list 100.1.2.254 network 100.1.2.0 mask 255.255.255.0 dns-list 223.5.5.5#dhcp server ip-pool 30 gateway-list 100.1.3.254 network 100.1.3.0 mask 255.255.255.0 dns-list 223.5.5.5#interface LoopBack0 ip address 200.1.1.1 255.255.255.0  description  ISP #interface Vlan-interface10 ip address 100.1.1.254 255.255.255.0#              interface Vlan-interface20 ip address 100.1.2.254 255.255.255.0 dhcp server apply ip-pool 20#interface Vlan-interface30 ip address 100.1.3.254 255.255.255.0 dhcp server apply ip-pool 30#interface GigabitEthernet1/0/1 port link-mode bridge port access vlan 10 combo enable fiber#interface GigabitEthernet1/0/2 port link-mode bridge port access vlan 20 combo enable fiber#interface GigabitEthernet1/0/3 port link-mode bridge port access vlan 30 combo enable fiber# ip route-static 0.0.0.0 0 100.1.1.1#return
分支1配置:
<FZ1>dis cu# sysname FZ1#ospf 1 router-id 192.168.255.2 area 0.0.0.0  network 10.10.11.0 0.0.0.3  network 192.168.2.0 0.0.0.255#interface LoopBack0 ip address 192.168.255.2 255.255.255.255#interface LoopBack2 ip address 192.168.2.1 255.255.255.0#interface GigabitEthernet0/0 port link-mode route combo enable copper ip address dhcp-alloc ipsec apply policy FZ1#interface Tunnel0 mode gre ip address 10.10.11.2 255.255.255.252 source LoopBack0 destination 192.168.255.1 keepalive 10 3#acl advanced 3000 rule 0 permit ip source 192.168.255.2 0 destination 192.168.255.1 0#ipsec transform-set FZ1 esp encryption-algorithm 3des-cbc  esp authentication-algorithm sha1 #ipsec policy FZ1 1 isakmp transform-set FZ1  security acl 3000  remote-address 100.1.1.1 ike-profile FZ1# ike identity fqdn FZ1#ike profile FZ1 keychain FZ1 exchange-mode aggressive local-identity fqdn FZ1 match remote identity fqdn ZB proposal 1 #ike proposal 1 encryption-algorithm 3des-cbc dh group14 authentication-algorithm md5#ike keychain FZ1 pre-shared-key address 100.1.1.1 255.255.255.0 key simple 123
分支2配置:
<FZ2>dis cu# sysname FZ2#ospf 1 router-id 192.168.255.3 area 0.0.0.0  network 10.10.12.0 0.0.0.3  network 192.168.3.0 0.0.0.255#interface LoopBack0 ip address 192.168.255.3 255.255.255.255#interface LoopBack2 ip address 192.168.3.1 255.255.255.0#interface GigabitEthernet0/0 port link-mode route combo enable copper ip address dhcp-alloc ipsec apply policy FZ2#interface Tunnel0 mode gre ip address 10.10.12.2 255.255.255.252 source LoopBack0 destination 192.168.255.1 keepalive 10 3#acl advanced 3000 rule 0 permit ip source 192.168.255.3 0 destination 192.168.255.1 0#ipsec transform-set FZ2 esp encryption-algorithm 3des-cbc  esp authentication-algorithm sha1 #ipsec policy FZ2 1 isakmp transform-set FZ2  security acl 3000  remote-address 100.1.1.1 ike-profile FZ2# ike identity fqdn FZ2#ike profile FZ2 keychain FZ2 exchange-mode aggressive local-identity fqdn FZ2 match remote identity fqdn ZB proposal 1 #ike proposal 1 encryption-algorithm 3des-cbc dh group14 authentication-algorithm md5#ike keychain FZ2 pre-shared-key address 100.1.1.1 255.255.255.0 key simple 123#
六、【验证】
1、检查ike状态:
总部:
分支1:
分支2:
2、检查IPSec状态:
总部:
分支1::
分支2:
3、总部查看OSPF邻居
分支1:
分支2:
4、查看OSPF路由表:
总部
分支1:
分支2: