1. Static routing: refers to the routing information manually configured by users or network administrators. When the network topology or link state changes, the network administrator needs to manually configure the static routing information.
Compared with dynamic routing protocols, static routing does not need to exchange their own routing tables frequently. It has simple configuration and is more suitable for small and simple network environment. The reason why it is not suitable for large and complex network environment is that when the network topology and link state change, the network administrator needs to make a lot of adjustments, the workload is heavy, and can not perceive the occurrence of errors, which is not easy to troubleshoot.
Configure static routing to realize normal communication between host PC s.
<Huawei>sys [Huawei]sys r1 [r1] [r1]undo info enable //Close the message center [r1]int g0/0/0 //Entry port [r1-GigabitEthernet0/0/0]ip add 192.168.1.2 30 //Configure port ip [r1]int g0/0/2 [r1-GigabitEthernet0/0/2]ip add 192.168.5.1 30 [r1-GigabitEthernet0/0/2]int g0/0/1 [r1-GigabitEthernet0/0/1]ip add 192.168.2.1 30 [r1-GigabitEthernet0/0/1]q [r1]ip route-static 192.168.6.0 30 192.168.5.2 //Configure static routing [r1]ip route-static 192.168.4.0 30 192.168.2.2
<Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sys r2 [r2]int g0/0/1 [r2-GigabitEthernet0/0/1]q [r2]undo info enable [r2]int g0/0/1 [r2-GigabitEthernet0/0/1]ip add 192.168.2.2 30 [r2-GigabitEthernet0/0/1]quit [r2]int g0/0/2 [r2-GigabitEthernet0/0/2]ip add 192.168.3.1 30 [r2-GigabitEthernet0/0/2]q [r2]ip route-static 192.168.4.0 30 192.168.3.2 [r2]ip route-static 192.168.1.0 30 192.168.2.1
<Huawei>sys [Huawei]sys r3 [r3]un in en [r3]int g0/0/2 [r3-GigabitEthernet0/0/2]ip add 192.168.3.2 30 [r3-GigabitEthernet0/0/2]int g0/0/0 [r3-GigabitEthernet0/0/0]ip add 192.168.4.2 30 [r3-GigabitEthernet0/0/0]q [r3]ip route-static 192.168.1.0 30 192.168.3.1
<Huawei>sys [Huawei]sys r4 [Huawei]un in en [r4]int g0/0/2 [r4-GigabitEthernet0/0/2]ip add 192.168.5.2 30 [r4-GigabitEthernet0/0/2]int g0/0/0 [r4-GigabitEthernet0/0/0]ip add 192.168.6.2 30 [r4-GigabitEthernet0/0/0]q [r4]ip route-static 192.168.1.0 30 192.168.5.1
Working principle of router
Assuming interworking between PCs, PC1 will send data to its gateway device R1; After receiving its data, R1 checks its routing table according to the destination address in the data packet, finds the routing entry of the corresponding destination network, and forwards the data to the next router R2 according to the next hop and outbound interface information in the entry; At the same time, R2 forwards the data to R3 in the same way, and finally R3 also forwards the data to PC3 directly connected to itself; After receiving the data, host 3 sends it again in the same process as host 1 sends data to PC3
View configuration information
View the R1 routing table display IP routing table.
View R2 routing table
View R3 routing table
View R4 routing table
The routing table contains the following key items:
- Destination: indicates the destination address of this route. Used to identify the destination address or destination network of IP packets.
- Mask: indicates the subnet mask length of this destination address. Together with the destination address, it identifies the address of the network segment where the destination host or router is located.
- After the destination address and subnet mask are "logically and", the address of the network segment where the destination host or router is located can be obtained. For example, the destination address is 10.1 1.1, the mask is 255.255 The address of the network segment where the host or router of 255.0 is located is 10.1 1.0.
- The mask consists of several consecutive "1", which can be expressed in dotted decimal system or the number of consecutive "1" in the mask. For example, mask 255.255 255.0 has a length of 24, which can be expressed as 24.
- Proto: indicates the routing protocol for learning this route.
- Pre: indicates the routing protocol priority of this route. For the same destination, there may be multiple routes such as different next hop and outbound interfaces. These different routes may be found by different routing protocols or manually configured static routes. The one with high priority (small value) will become the current optimal route. For the routing priority of each protocol, see the priority of routing protocol.
- Cost: routing overhead. When multiple routes reaching the same destination have the same routing priority, the one with the lowest routing overhead will become the current optimal route.
- Preference is used to compare the routing priorities between different routing protocols, and Cost is used to compare the priorities of different routes within the same routing protocol.
- NextHop: indicates the next hop address of this route. Indicates the next device for data forwarding.
- Interface: indicates the outgoing interface of this route. Indicates which interface the data will be forwarded from the local router.
Test the connectivity between PC1 and PC2 and PC3