VPN主题:GRE + IPSec vpn + ospf 配置

  • 此文章主要记录实验配置
  • 主要实现:
    • 基于GRE+IPSec vpn隧道实现跨公网ospf互通(当然静态路由以可以)
  • ENSP拓扑图:
    ENSP拓扑图

配置:

1. 配置缺省路由,保证互联公网地址可达:
1
2
3
4
5
6
7
8
R1配置:
[R1]ip route-static 0.0.0.0 0 12.1.1.2

R3配置:
[R3]ip route-static 0.0.0.0 0 23.1.1.2

R4配置:
[R4]ip route-static 0.0.0.0 0 24.1.1.2
2. 总部R3配置:
  • 创建安全提议:对数据加密和认证的一个方案(认证算法、加密算法、以及隧道封装模式、IKE版本、认证密码等等)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sysname ZongBu-BJ
#
ipsec proposal aa
#
ike proposal 5
#
ike peer ShangHai v2
pre-shared-key cipher huawei
ike-proposal 5
ike peer NanJing v2
pre-shared-key cipher huawei
ike-proposal 5
#
ipsec profile TO_NanJing
ike-peer NanJing
proposal aa
ipsec profile TO_ShangHai
ike-peer ShangHai
proposal aa
#
  • 创建GRE隧道接口,并将IPSec策略调用到隧道接口:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#
interface Tunnel0/0/0
ip address 192.168.13.3 255.255.255.0
tunnel-protocol gre
source GigabitEthernet0/0/0
destination 12.1.1.1
ipsec profile TO_ShangHai
#
interface Tunnel0/0/1
ip address 192.168.34.3 255.255.255.0
tunnel-protocol gre
source GigabitEthernet0/0/0
destination 24.1.1.4
ipsec profile TO_NanJing
#
  • 配置ospf:
1
2
3
4
5
6
7
#
ospf 1
area 0.0.0.0
network 192.168.3.0 0.0.0.255
network 192.168.13.0 0.0.0.255
network 192.168.34.0 0.0.0.255
#
3. 上海分支配置:
  • 创建安全提议:对数据加密和认证的一个方案(认证算法、加密算法、以及隧道封装模式、IKE版本、认证密码等等)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sysname ShangHai
#
ipsec proposal aa
#
ike proposal 5
#
ike peer ZongBu v2
pre-shared-key cipher huawei
ike-proposal 5
#
ipsec profile TO_ZongBu
ike-peer ZongBu
proposal aa
#
  • 创建GRE隧道接口,并将IPSec策略调用到隧道接口:
1
2
3
4
5
6
7
8
#
interface Tunnel0/0/0
ip address 192.168.34.1 255.255.255.0
tunnel-protocol gre
source GigabitEthernet0/0/0
destination 23.1.1.3
ipsec profile TO_ZongBu
#
  • ospf配置:
1
2
3
4
5
6
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.34.0 0.0.0.255
#
4. 南京分支配置:
  • 创建安全提议:对数据加密和认证的一个方案(认证算法、加密算法、以及隧道封装模式、IKE版本、认证密码等等)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sysname Nanjing
#
ipsec proposal aa
#
ike proposal 5
#
ike peer ZongBu v2
pre-shared-key cipher %$%$}H"z!S,^u*;l(AQmOU4+,.2n%$%$
ike-proposal 5
#
ipsec profile TO_ZongBu
ike-peer ZongBu
proposal aa
ipsec profile aa
#
  • 创建GRE隧道接口,并将IPSec策略调用到隧道接口:
1
2
3
4
5
6
7
8
#
interface Tunnel0/0/0
ip address 192.168.13.5 255.255.255.0
tunnel-protocol gre
source GigabitEthernet0/0/0
destination 23.1.1.3
ipsec profile TO_ZongBu
#
  • ospf配置:
1
2
3
4
5
6
#
ospf 1
area 0.0.0.0
network 192.168.4.0 0.0.0.255
network 192.168.13.0 0.0.0.255
#
5. 配置完成

1. 在总部查看ospf邻居状态:

2. 查看路由表:

3. 查看sa信息:

4.抓个包显示数据已加密: