1

浮动静态路由_韩立刚的技术博客_51CTO博客

 1 year ago
source link: https://blog.51cto.com/91xueit/5378828
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

浮动静态路由

原创

韩立刚冬青 2022-06-13 14:46:26 ©著作权

文章标签 静态路由 优先级 路由表 文章分类 路由交换 网络/安全 阅读数177

        浮动路由又称为路由备份,两条或多条链路组成浮动路由。当到达某一网络有多条路径,通过为静态路由设置不同的优先级,你可以指定主用路径和备用路径。当主用路径不可用时,走备用路径的静态路由进入路由表,数据包通过备用路径转发到目标网络,这就是浮动路由。

如图1所示,从A网段到B网段的最佳路径是从R1àR3,当最佳路径不可用时,可以走备用路径R1àR2àR3。这就是需要配置浮动静态路由,添加静态路由时指定优先级。指定路由优先级的参数是preference,取值1-255,值越大,优先级越低,直连网络优先级为0,静态路由默认为60。

浮动静态路由_路由表

图1 备用路径

在R1上添加两条到192.168.1.0/24网段的静态路由,主用路径优先级使用默认,备用路径的静态路由优先级设置成100。

[AR1]ip route-static 192.168.1.0 24 172.16.2.2

[AR1]ip route-static 192.168.1.0 24 172.16.2.2 preference ?

INTEGER<1-255> Preference value range

[AR1]ip route-static 192.168.1.0 24 172.16.0.2 preference 100

在R3上添加两条到192.168.0.0/24网段的静态路由,主用路径优先级使用默认,备用路径的静态路由优先级设置成100。

[AR3]ip route-static 192.168.0.0 24 172.16.2.1

[AR3]ip route-static 192.168.0.0 24 172.16.1.1 preference 100

在R2上添加到192.168.0.0/24和192.168.1.0/24网段的静态路由。

[AR2]ip route-static 192.168.0.0 24 172.16.0.1

[AR2]ip route-static 192.168.1.0 24 172.16.1.2

在R1上查看路由表,可以看到主用路径的路由,备用路径的静态路由没有加入路由表。

[AR1]display ip routing-table

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Routing Tables: Public

Destinations : 14 Routes : 14

Destination/Mask Proto Pre Cost Flags NextHop Interface

192.168.0.0/24 Direct 0 0 D 192.168.0.1 Vlanif1

192.168.0.1/32 Direct 0 0 D 127.0.0.1 Vlanif1

192.168.0.255/32 Direct 0 0 D 127.0.0.1 Vlanif1

192.168.1.0/24 Static 60 0 RD 172.16.2.2 GigabitEthernet0/0/1

255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

查看全部静态路由 能够显示主路由和备用路由。Active表示该路由加入了IP路由表,Inactive表示该路由没有加入IP路由表。

<AR1>display ip routing-table protocol static

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Public routing table : Static

Destinations : 1 Routes : 2 Configured Routes : 2

Static routing table status : <Active>

Destinations : 1 Routes : 1

Destination/Mask Proto Pre Cost Flags NextHop Interface

192.168.1.0/24 Static 60 0 RD 172.16.2.2 GigabitEthernet0/0/1

Static routing table status : <Inactive>

Destinations : 1 Routes : 1

Destination/Mask Proto Pre Cost Flags NextHop Interface

192.168.1.0/24 Static 100 0 R 172.16.0.2 GigabitEthernet0/0/0

在R1上关闭主用路径的接口,再次查看路由表,可以看到备用路由生效。

[AR1]interface GigabitEthernet 0/0/1

[AR1-GigabitEthernet0/0/1]shutdown

<AR1>display ip routing-table

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Destination/Mask Proto Pre Cost Flags NextHop Interface

192.168.0.255/32 Direct 0 0 D 127.0.0.1 Vlanif1

192.168.1.0/24 Static 100 0 RD 172.16.0.2 GigabitEthernet0/0/0

此文章来自于《华为 HCIA-Datacom认证(2021新版HCIA教材)》

京东购买本书

 ​https://item.jd.com/13706744.html​

学习计算机网络华为网络工程师 华三网络工程师课程中有问题联系韩老师

华为 HCIA-Datacom认证(2021新版HCIA教材)课程链接 ​ ​https://edu.51cto.com/course/28956.html​

浮动静态路由_静态路由_02

韩老师招收正式学生、门徒级套餐

 ​https://edu.51cto.com/topic/819.html​


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK