VRRP链路跟踪_第1张图片
交换机基本配置:给交换机改名字,创建vlan 然后在接口模式下配置access 在把接口加入到vlan10里

[sw1]vlan 10
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 10
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 10
[sw1]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]port default vlan 10

R1路由基本配置IP地址
[sw1-GigabitEthernet0/0/0]ip address 192.168.10.251/24
[sw1-GigabitEthernet0/0/1]ip address 192.168.20.1/24
VRRP基本配置
[sw1-GigabitEthernet0/0/0]vrrp vrid 1 virtual-ip 192.168.10.254
VRRP优先级配置
[sw1-GigabitEthernet0/0/0]vrrp vrid 1 priority 200
VRRP链路跟踪配置:int g0/0/1线路出现故障自动降低优先级
[r1-GigabitEthernet0/0/0]vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 150
静态路由配置
[r1]ip route-static 192.168.40.0 24 192.168.20.2

R2路由基本配置IP地址
[sw1-GigabitEthernet0/0/0] ip address 192.168.10.252/24
[sw1-GigabitEthernet0/0/2] ip address 192.168.30.1/24
[sw1-GigabitEthernet0/0/0]vrrp vrid 1 virtual-ip 192.168.10.254
静态路由配置
[r2]ip route-static 192.168.40.0 24 192.168.30.2
R3路由基本配置IP地址
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.20.2 24
[r3]int g0/0/2
[r3-GigabitEthernet0/0/2]ip address 192.168.30.2 24
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip address 192.168.40.254 24
配置默认路由
[r3]ip route-static 0.0.0.0 0.0.0.0 192.168.20.1
[r3]ip route-static 0.0.0.0 0.0.0.0 192.168.30.1
PC2客户端IP地址配置
VRRP链路跟踪_第2张图片
PC3客户端IP地址配置
VRRP链路跟踪_第3张图片
通过抓包验证结果
VRRP链路跟踪_第4张图片VRRP链路跟踪_第5张图片
路由器
[r1]display vrrp 查看VRRP信息
[r1]display ip interface brief 查看IP地址信息
[r1]display ip routing-table 查看路由表信息
交换机
[sw1]display vlan 查看vlan信息
[sw1]display port vlan 查看接口配置信息
[r1]display current-configuration 查看更多配置信息(交换机和路由器通用命令)