One, routing overview
- The forwarding process from the source host to the target host
- Router: A device capable of forwarding data packets to the correct destination and selecting the best path during the forwarding process.
- How the router works: forward data through the routing table
Second, the routing table
- The collection of routing entries maintained in the router
- The router makes path selection according to the routing table
Routing table formation
Directly connected network segments are dynamically learned, IP addresses are configured, and ports are up status to form a directly connected route.
Statically add non-directly connected network segments
Static routing:
- Manually configured by the administrator is one-way and lacks flexibility, but has high accuracy.
- It is equivalent to having specified a good direction and will not go wrong. But the one-way data has no return, so you need to configure a static route to point back the path on the other side's router.
Default route:
- When the router cannot find the routing entry of the target network in the routing table, the router forwards the request to the default routing interface. The default route is best arranged in the stub network.
Three, switching and routing comparison
- Routing works at the network layer
- Forward data according to the routing table
- Routing
- Route forwarding
- Switching works at the data link layer
- Forward data according to the MAC address table
- Hardware forwarding
Huawei routing commands
默认路由
【Huawei】ip route-static 0.0.0.0 0.0.0.0 192.168.12.1
静态路由 目标网段 子网掩码 下一跳
【Huawei】ip route-static 192.168.10.0 255.255.255.0 192.168.12.1
查看路由表
【Huawei】display ip routing-table
【R1】ip route-static 192.168.1.0 24 11.0.0.2 默认优先级为60,越小越优先
【R1】ip route-static 192.168.1.0 24 12.0.0.2 preference 70 配置浮动路由用于备份(也是静态路由,备用路径,因为优先级被我们设定为70)