Configuration of routers and static routes

Table of contents

1. Routing overview

2. Static routing and default routing

3. Configure static routing


1. Routing overview

         Routing: the forwarding process from source host to destination host

         The working principle of the router: forwarding data according to the routing table

2. Static routing and default routing

         1. Static routing: Network administrators manually configure unknown network segments into the routing table, allowing precise control of routing behavior. Static routing is unidirectional and lacks flexibility.

         2. Default routing: 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 generally configured on the stub network, with only one import and export, one of which is usually connected to a PC. (to avoid loops) The default route is a special static route.

3. Configure static routing

Experimental steps:

(1) Configure IP addresses, subnet masks and gateway addresses for the two PCs

 (2) Configure the IP address of router R1

<Huawei>sys                                                                    //Enter system view                                          
[Huawei]sys R1                                                                //Change router name
[R1]int g0/0/0                                                                    //Enter g0/0/0 interface
[R1-GigabitEthernet0/0/0]ip add 192.168. 1.254/24          //Configure g0 ip address

[R1-GigabitEthernet0/0/0]int g0/0/1                                 //Enter g0/0/1 interface         
[R1-GigabitEthernet0/0/1]ip add 192.168.3.1/24              //Configure IP address

(3) Configure the IP address of router R2

<Huawei>sys                                                                   //Enter system view                                          
[Huawei]sys R2                                                                //Change router name
[R2]int g0/0/0                                                                    //Enter g0/0/0 interface
[R2-GigabitEthernet0/0/0]ip add 192.168. 3.2/24             //Configure g0 ip address

[R2-GigabitEthernet0/0/0]int g0/0/1                                  //Enter g0/0/1 interface         
[R2-GigabitEthernet0/0/1]ip add 192.168.4.1/24             //Configure IP address

(3) Configure the IP address of router R3

<Huawei>sys                                                                    //Enter system view                                          
[Huawei]sys R2                                                                //Change router name
[R1]int g0/0/0                                                                    //Enter g0/0/0 interface
[R1-GigabitEthernet0/0/0]ip add 192.168. 4.2/24             //Configure g0 ip address

[R1-GigabitEthernet0/0/0]int g0/0/1                                 //Enter g0/0/1 interface         
[R1-GigabitEthernet0/0/1]ip add 192.168.2.254/24         //Configure IP address

(4) Configure static routing information for the three routers. Add non-directly connected network segments, subnet masks, and next-hop addresses to the routing table (two methods)

Method one:

①R1 sets the default route

    [R1]ip route-static 0.0.0.0 0.0.0.0 192.168.3.2          //any network segment, any subnet mask, next hop address

②R2 sets static routing

    [R2]ip route-static 192.168.1.0 24 192.168.3.1                   //Non-directly connected network segment subnet mask next hop address
    [R2]ip route-static 192.168.2.0 24 192.168.3.2                  //Non-directly connected network segment subnet mask next hop address

③R3 sets the default route

    [R3]ip route-static 0.0.0.0 0.0.0.0 192.168.4.1           //any network segment, any subnet mask, next hop address

Law 2:

①R1 sets static routing

    [R1]ip route-static 192.168.4.0 24 192.168.3.2                //Configure the routing information for the network segment 10.1.3.0

    [R1]ip route-static 192.168.2.0 24 192.168.3.2               //Configure the routing information for the network segment 10.1.4.0

②R2 sets static routing

    [R2]ip route-static 192.168.1.0 24 192.168.3.1              //Configure the routing information for the network segment 10.1.1.0

    [R2]ip route-static 192.168.2.0 24 192.168.4.2              //Configure the routing information for the network segment 10.1.4.0

③R3 set static routing

    [R3]ip route-static 192.168.1.0 24 192.168.4.1             //Configure the routing information for the network segment 10.1.1.0

    [R3]ip route-static 192.168.3.0 24 192.168.4.1             //Configure the routing information for the network segment 10.1.2.0

 

④ Use PC1 to ping PC2

The experiment was successful!

Guess you like

Origin blog.csdn.net/shitianyu6/article/details/125787022