实验要求:
1. 使VLAN10中的PC1和VLAN20中的PC2能够ping通主机PC3,且vlan10和valn20中的主机能够互通。
2. PC1和PC2的网关都使用虚拟网关(见拓扑图),并且当交换机S3的GE0/0/3口出现故障时,PC1也能和PC2,PC3通信。
3. 在S1和S2中配置VRRP。且要配置VRRP认证。
实验拓扑:
实验思路:
- 路由器要有分别去往PC1和PC2的路由。S1和S2也要有去往PC3的路由
- S1和S2的vlan1要配置与之路由器接口对应的IP地址。
- 虚拟网关IP的网段要与所在的vlanID的网段一致。
- 同一个VRRP备份组的认证方式和密码要一致。
实验配置:
[Huawei]sysn R1
[R1]inter g0/0/2
[R1-GigabitEthernet0/0/2]ip add 3.3.3.1 24
[R1-GigabitEthernet0/0/1]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[R1]ip route-static 172.16.1.0 24 192.168.1.2 配置静态路由
[R1]ip route-static 172.31.1.0 24 192.168.2.2
[S1]vlan batch 10 20
[S1]inter g0/0/3
[S1-GigabitEthernet0/0/3]port link-type trunk
[S1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[S1-GigabitEthernet0/0/3]inter g0/0/4
[S1-GigabitEthernet0/0/1]port link-type trunk
[S1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[S1]ip route-static 3.3.3.0 24 192.168.1.1 去往PC3 的路由
[S1]interface Vlanif 1
[S1-Vlanif1]ip add 192.168.1.2 24 与对端路由器接口IP一个网段
[S1]interface Vlanif 10
[S1-Vlanif10]ip address 172.16.1.3 24
[S1-Vlanif10]vrrp vrid 10 virtual-ip 172.16.1.1 虚拟网关IP一定要与vlan10的IP同一个网段
[S1-Vlanif10]vrrp vrid 10 priority 120 使其成为master
[S1-Vlanif10]vrrp vrid 10 authentication-mode md5 huawei 配置VRRP认证(密码:huawei)
[S1-Vlanif10]inter vlan 20
[S1-Vlanif20]ip add 172.31.1.4 24 注意一定要为vlan20配置一个IP地址
[S1-Vlanif20]vrrp vrid 20 virtual-ip 172.31.1.1
[S1-Vlanif20]vrrp vrid 20 authentication-mode md5 huawei
[S1-Vlanif20]vrrp vrid 20 preempt-mode disable 关闭S1中VRRP备份组20的抢占模式
[S2]vlan batch 10 20
[S2]inter g0/0/4
[S2-GigabitEthernet0/0/4]port link-type trunk
[S2-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[S2-GigabitEthernet0/0/4]inter g0/0/1
[S2-GigabitEthernet0/0/1]port link-type trunk
[S2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[S2]ip route-static 3.3.3.0 24 192.168.2.1
[S2]interface Vlanif 1
[S2-Vlanif1]ip add 192.168.2.2 24
[S2]interface Vlanif 10
[S2-Vlanif10]ip add 172.16.1.4 24
[S2-Vlanif10]vrrp vrid 10 virtual-ip 172.16.1.1
[S2-Vlanif10]vrrp vrid 10 preempt-mode disable
[S2-Vlanif10]vrrp vrid 10 authentication-mode md5 huawei
[S2-Vlanif10]inter vlan 20
[S2-Vlanif20]ip add 172.31.1.1 24
[S2-Vlanif20]vrrp vrid 20 virtual-ip 172.31.1.1
[S2-Vlanif20]vrrp vrid 20 priority 120
[S2-Vlanif20]vrrp vrid 20 authentication-mode md5 huawei
[Huawei]sysn S3
[S3]vlan batch 10 20
[S3]inter g0/0/1
[S3-GigabitEthernet0/0/1]port link-type access
[S3-GigabitEthernet0/0/1]port default vlan 10
[S3-GigabitEthernet0/0/1]inter g0/0/2
[S3-GigabitEthernet0/0/2]port link-type access
[S3-GigabitEthernet0/0/2]por de vla 20
[S3-GigabitEthernet0/0/2]inter g0/0/3
[S3-GigabitEthernet0/0/3]port link-type trunk
[S3-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[S3-GigabitEthernet0/0/2]inter g0/0/4
[S3-GigabitEthernet0/0/4]port link-type trunk
[S3-GigabitEthernet0/0/4]port trunk allow-pass vlan all
实验验证: