一、组网要求
1) 交换机连接两个出口路由器,172.6.1.2为主线路,172.16.2.2为备用线路;
2)当主线路的物理线路失效,备用线路切换为主。
二、组网拓扑
三、配置要点
- 配置接口地址
- 配置浮动路由
四、配置步骤
注意:配置之前建议使用 Ruijie#show interface status查看接口名称,常用接口名称有FastEthernet(百兆)、GigabitEthernet(千兆)和TenGigabitEthernet(万兆),以下配置以千兆接口为例
1)配置接口地址
Ruijie>enable
Ruijie#configure terminal
Ruijie(config)# interface GigabitEthernet 0/3
Ruijie(config-if-GigabitEthernet 0/3)#no switchport----->把接口属性改成路由接口
Ruijie(config-if-GigabitEthernet 0/3)#ip address 172.16.1.1 255.255.255.0----->配置地址
Ruijie(config)#interface GigabitEthernet 0/4
Ruijie(config-if-GigabitEthernet 0/4)#no switchport
Ruijie(config-if-GigabitEthernet 0/4)#ip address 172.16.2.1 255.255.255.0
2)配置浮动路由
Ruijie(config)#ip route 0.0.0.0 0.0.0.0 172.16.1.2
Ruijie(config)#ip route 0.0.0.0 0.0.0.0 172.16.2.2 10-----10为metric值,metric值越大优先级越低。默认是1
3) 保存配置
Ruijie(config)#end
Ruijie#write ----->确认配置正确,保存配置
五、验证命令:
正常情况下:
Ruijie#show ip route
Codes:C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default
Gateway of last resort is 172.16.1.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 172.16.1.2
C 172.16.1.0/24 is directly connected, GigabitEthernet 0/14
C 172.16.1.1/32 is local host.
C 172.16.2.0/24 is directly connected, GigabitEthernet 0/15
C 172.16.2.1/32 is local host.
当主线路down后:
Ruijie(config)#show ip route
Codes:C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default
Gateway of last resort is 172.16.2.2 to network 0.0.0.0
S* 0.0.0.0/0 [10/0] via 172.16.2.2
C 172.16.1.0/24 is directly connected, GigabitEthernet 0/14
C 172.16.1.1/32 is local host.
C 172.16.2.0/24 is directly connected, GigabitEthernet 0/15
C 172.16.2.1/32 is local host.