1.基础配置
CLIENT2:
CLIENT3:
PC2:
R1:
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.1.1 255.255.255.0
R2:
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 23.1.1.2 255.255.255.0
interface GigabitEthernet0/0/2
ip address 24.1.1.2 255.255.255.0
R3:
interface GigabitEthernet0/0/0
ip address 23.1.1.3 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.3.1 255.255.255.0
R4:
interface GigabitEthernet0/0/0
ip address 24.1.1.4 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.4.1 255.255.255.0:
2.配置缺省路由确保两边的公网地址可达
R1:ip route-static 0.0.0.0 0 12.1.1.2
R3:ip route-static 0.0.0.0 0 23.1.1.2
R4:ip route-static 0.0.0.0 0 24.1.1.2
3.在总部R3上创建安全提议以及安全策略:对数据加密和认证的一个方案(认证算法、加密算法、以及隧道封装模式 、IKE版本、认证密码等等)
3.1创建安全提议aa
[R3]ipsec proposal aa
注意:
(1)AH 只能用来做认证和校验 ESP 既能用来做认证、校验也能用来做数据加密
(2)AH 可以选择认证算法 ESP可以选择认证和加密两类算法
默认封装方式:默认采用esp模式的隧道封装
相应esp认证算法:MD5-HMAC-96 esp
加密算法:DES
display ipsec proposal name aa
3.2创建IKE安全提议
[R3]ike proposal 5
3.3创建到达上海的IKE对等体,引用IKE安全提议
[R3]ike peer ShangHai v2
[R3-ike-peer-ShangHai]pre-shared-key cipher huawei
[R3-ike-peer-ShangHai]ike-proposal 5
[R3-ike-peer-ShangHai]quit
3.4创建到达上海的ipsec配置文件,调用ike对等体和安全提议aa
[R3]ipsec profile TO_ShangHai
[R3-ipsec-profile-TO_ShangHai]ike-peer ShangHai
[R3-ipsec-profile-TO_ShangHai]proposal aa
[R3-ipsec-profile-TO_ShangHai]quit
3.5创建到达南京的IKE对等体,引用IKE安全提议
ike peer NanJing v2
pre-shared-key cipher huawei
ike-proposal 5
3.6创建到达南京的ipsec配置文件,调用ike对等体和安全提议aa
ipsec profile TO_NanJing
ike-peer NanJing
proposal aa
3.7创建GRE隧道接口并将ipsec vpn策略文件调用到隧道口
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
4.配置上海分支R1
4.1创建安全提议以及安全策略:对数据加密和认证的一个方案(认证算法、加密算法、以及隧道封装模式 、IKE版本、认证密码等等)
ipsec proposal aa
4.2创建IKE安全提议
ike proposal 5
4.3创建到达总部的IKE对等体,引用IKE安全提议
ike peer ZongBu v2
pre-shared-key cipher huawei
ike-proposal 5
quit
4.4创建到达总部的ipsec配置文件,调用ike对等体和安全提议aa
ipsec profile TO_ZongBu
ike-peer ZongBu
proposal aa
quit
4.5创建GRE隧道接口并将ipsec vpn策略文件调用到隧道口
interface Tunnel0/0/0
ip address 192.168.13.1 255.255.255.0
tunnel-protocol gre
source GigabitEthernet0/0/0
destination 23.1.1.3
ipsec profile TO_ZongBu
5.配置南京分支R4
5.1创建安全提议以及安全策略:对数据加密和认证的一个方案(认证算法、加密算法、以及隧道封装模式 、IKE版本、认证密码等等)
ipsec proposal aa
5.2创建IKE安全提议
ike proposal 5
5.3创建到达总部的IKE对等体,引用IKE安全提议
ike peer ZongBu v2
pre-shared-key cipher huawei
ike-proposal 5
quit
5.4创建到达总部的ipsec配置文件,调用ike对等体和安全提议aa
ipsec profile TO_ZongBu
ike-peer ZongBu
proposal aa
quit
5.5创建GRE隧道接口并将ipsec vpn策略文件调用到隧道口
interface Tunnel0/0/1
ip address 192.168.34.4 255.255.255.0
tunnel-protocol gre
source GigabitEthernet0/0/0
destination 23.1.1.3
ipsec profile TO_ZongBu
quit
6. 配置动态路由协议(或者静态也可以)
在这里不能去宣告公网接口的IP地址,只需要宣告隧道接口的和内网的。
6.1配置R1的ospf
ospf 1
area 0
network 192.168.1.0 0.0.0.255
network 192.168.13.0 0.0.0.255
quit
quit
6.2配置R3的ospf
ospf 1
area 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
quit
quit
6.3配置R4的ospf
ospf 1
area 0
network 192.168.4.0 0.0.0.255
network 192.168.34.0 0.0.0.255
quit
quit
7.配置验证
7.1配置完OSPF查看路由表信息
7.2南京:PC可以访问总部和上海分公司访问上海时需经过总部中转。也可以在分支之间搭建vpn避免分支互访时绕行总部。
可以在R4上的G0/0/0进行抓包分析,在ping 192.168.1.2时,发现数据包从24.1.1.4去往23.1.1.3,之后通过R3再去转发给R1实现互访。
7.3查看ipsec配置文件
display ipsec profile
7.4查看安全联盟sa
display ipsec sa brief
两个安全联盟(一对):安全联盟是单向的
注意:模拟器有bug ,配置完成后不要重置ipsecsa,不要重启单个路由器,否则会出现不通现象!!如果要重启,可以尝试关掉后全部重启!!