双机热备上下行接交换机主备组网实验

3年前 (2022-08-06)网络技术

链接:https://blog.csdn.net/qq1291594496/article/details/97923684

防火墙双机热备简单实验

实验topo:

实验目的:

熟悉双机热备原理

双机热备组网规划

实验需求:

企业部署双机热备,上下行接交换机主备模式组网;

用户业务网段为10.1.1.0/24,服务器业务网段为10.1.2.0/24;

心跳链路属于192.168.1.0/28,上行互联网网段为192.168.1.16/28

现在只申请了一个公网IP地址200.1.1.1/28

FW1为主墙,实现内网用户访问ISP,实现外网用户访问内网服务器

配置思路:

1.两个防火墙各接口配置相应的地址,并且加入区域(因为备墙要同步主设备的配置,所以主和备的接口使用要一致):

interface GigabitEthernet1/0/0

 ip address 10.1.1.1 255.255.255.0

#

interface GigabitEthernet1/0/1

 ip address 10.1.2.1 255.255.255.0         

#

interface GigabitEthernet1/0/2

 ip address 192.168.1.1 255.255.255.240

#

interface GigabitEthernet1/0/3

 ip address 192.168.1.17 255.255.255.240

#

1

2

3

4

5

6

7

8

9

10

11

12

2.FW1的G1/0/0口和FW2的G1/0/0口进行VRRP,虚拟一个上行链路的网关:

FW1(主墙):

interface GigabitEthernet1/0/0

 vrrp vrid 1 virtual-ip 10.1.1.254 active

#

FW2(备墙):

interface GigabitEthernet1/0/0

 vrrp vrid 1 virtual-ip 10.1.1.254 standby

#

1

2

3

4

5

6

7

8

3.FW1的G1/0/1口和FW2的G1/0/1口进行VRRP,虚拟一个下行链路的网关:

FW1(主墙):

interface GigabitEthernet1/0/1

 vrrp vrid 2 virtual-ip 10.1.2.254 active

#

FW2(备墙):

interface GigabitEthernet1/0/1

 vrrp vrid 2 virtual-ip 10.1.2.254 standby

#

1

2

3

4

5

6

7

8

4.FW1的G1/0/3口和FW2的G1/0/3口进行VRRP,虚拟一个公网地址访问ISP,要注意:当VRRP虚拟地址和接口地址不在同一网段时,需要加掩码:

FW1(主墙):

interface GigabitEthernet1/0/3

 vrrp vrid 3 virtual-ip 200.1.1.1 28 active

#

FW2(备墙):

interface GigabitEthernet1/0/3

 vrrp vrid 3 virtual-ip 200.1.1.1 28 standby

#

1

2

3

4

5

6

7

8

5.开启防火墙的HRP功能并配置出接口和对端地址(双机热备功能):

FW1(主墙):

 hrp enable

 hrp interface GigabitEthernet1/0/2 remote 192.168.1.2

#

FW2(备墙):

 hrp enable

 hrp interface GigabitEthernet1/0/2 remote 192.168.1.1

#

1

2

3

4

5

6

7

8

6.执行上述步骤后,FW1和FW2会比较出主墙和备墙,同时也会有相应的变化:

HRP_M[fw1] ---主墙

HRP_S[fw2] ---备墙

1

2

7.在FW1上写安全策略,FW2会自动同步FW1的配置:

security-policy

 default action permit

 rule name a1

  source-zone trust                       

  destination-zone untrust

  action permit

1

2

3

4

5

6

8.写一个address-group放公网地址,并用nat-policy调用,这里注意一个问题,address-group里面的地址必须和公网地址再同一个网段,否则不通:

nat address-group nt10 0

 mode pat

 section 0 200.1.1.3 200.1.1.4

nat-policy

 rule name a1

  source-zone trust

  destination-zone untrust

  action nat address-group nt10

1

2

3

4

5

6

7

8

9.只写nat-policy后是不可以通信的,还需要一条静态路由指向ISP,注意:静态路由不会被同步,所以需要给两个防火墙单独写默认:

FW1:

ip route-static 0.0.0.0 0.0.0.0 200.1.1.2

FW2:

ip route-static 0.0.0.0 0.0.0.0 200.1.1.2

1

2

3

4

10.外网用户要访问内网服务器,需要将内网服务器映射出去:

FW1:

nat server ser1 0 global 200.1.1.5 inside 10.1.2.3

1

2

实验结果:

PC1访问外网:

PC>ping 200.1.1.2

Ping 200.1.1.2: 32 data bytes, Press Ctrl_C to break

From 200.1.1.2: bytes=32 seq=1 ttl=254 time=62 ms

From 200.1.1.2: bytes=32 seq=2 ttl=254 time=63 ms

From 200.1.1.2: bytes=32 seq=3 ttl=254 time=62 ms

From 200.1.1.2: bytes=32 seq=4 ttl=254 time=63 ms

From 200.1.1.2: bytes=32 seq=5 ttl=254 time=62 ms

1

2

3

4

5

6

7

外网用户访问内网服务器:

————————————————

版权声明:本文为CSDN博主「谢泽浩」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/qq1291594496/article/details/97923684