Huawei ensp routing-static routing, default routing, routing recursion

routing

  • In a typical data communication network, there are often multiple different IP network segments. Data interaction between different IP network segments requires the help of three-layer devices. These devices have routing capabilities and can realize data cross-network segments. Forward.
  • Routing is the most basic element in data communication networks. Routing information is the path information that guides packet forwarding, and the routing process is the process of packet forwarding.

Note: The routers must be connected to different network segments and cannot be connected to the same router on the same network segment.

routing information

routing table

The router first checks the routing table before forwarding

display ip route View routing table

router priority

The priority of different protocols is compared, and the cost of the same protocol is compared.

The opsp protocol is more cost-effective

longest match principle

Routing table summary

  • When the router learns routes to the same destination network segment from multiple different channels (these routes have the same destination network address and network mask), it will select the route with the smallest route priority value; if these routes are learned from the same Routing protocol, the one with the best metric value is preferred. In short, the optimal route is added to the routing table.
  • When the router receives a data packet, it will query the destination IP address of the data packet in its own routing table. If a matching routing entry can be found, the data will be forwarded based on the outbound interface and next hop indicated by the entry; if there is no matching entry, the data packet will be discarded.
  • The behavior of routers is hop-by-hop. Each router along the path of a data packet from source to destination must have a route to the destination network segment, otherwise packet loss will occur.
  • Data communications tend to be bidirectional, so pay attention to the round trip (round trip routing) of traffic.

Three types of routing: direct connection, static routing, and dynamic routing

Direct routing

It will be automatically generated when connected online. The connection must be on the same network segment.

display ip route View routing table

display ip int brief View device interface type (view port IP address)

 

Static routing

Static route configuration

There are three ways. Generally, the next hop IP is used.

The outbound interface mode can only be used on PPP and HDLC.

Static route configuration priority (also floating route)

Configuration commands

[AR1]ip route-static 2.2.2.0 24 10.1.1.2    //配置静态路由
                 目标网段  子网掩码   下一条ip地址
                 
配置静态路由优先级(浮动路由)           
默认优先级为60,越小越优先,一般是设置较高优先级作为备份路由,出现故障时启用
[AR1]ip route-static 2.2.2.0 24 10.1.1.2 preference 100  //设置优先级为100    

Static routing experiment

AR1:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR1
[AR1]int g0/0/0

[AR1-GigabitEthernet0/0/0]ip address 1.1.1.2 24
[AR1-GigabitEthernet0/0/0]q
[AR1]int g0/0/1

[AR1-GigabitEthernet0/0/1]ip address 10.1.1.1 24
[AR1-GigabitEthernet0/0/1]q

[AR1]ip route-static 2.2.2.0 24 10.1.1.2    //配置静态路由(去pc2的静态路由)
                 目标网段  子网掩码   下一条ip地址

不用打1.1.1.0 是因为路由表里有直通路由,所以不需要(AR3同理)
[AR1]dis curr    //查看所有配置
[AR1]display ip routing-table     //检测路由表
前三条就是直连路由
<AR1>save    //保存

AR2:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR2
[AR2]int g0/0/0

[AR2-GigabitEthernet0/0/0]ip address 10.1.1.2 24
Apr  8 2023 14:32:24-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[AR2-GigabitEthernet0/0/0]q
[AR2]int g0/0/1

[AR2-GigabitEthernet0/0/1]ip address 20.1.1.1 24
Apr  8 2023 14:32:33-08:00 AR2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[AR2-GigabitEthernet0/0/1]q

[AR2]ip route-static 2.2.2.0 24 20.1.1.2
     (去pc2的静态路由)

[AR2]ip route-static 1.1.1.0 24 10.1.1.1    (去pc1的静态路由)
两个静态路由都得打,只打一个的话就只能去不能会,是通不了的

[AR2]display ip routing-table 
<AR2>save

AR3

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR3
[AR3]int g0/0/0

[AR3-GigabitEthernet0/0/0]ip address 20.1.1.2 24
Apr  8 2023 14:35:36-08:00 AR3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[AR3-GigabitEthernet0/0/0]q
[AR3]int g0/0/1

[AR3-GigabitEthernet0/0/1]ip address 2.2.2.2 24
Apr  8 2023 14:35:50-08:00 AR3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[AR3-GigabitEthernet0/0/1]q



[AR3]ip route-static 1.1.1.0 24 20.1.1.1    (去pc1的静态路由)
不用打2.2.2.0 是因为路由表里有直通路由,所以不需要(AR1同理)
[AR3]dis curr    //查看所有配置
[AR3]display ip routing-table 
<AR3>save

Successful interoperability

Default route (default route)

If there is no corresponding route in the routing table, the default route will be used.

Priority is based on the longest match principle (above)

dynamic routing

Routing recursion (iteration)

If the next route is not directly connected, directly calling the next route that is not directly connected will not take effect. However, if the next hop network segment that is not directly connected can be reached in the routing table, it will take effect.

Just typing this clause will not be effective.

Now after pointing to the static route to the next network segment above, the previous route will take effect.

equal cost routing

floating route

Static routing question 2

route summary

Guess you like

Origin blog.csdn.net/qq_53454383/article/details/131270616