The relationship between static routing and default routing: Static routing is routing information manually added by the administrator, and default routing is a special static routing. If there is no default route, the data packet whose destination address does not have a matching entry in the routing table will be discarded.
Static routing configuration command: [Router]ip route-static network mask address
network : destination network address
*mask:*subnet mask (a number can be abbreviated)
*address:*the interface address
of the next hop router to reach the destination network :Ip route-static 192.168.10.0 24 12.0.0.2
Default route configuration command: [Router]ip route-static 0.0.0.0 0.0.0.0 address
*0.0.0.0 0.0.0.0:* represents any network, data sent to any network Packets are forwarded to the next router interface address specified by the command
*address:*The interface address
of the next hop router to reach the destination network. Example: ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
Case number one:
1.1 Configure PC1 IP address
ip address: 192.168.10.10
Subnet mask: 255.255.255.0
Gateway: 192.168.10.1
1.2 Configure PC2 IP address
ip address: 192.168.20.10
Subnet mask: 255.255.255.0
Gateway: 192.168.20.1
2.1 Configure the IP address of the R1 interface
1. Enter int g0/0/0 to enter the interface
2. Enter the command ip add 12.0.0.1 24 to set the IP address and subnet mask for
this interface 3. Enter the command undo shutdown to enable the interface
4. Enter int e0/0/0 to enter the interface
5. Enter the command ip add 192.168.10.1 24 to set the IP address and subnet mask for
this interface 6. Enter the command undo shutdown to enable this interface
2.1 Configure the IP address of the R2 interface
1. Enter int g0/0/0 enters interface
2. Enter the command ip add 12.0.0.2 24 to set the IP address and subnet mask for
this interface 3. Enter the command undo shutdown to enable this interface
4. Enter int e0/0/0 to enter the interface
5. Enter the command ip add 192.168.20.1 24 to set the IP address and subnet mask of
this interface 6. Enter the command undo shutdown to enable this interface
3.1 Configure R1 as a static route
ip route-static 192.168.20.0 24 12.0.0.2
3.2 Configure R2 as a static route
ip route-static 192.168.10.0 24 12.0.0.1
4. The test found that it can be pinged
Case 2:
1.1 Configure PC1 IP address
ip address: 192.168.10.10
Subnet mask: 255.255.255.0
Gateway: 192.168.10.1
1.2 Configure PC2 IP address
ip address: 192.168.20.10
Subnet mask: 255.255.255.0
Gateway: 192.168.20.1
2.1 Configure the IP address of the R1 (Ra in the figure) interface
1. Enter int g0/0/0 to enter the interface
2. Enter the command ip add 192.168.10.1 24 to set the IP address and subnet mask of this interface
**Note: * *Enter the command undo shutdown here to enable this interface. Because the interface is already enabled in the figure, this command is not entered
. 3. Enter int g0/0/1 to enter the interface
4. Enter the command ip add 12.0.0.1 24 for the IP address And subnet mask settings
**Note: **Enter the command undo shutdown to enable this interface, because the interface has been enabled in the figure, this command is not entered
2.2 Configure the IP address of the R2 (Rb in the figure) interface
1. Enter int g0/0/1 to enter the interface
2. Enter the command ip add 12.0.0.2 24 to set the IP address and subnet mask for this interface
3. Enter the command undo shutdown to enable this interface
4. Enter int g0/0/3 to enter the interface
5. Enter the command ip add 23.0.0.2 24 to set the IP address and subnet mask for
this interface 6. Enter the command undo shutdown to enable this interface
2.3 Configure the IP address of the R3 (Rc in the figure) interface
1. Enter int g0/0/3 to enter the interface
2. Enter the command ip add 23.0.0.3 24 to set the IP address and subnet mask for this interface
3. Enter the command undo Shutdown enables this interface
4. Enter int g0/0/0 to enter the interface
5. Enter the command ip add 192.168.20.1 24 to set the IP address and subnet mask for
this interface 6. Enter the command undo shutdown to enable this interface
3.1 Configure R1 as the default route
Enter the command ip route-static 0.0.0.0 0.0.0.0 12.0.0.2 to complete the configuration
3.2 Configure two static routes
for R2 Enter the command ip route-static 192.168.10.0 24 12.0.0.1
Enter the command ip route-static 192.168.20.0 24 12.0.0.3 Complete the configuration
3.3 Configure R3 as the default route
Enter the command ip route-static 0.0.0.0 0.0.0.0 23.0.0.2 to complete the configuration
4 Test found that it can be pinged
Case three
1 Configure PC3 IP address
ip address: 192.168.10.10
Subnet mask: 255.255.255.0
Gateway: 192.168.10.1
2.1 Configure the IP address of R1 interface
2.2 Configure the IP address of R2 interface
2.3 Configure the IP address of R3 interface
3.1 Configure R1 static route and priority
3.2 Configure R2 static route and priority
3.3 Configure R3 static route
4 Default when R1 and R2 are connected Select this path and
find that it can be pinged
When R1 and R2 are disconnected, select the path of R2——>R3——>R1.
At this time, it can be pinged.