【干货】配置浮动路由
发布作者:微思网络 发布时间:2025-07-29 浏览量:0次
ISP-1 和 ISP-2 使用相同的环回口地址,通过更改 GW 默认路由的管理距离,可以让 GW 选择管理距离小的默认路由为主线路,管理距离大的默认路由为 备份线路,以达到选择最佳线路进行数据通信的目的。
ISP-1(config)#interface f0/0 ISP-1(config-if)#ipaddress 192.168.1.1 255.255.255.0 ISP-1(config-if)#noshutdown ISP-1(config-if)#exit ISP-1(config)#interface loopback 0 ISP-1(config-if)#ipaddress 123.1.1.1 255.255.255.0 ISP-1(config-if)#exit
ISP-2(config)#interfacef0/0 ISP-2(config-if)#ipaddress192.168.2.2 255.255.255.0 ISP-2(config-if)#noshutdownISP-2(config-if)#exit ISP-2(config)#interfaceloopback0 ISP-2(config-if)#ipaddress 123.1.1.1 255.255.255.0 ISP-2(config-if)#exit
GW(config)#interface f1/0 GW(config-if)#ipaddress 192.168.1.2 255.255.255.0 GW(config-if)#noshutdown GW(config-if)#exit GW(config)#interface f0/0 GW(config-if)#ipaddress 192.168.2.1 255.255.255.0 GW(config-if)#noshutdown GW(config-if)#exit GW(config)#iproute 123.1.1.1 255.255.255.255192.168.1.1 //
线路为主线路,管理距离改成10,设置此线路为备份线路。
GW(config)#iproute 123.1.1.1 255.255.255.255192.168.2.2 10 //把此线路默认路由
接下来:show iproute -----à 查看路由表,GW 上显示去出 往地址 123.1.1.1 有两条链路,管理距离分别为 1 和 10。
在没有更改管理距离时,GW 去往 123.1.1.1 地址不通,在 GW 上任意 down 掉一个接口,可以通信。
更改管理距离后,GW 会选择管理距离小为主线路,并且从主线路与 123.1.1.1 地址通信。
点击查看相关文章:
2002年成立,专业认证培训20多年
面向全国招生→线上直播 | 线下面授