Huawei's simple direct connection and static routing configuration

experiment

Intercommunication between PC1 and PC2 and PC3

The PC configuration is as follows:

PC1                                             PC2                                            PC3:

IP address: 192.168.1.1 IP address: 192.168.4.1 IP address: 192.168.6.1

Subnet mask: 255.255.255.252 Subnet mask: 255.255.255.252 Subnet mask: 255.255.255.252

Gateway: 192.168.1.2 Gateway: 192.168.4.2 Gateway: 192.1686.2

R1:
system-view //Enter the system to try
sysname R1 //Change the name
un in en //Close the information center function
int g0/0/0 //Enter the interface
ip address 192.168.1.2 30 //Configure IP
int g0/0/ 1
ip address 192.168.2.1 30
int g0/0/2
ip address 192.168.5.1 30
display ip interface brief //Check the port IP brief status information

R2:
system-view
sysname R2
un in en
int g0/0/1
ip address 192.168.2.2 30
int g0/0/2
ip address 192.168.3.1 30
display ip interface brief

R3:
system-view
sysname R3
un in en
int g0/0/2
ip address 192.168.3.2 30
int g0/0/0    
ip address 192.168.4.2 30
display ip interface brief

R4:
system-view
sysname R4
un in en
int g0/0/2
ip address 192.168.5.2 30
int g0/0/0
ip address 192.168.6.2 30
display ip interface brief

R1:
ip route-static 192.168.6.0 30 192.168.5.2 //Configure a static route, go to network segment 6.0
R4:
ip route-static 192.168.1.0 30 192.168.5.1 //This is the return route

R1:
ip route-static 192.168.4.0 30 192.168.2.2
R2:
ip route-static 192.168.4.0 30 192.168.3.2
R3:
ip route-static 192.168.1.0 30 192.168.3.1
R2:
ip route-static 192.168.1.0 30 192.168.2.1

After configuring PC1 here, you can ping PC2 and PC3, and we can ping them.

 Here we can see that the network segment of 4.0 can be pinged, but the network segment of 3.0 is not pinged, why?

You can view the routing table of the R1 router (display ip routing-table)

        Check the routing table of R1 and find that there is no route for the 3.0 network segment, so the ping of 3.0 fails, but the ping of 4.0 succeeds. If you want to ping the 3.0 network segment, configure a static route for the 3.0 network segment. (ip route-static 192.168.3.0 30 192.168.2.2)

For static routing, we can also configure default routing, which needs to be configured with priority.

R1: Delete the previous static route and configure these two routes

ip route-static 0.0.0.0 0 192.168.5.2 preference 100

ip route-static 0.0.0.0 0 192.168.2.2 preference 120

After configuring these two items, we go to ping PC2 and PC3 again, and we will find that only PC2 (6.1) can be pinged, but PC3 (4.1) cannot be pinged. Why?

        By checking the routing table of R1, it can be found that the next hop of the configured default route 0.0.0.0 is to 192.168.5.2, that is to say, our route will pass through the network segment 5.0, so PC3 will not be able to ping. Due to the priority we configured, when the route 5.0 is blocked, the route will take the network segment 2.0.

        We first close the network segment 5.0 and enter the g0/0/2 interface, close this port (shutdown), and then we go to pingPC3, and the ping will pass at this time.

 

Priority: the smaller the priority

Overhead value: the smaller the priority

The default priorities for common route types are as follows :

routing source routing type default priority
direct connection direct route 0
static static route 60
dynamic routing OSPF internal routing 10
OSPF external routing 150

The routing table contains the following key entries:

  • Destination: Indicates the destination address of this route. It is used to identify the destination address or destination network of the IP packet.
  • 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 "logic AND" the destination address and the subnet mask, 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 address of the network segment where the host or router is located is 10.1.1.0 and the mask is 255.255.255.0.
  • The mask is composed of several consecutive "1", which can be represented by dotted decimal notation, or by the number of consecutive "1" in the mask. For example, the mask 255.255.255.0 has a length of 24, which means it can be expressed as 24.
  • Proto: Indicates the routing protocol that learned this route.
  • Pre: Indicates the routing protocol priority of this route. For the same destination, there may be multiple routes with different next hops and outgoing interfaces. These different routes may be discovered by different routing protocols, or they may be manually configured static routes. The one with higher priority (lower value) will become the current optimal route. For the routing priority of each protocol, see Routing Protocol Priority.
  • Cost: Routing cost. When multiple routes to the same destination have the same route priority, the route with the smallest cost will be the current optimal route.
  • Preference is used to compare the priority of routes 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 outbound interface of this route. Indicates which interface of the local router the data will be forwarded from.

Guess you like

Origin blog.csdn.net/zhao__b/article/details/122069834