华三(H3C)GRE OVER IPsec实验

实验拓扑

目录

实验需求

1. 某企业北京总部、上海分支、武汉分支分别通过 R1,R3,R4 接入互联网,配置默认路由连通公网

2. 按照图示配置 IP 地址,R1,R3,R4 分别配置 Loopback0 口匹配感兴趣流,Loopback1 口模拟业务网段

3. 北京总部拥有固定公网地址,在 R2 上配置 DHCP,对 R3 和 R4 动态分配 IP 地址,IP 地址网段如图

4. 北京总部、上海分支、武汉分支配置 GRE over IPsec VPN 连通内网,要求北京总部使用模板来简化配置

5. 总部和分支之间配置 RIPv2 传递内网路由

实验解法

1.配置各设备IP地址

2.配置默认路由

3.配置DHCP

2.配置DHCP地址池

3.在R3、R4上,开启端口获取DHCP地址。

4.配置 GRE over IPsec  VPN

(2)在 R3 上配置 GRE over IPsec VPN

(3)在 R4 上配置 GRE over IPsec VPN

5. 配置 RIP

最后查询


实验需求

1. 某企业北京总部、上海分支、武汉分支分别通过 R1,R3,R4 接入互联网,配置默认路由连通公网

2. 按照图示配置 IP 地址,R1,R3,R4 分别配置 Loopback0 口匹配感兴趣流,Loopback1 口模拟业务网段

3. 北京总部拥有固定公网地址,在 R2 上配置 DHCP,对 R3 和 R4 动态分配 IP 地址,IP 地址网段如图

4. 北京总部、上海分支、武汉分支配置 GRE over IPsec VPN 连通内网,要求北京总部使用模板来简化配置

5. 总部和分支之间配置 RIPv2 传递内网路由

实验解法

1.配置各设备IP地址

R1

[H3C]sysn R1
[R1]int g0/0
[R1-GigabitEthernet0/0]ip add 100.1.1.1 24
[R1-GigabitEthernet0/0]int l0
[R1-LoopBack0]ip add 10.10.10.1 32
[R1-LoopBack0]int l1
[R1-LoopBack1]ip add 192.168.0.1 24
[R1-LoopBack1]int tunnel 0 mode gre
[R1-Tunnel0]ip add 10.1.1.1 24
[R1-Tunnel0]int tunnel 1 mode gre 
[R1-Tunnel1]ip add 10.2.2.1 24

R2

[H3C]sysn R2
[R2]int g0/0
[R2-GigabitEthernet0/0]ip add 100.1.1.2 24
[R2-GigabitEthernet0/0]int g0/1
[R2-GigabitEthernet0/1]ip add 100.2.2.2 24
[R2-GigabitEthernet0/1]int g0/2
[R2-GigabitEthernet0/2]ip add 100.3.3.2 24

R3

[H3C]sysn R3
[R3]int l0
[R3-LoopBack0]ip add 10.10.10.3 32
[R3-LoopBack0]int l1
[R3-LoopBack1]ip add 192.168.1.1 24
[R3-LoopBack1]int tunnel 0 mode gre
[R3-Tunnel0]ip add 10.1.1.3 24

R4

[H3C]sysn R4
[R4]int l0
[R4-LoopBack0]ip add 10.10.10.4 32
[R4-LoopBack0]int l1
[R4-LoopBack1]ip add 192.168.2.1 24
[R4-LoopBack1]int tunnel 1 mode gre
[R4-Tunnel1]ip add 10.2.2.4 24

2.配置默认路由

为R1配置默认路由,使全网可通

[R1]ip route-static 0.0.0.0 0 100.1.1.2

为R3配置默认路由,使全网可通

[R3]ip route-static 0.0.0.0 0 100.2.2.2

为R4配置默认路由,使全网可通

[R4]ip route-static 0.0.0.0 0 100.3.3.2

3.配置DHCP

在R2上配置DHCP,模拟运营商分配IP地址给R3、R4

1.开启DHCP服务

[R2]dhcp enable
[R2]int g0/1
[R2-GigabitEthernet0/1]dhcp select server
[R2-GigabitEthernet0/1]int g0/2
[R2-GigabitEthernet0/2]dhcp select server

2.配置DHCP地址池

[R2]dhcp server ip-pool 1
[R2-dhcp-pool-1]network 100.2.2.0 mask 255.255.255.0
[R2-dhcp-pool-1]gateway-list 100.2.2.2
[R2-dhcp-pool-1]dhcp server ip-pool 2
[R2-dhcp-pool-2]network 100.3.3.0 mask 255.255.255.0
[R2-dhcp-pool-2]gateway-list 100.3.3.2

3.在R3、R4上,开启端口获取DHCP地址。

R3

[R3]int g0/0
[R3-GigabitEthernet0/0]ip add dhcp-alloc

R4

[R4]int g0/0
[R4-GigabitEthernet0/0]ip address dhcp-alloc

检查在R2上是否能查看到已分配IP地址。

4.配置 GRE over IPsec  VPN

步骤1:在 R1 上配置 GRE over IPsec VPN 

在 R1 上配置GRE tunnel 口,指定源目IP为双方 LoopBack 口

[R1]interface tunnel0
[R1-Tunnel0]source LoopBack 0
[R1-Tunnel0]destination 10.10.10.3
[R1-Tunnel0]int tunnel1
[R1-Tunnel1]source l
[R1-Tunnel1]source LoopBack 0
[R1-Tunnel1]destination 10.10.10.4

步骤2:在 R1 上配置 FQDN 名为 zb

[R1]ike identity fqdn zb

步骤3:在 R1 上创建 IKE 提议,使用默认配置即可

[R1-ike-profile-1]ike proposal 1

步骤4:在R1上创建IKE预共享密钥

[R1]ike keychain fz
[R1-ike-keychain-sh]pre-shared-key hostname fz1 key simple 123
[R1-ike-keychain-sh]pre-shared-key hostname fz2 key simple 123

步骤5:在R1上创建IKE Profile

[R1-ike-keychain-fz]ike profile fz1
[R1-ike-profile-fz1]exchange-mode aggressive 
[R1-ike-profile-fz1]match remote identity fqdn fz1
[R1-ike-profile-fz1]priority 1
[R1-ike-profile-fz1]keychain fz

[R1]ike profile fz2
[R1-ike-profile-fz2]exchange-mode aggressive 
[R1-ike-profile-fz2]match remote identity fqdn fz2
[R1-ike-profile-fz2]proposal 1
[R1-ike-profile-fz2]keychain fz

步骤6:在 R1 上创建 IPsec 转换集,对两个分支可以使用同一个转换集

[R1]ipsec transform-set fz
[R1-ipsec-transform-set-sh]esp authentication-algorithm sha1
[R1-ipsec-transform-set-sh]esp encryption-algorithm aes-cbc-128
[R1-ipsec-transform-set-sh]quit

步骤7:在 R1 上分别创建对上海和武汉分支的 IPsec 策略模板

[R1]ipsec policy-template fz1 1
[R1-ipsec-policy-template-fz1-1]transform-set fz
[R1-ipsec-policy-template-fz1-1]ike-profile fz1
[R1-ipsec-policy-template-fz1-1]quit

[R1]ipsec policy-template fz2 1
[R1-ipsec-policy-template-fz2-1]transform-set fz
[R1-ipsec-policy-template-fz2-1]ike-profile fz2

步骤8:在R1上创建IPsec策略,绑定两个模板

[R1]ipsec policy fz1 isakmp template fz1
[R1]ipsec policy fz2 isakmp template fz2

步骤9:在 R1 的公网接口上下发 IPsec 策略

[R1]interface g0/0
[R1-GigabitEthernet0/0]ipsec apply policy fz

(2)在 R3 上配置 GRE over IPsec VPN

1.在 R3 上配置 GRE Tunnel 口

[R3]int Tunnel0
[R3-Tunnel0]source LoopBack 0
[R3-Tunnel0]destination 10.10.10.1

2. 配置ACL

[R3]acl advanced 3000
[R3-acl-ipv4-adv-3000]rule permit ip source 10.10.10.3 0 destination 10.10.10.1 0

3. 在R3上配置FQDN名为fz1

[R3]ike identity fqdn fz1

4. 在R3上创建IKE提议

[R3]ike proposal 1

5. 在 R3 上创建 IKE 预共享密钥,匹配对端公网地址

[R3]ike keychain zb
[R3-ike-keychain-zb]pre-shared-key address 100.1.1.1 key simple 123

6.在 R3 上创建 IKE Profile

[R3]ike profile zb
[R3-ike-profile-zb]exchange-mode agg
[R3-ike-profile-zb]match remote identity fqdn zb
[R3-ike-profile-zb]proposal 1
[R3-ike-profile-zb]keychain zb

7. R3 上创建 IPsec 转换集

[R3]ipsec transform-set zb
[R3-ipsec-transform-set-zb]esp authentication-algorithm sha1
[R3-ipsec-transform-set-zb]esp encryption-algorithm aes-cbc-128

8. 在 R3 上创建 IPsec 策略

[R3]ipsec policy zb 1 isakmp 
[R3-ipsec-policy-isakmp-zb-1]security acl 3000
[R3-ipsec-policy-isakmp-zb-1]remote-address 100.1.1.1
[R3-ipsec-policy-isakmp-zb-1]ike-profile zb
[R3-ipsec-policy-isakmp-zb-1]transform-set zb

9. 在 R3 的公网接口上下发 IPsec 策略

[R3]int g0/0
[R3-GigabitEthernet0/0]ipsec apply policy zb

(3)在 R4 上配置 GRE over IPsec VPN

1.在 R4 上配置 GRE Tunnel 口

[R4]in tunnel0
[R4-Tunnel0]source l0
[R4-Tunnel0]destination 10.10.10.1

2. 配置ACL

[R4]acl advanced 3000
[R4-acl-ipv4-adv-3000]rule permit ip source 10.10.10.4 0 destination 10.10.10.1 0

3. 在 R4 上配置 FQDN 名为 fz2

[R4]ike identity fqdn fz2

4. 在 R4 上创建 IKE 提议

[R4]ike proposal 1

5. 在 R4 上创建 IKE 预共享密钥,匹配对端公网地址

[R4]ike keychain zb
[R4-ike-keychain-zb]pre-shared-key address 100.1.1.1 key simple 123

6.在 R4 上创建 IKE Profile

[R4]ike profile zb
[R4-ike-profile-zb]exchange-mode aggressive 
[R4-ike-profile-zb]match remote identity fqdn zb
[R4-ike-profile-zb]proposal 1
[R4-ike-profile-zb]keychain zb

7.在 R4 上创建 IPsec 转换集

[R4]ipsec transform-set zb
[R4-ipsec-transform-set-zb]esp authentication-algorithm sha1
[R4-ipsec-transform-set-zb]esp encryption-algorithm aes-cbc-128

8.在 R4 上创建 IPsec 策略

[R4]ipsec policy zb 1 isakmp
[R4-ipsec-policy-isakmp-zb-1]sec
[R4-ipsec-policy-isakmp-zb-1]security acl 3000
[R4-ipsec-policy-isakmp-zb-1]remote-add
[R4-ipsec-policy-isakmp-zb-1]remote-address 100.1.1.1
[R4-ipsec-policy-isakmp-zb-1]ike-
[R4-ipsec-policy-isakmp-zb-1]ike-profile zb
[R4-ipsec-policy-isakmp-zb-1]trans
[R4-ipsec-policy-isakmp-zb-1]transform-set zb

9.在 R4 的公网接口上下发 IPsec 策略

[R4]int g0/0
[R4-GigabitEthernet0/0]ipsec app
[R4-GigabitEthernet0/0]ipsec apply poli
[R4-GigabitEthernet0/0]ipsec apply policy zb

5. 配置 RIP

1.在 R1,R3,R4 上分别配置 RIPv2,宣告 Tunnel 口网段和各自业务网段

R1

[R1]rip 
[R1-rip-1]v 2
[R1-rip-1]undo sum
[R1-rip-1]net 192.168.0.1 0.0.0.255
[R1-rip-1]net 10.1.1.0 0.0.0.255
[R1-rip-1]net 10.2.2.0 0.0.0.255

R2

[R3]rip 
[R3-rip-1]v 2
[R3-rip-1]undo sum
[R3-rip-1]net 192.168.1.0 0.0.0.255
[R3-rip-1]net 10.1.1.0 0.0.0.255

R3

[R4]rip
[R4-rip-1]v 2
[R4-rip-1]undo sum
[R4-rip-1]net 192.168.2.0 0.0.0.255
[R4-rip-1]net 10.2.2.0 0.0.0.255

2. 在 R1,R3,R4 上分别配置到达其他两个站点环回口的静态路由,下一跳指向公网

R1

[R1]ip route-static 10.10.10.3 32 100.1.1.2
[R1]ip route-static 10.10.10.4 32 100.1.1.2

R3

[R3]ip route-static 10.10.10.1 32 100.2.2.2

R4

[R4]ip route-static 10.10.10.1 32 100.3.3.2

最后查询

R3

R4

最后ping一下

  • 2
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月夜行舟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值