HCNA-20 浮动静态路由及负载均衡
基本配置 实现R2通信两处分点,分点与分点之间通信 <Huawei>system-view [Huawei]sysnamer1 [r1]interfacegigabitethernet 0/0/0 [r1-GigabitEthernet0/0/0]ipaddress 172.16.12.1 24 [r1-GigabitEthernet0/0/0]interfacegigabitethernet 0/0/1 [r1-GigabitEthernet0/0/1]ipaddress 172.16.13.1 24 [r1-GigabitEthernet0/0/1]interfacegigabitethernet 0/0/2 [r1-GigabitEthernet0/0/2]ipaddress 172.16.10.1 24 [r1-GigabitEthernet0/0/2]quit [r1]displayip interface brief [r1]iproute-static 172.16.30.0 24 172.16.13.3 <Huawei>system-view [Huawei]sysnamer2 [r2]interfaceGigabitEthernet 0/0/0 [r2-GigabitEthernet0/0/0]ipaddress 172.16.12.2 24 [r2-GigabitEthernet0/0/0]interfacegigabitethernet 0/0/1 [r2-GigabitEthernet0/0/1]ipaddress 172.16.23.2 24 [r2-GigabitEthernet0/0/1]quit [r2]displayip interface brief [r2]iproute-static 172.16.10.0 24 172.16.12.1 [r2]iproute-static 172.16.30.0 24 172.16.23.3 <Huawei>system-view [Huawei]sysnamer3 [r3]interfacegigabitethernet 0/0/0 [r3-GigabitEthernet0/0/0]ipaddress 172.16.23.3 24 [r3-GigabitEthernet0/0/0]interfacegigabitethernet 0/0/1 [r3-GigabitEthernet0/0/1]ipaddress 172.16.13.3 24 [r3-GigabitEthernet0/0/1]interfacegigabitethernet 0/0/2 [r3-GigabitEthernet0/0/2]ipaddress 172.16.30.1 24 [r3-GigabitEthernet0/0/2]quit [r3]displayip interface brief [r3]iproute-static 172.16.10.0 24 172.16.13.1 PC>tracert172.16.30.100 tracerouteto 172.16.30.100, 8 hops max (ICMP),press Ctrl+C to stop 1 172.16.10.1 16 ms 16 ms 15 ms 2 172.16.13.3 <1 ms 31 ms 16 ms 3 172.16.30.100 31 ms 16 ms 16 ms 配置浮动静态路由实现路由备份 [r1]ip route-static172.16.30.0 24 172.16.12.2 preference 100 //配置静态路由并设置优先级 [r1]displayip routing-table RouteFlags: R - relay, D - download to fib ------------------------------------------------------------------------------ RoutingTables: Public Destinations : 14 Routes : 14 Destination/Mask Proto Pre Cost Flags NextHop Interface …… 0/0/1 172.16.30.0/24 Static 60 0 RD 172.16.13.3 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 查看路由表没有任何变化; [r1]display ip routing-tableprotocol 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 172.16.30.0/24 Static 60 0 RD 172.16.13.3 GigabitEthernet 0/0/1 Static routing table status: <Inactive> Destinations : 1 Routes : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 172.16.30.0/24 Static 100 0 R 172.16.12.2 GigabitEthernet 0/0/0 查看结果是两条路由都存在,但R2的这条路由目前是不活动的状态Pre优先级为100。 R3进行同样配置。 [r3]ip route-static172.16.10.0 24 172.16.23.2 preference 100 关闭R1 G0/0/1测试 [r1]interfaceGigabitEthernet 0/0/1 [r1-GigabitEthernet0/0/1]shutdown PC>tracert 172.16.30.100 traceroute to 172.16.30.100,8 hops max (ICMP), press Ctrl+C to stop 1 172.16.10.1 15 ms 16 ms <1 ms 2 172.16.12.2 31 ms 16 ms 31 ms 3 172.16.23.3 16 ms 31 ms 31 ms 4 172.16.30.100 31 ms 32 ms 31 ms [r1]display ip routing-tableprotocol 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 172.16.30.0/24 Static 100 0 RD 172.16.12.2 GigabitEthernet 0/0/0 Static routing table status: <Inactive> Destinations : 1 Routes : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 172.16.30.0/24 Static 60 0 172.16.13.3 Unknown 配置负载均衡 [r1]interfaceGigabitEthernet 0/0/1 [r1-GigabitEthernet0/0/1]undoshutdown [r1-GigabitEthernet0/0/1]quit [r1]ip route-static172.16.30.0 24 172.16.12.2 [r1]display ip routing-table Route Flags: R - relay, D -download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 14 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface …… 172.16.30.0/24 Static 60 0 RD 172.16.13.3 GigabitEthernet 0/0/1 Static 60 0 RD 172.16.12.2 GigabitEthernet 0/0/0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 配置静态路由使用默认优先级后,目标172.16.30.0出现了两条可以到达的路由,不同的下一跳地址。这样便完成负载均衡。 再配置R3 [r3]ip route-static172.16.10.0 24 172.16.23.2 [r3]display ip routing-table Route Flags: R - relay, D -download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 14 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 172.16.10.0/24 Static 60 0 RD 172.16.13.1 GigabitEthernet 0/0/1 Static 60 0 RD 172.16.23.2 GigabitEthernet …… [r3]display ip routing-tableprotocol static Route Flags: R - relay, D - downloadto fib ------------------------------------------------------------------------------ Public routing table :Static Destinations : 1 Routes : 2 Configured Routes : 2 Static routing table status: <Active> Destinations : 1 Routes : 2 Destination/Mask Proto Pre Cost Flags NextHop Interface 172.16.10.0/24 Static 60 0 RD 172.16.13.1 GigabitEthernet 0/0/1 Static 60 0 RD 172.16.23.2 GigabitEthernet 0/0/0 Static routing table status: <Inactive> Destinations : 0 Routes : 0 注意:当中由表中出现到过同一目标的多条等价路径时,路由器在转发到达该目的地的数据包会逐包,逐流,逐目的等负载均衡算法将数据包分布在相应的链路上发送。
|