Configure static routes and default routes

Source: Internet
Author: User
Tags min

Experimental content: Configuration of static routes and default routes

Experimental environment: Cisco Packet Tracer simulator

Experimental principle:

Routing protocol is an important part of router software.

Routers to choose the best communication route between interconnected networks are accomplished through these routing protocols.

The role of routing protocols is also to establish and maintain routing tables.

The routing table is used to select an output port or a next hop address for each IP packet.

Routers can only implement communication with a network that is directly connected to it when no route is configured, and in order to communicate over a wider range of networks, routing configuration is required, including static routes, default routes, and dynamic routing.

1. Static routing

is a manual configuration by the network management routing path, network management must understand the topology of the router connection, manually specify the route path, and in the network topology changes, you also need to manually modify the routing path management.

2. Default route

It is also a routing path that is manually configured by the network management, which causes the router to send packets that are not recognized by the address through the specified path, which is processed by other routers. The default route can be seen as a special case of static routing and is less costly to maintain.

3. Dynamic routing

is a routing protocol, the router learns from the route, it does not need to manually configure, and can automatically change with the network environment changes, maintenance cost is very low, especially suitable for a wide range of routes.

Iii. Key Commands

Key commands for this experiment:

Mode Command Function
(config) # IP Route address Subnet-mask address Setting up static routes
(config) # No IP route address Subnet-mask address To delete a static route
(config) # IP Route 0.0.0.0 0.0.0.0 address Set default route
(config) # No IP route 0.0.0.0 0.0.0.0 address Delete default route
# Show IP route View the routing table
# Show IP Interface Brief View Port Summary

Here is the configuration of the static route:

First, configure the router's Ethernet interface based on the topology diagram.

Once configured, start testing connectivity between routers.

First ping routers R2 and R3 from the R1 router

Ping Router R2

Router#ping 10.1.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:

!!!!!

Success rate is percent (5/5), round-trip Min/avg/max = 20/20/20 ms

Ping Router R3

Router#ping 192.168.1.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:

.....

Success rate is 0 percent (0/5)

The 192.168.1.1 port from R0 to R1 is a ping across the network segment and does not have a ping pass.

View the next Routing table

Router#show IP route

CODES:C-connected, s-static, I-igrp, R-rip, M-mobile, B-BGP

D-EIGRP, Ex-eigrp External, O-OSPF, IA-OSPF Inter area

N1-OSPF NSSA External Type 1, N2-OSPF NSSA external type 2

E1-OSPF external Type 1, E2-OSPF external type 2, E-EGP

I-is-is, L1-is-is level-1, L2-is-is level-2, ia-is-is Inter area

*-Candidate default, U-per-user static route, O-ODR

P-periodic downloaded static route

Gateway of last resort are not set

10.0.0.0/24 is subnetted, 1 subnets

C 10.1.1.0 is directly connected, fastethernet0/0

。 At this point the ICMP message can be sent from R0 to R2, and R2 cannot send the ICMP message to R0.

The reason is that there is no routing information sent to R0 on R 2. Use the debug IP packet and debug IP ICMP commands to monitor the transmission of IP packets and ICMP packets. (You can turn debug off with the Undebug All command after monitoring)

Router#debug IP Packet

Packet Debugging is on

router#

Ip:tableid=0, s=10.1.1.2 (fastethernet0/0), d=192.168.1.2 (fastethernet0/0), routed via RIB

ip:s=10.1.1.2 (fastethernet0/0), d=192.168.1.2 (fastethernet0/0), Len, Rcvd 3

ip:s=192.168.1.2 (local), d=10.1.1.2 Len, unroutable

The results are verified.

At this point, you need to add the routing information to the R0 network segment packet on the R2

Router#config T

Enter configuration commands, one per line. End with cntl/z.

Router (config) #ip Route 10.1.1.0 255.255.255.0 192.168.1.1

Router (config) #end

Router#show IP route

Gateway of last resort are not set

10.0.0.0/24 is subnetted, 1 subnets

S 10.1.1.0 [1/0] via 192.168.1.1

C 192.168.1.0/24 is directly connected, fastethernet0/0

This allows the router R 0 to R2 connectivity between each other can be ping through.

Router#ping 10.1.1.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:

!!!!!

Success rate is percent (5/5), round-trip Min/avg/max = 40/42/50 ms

The following is the configuration of the default route:


Setting up the experimental environment according to the above topology

Now use PC01 to ping PC02, which is different from Ping, because there is no route between them.

Then let's do it. Configure default routes

Router#config Terminal
Enter configuration commands, one per line. End with cntl/z.
Router (config) #ip Route 0.0.0.0 0.0.0.0 192.168.2.2

Router>enable
Router#show IP route
CODES:C-connected, s-static, I-igrp, R-rip, M-mobile, B-BGP
D-EIGRP, Ex-eigrp External, O-OSPF, IA-OSPF Inter area
N1-OSPF NSSA External Type 1, N2-OSPF NSSA external type 2
E1-OSPF external Type 1, E2-OSPF external type 2, E-EGP
I-is-is, L1-is-is level-1, L2-is-is level-2, ia-is-is Inter area
*-Candidate default, U-per-user static route, O-ODR
P-periodic downloaded static route

Gateway of last resort are 192.168.2.2 to network 0.0.0.0

C 192.168.1.0/24 is directly connected, fastethernet0/0
C 192.168.2.0/24 is directly connected, FASTETHERNET0/1
s* 0.0.0.0/0 [1/0] via 192.168.2.2

From the above routing information, we can see the default route information s* 0.0.0.0/0 [1/0] via 192.168.2.2

When the pc01 ping Pc02, the ICMP packet arrives at the router R0, the router R0 does not have the static or the dynamic routing table, does not know how to forward, the router R0 according to the default router to give the next hop address, the unrecognized packet forwards to the next hop address 192.168.2.2,

After the router R2 is received, the destination address is found to be directly connected to itself and forwarded to the target. Now PC01 can send PC02 packets, but PC02 still can not give PC01 sent packets ah.

That's because when PC02 ping PC01, you also need a route.

Then we'll be on the router R1 with the corresponding default route.

Router (config) #ip Route 0.0.0.0 0.0.0.0 192.168.2.1


Now we ping pc02,ping on the PC01, the experiment is done.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.