1 static routes and default routes
Introduced:
When the router forwards the data, it needs to find the appropriate route in the routing table now, there are three ways
(1) Direct-connect Routing: Routers automatically add and own direct-attached routes
(2) Static routing: Routes added manually by an administrator
(3) Dynamic routing: a route established dynamically by a routing protocol
The disadvantage of static routing is that the network topology cannot be reflected dynamically, and when the network changes, the administrator must manually change the routing
The advantage is that it does not take up too much CPU and RAM resources on the router, and it does not consume too much bandwidth.
If you want to hide some parts of the network for security reasons or if the administrator wants to control the data forwarding path, you can also use static routing, and a small network can also configure static routing because it is convenient
The command for configuring static routes is the "IP route" below.
IP route 192.168.1.0 255.255.255.0 s0/0
IP route 192.168.1.0 255.255.255.0 12.1.1.1
Note: When writing a static route, if the link is a point-to-dot network (or PPP-encapsulated link, etc.), the interface mode or gateway can
If it is a multi-access link, you can only use the gateway format
R1#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
R 172.160.0.0/16[120/2]via 10.1.0.2,00;00;21, serial0/0
[120/2]via 10.3.0.2,00;00;06,SERIAL0/1
10.0.0.0/16 is subnetted, 4 subnets
R 10.2.0.0[120/1]via 10.1.0.2,00;00;21,serial0/0
C 10.3.0.0 is directly connected, SERIAL0/1
C 10.1.0.0 is directly connected, serial0/0
R 10.4.0.0[120/1]via 10.3.0.2,00;00;06, SERIAL0/1
C 192.168.1.0/24 is directly connected, fastethernet0/0
: "C" is a static route for the direct-attached network "S". "R" means that this route is learned by the "RIP" protocol, "10.2.0.0" is the destination network; "[120/1]" is the administrative distance (administrative Distance, AD)/measure (Metric); "Via 10.1.0.2" is the IP address of the next-hop router to the destination network; "00;00;21" is the last time the router has been informed of the route to the present; "serials0/0" means the port from which the next hop should be reached.
Technical points:
The administrative distance (AD) is used to represent the trustworthiness of the route, the router may obtain the same path from many ways, the smaller the management distance value in the routing table, the higher the reliability of the route,
Default administrative distance for routing protocols
Routing protocol |
Manage distance |
Straight Connection Port |
0 |
Static routes |
1 |
External BGP |
20 |
Internal EIGRP |
90 |
IGRP |
100 |
Ospf |
110 |
Technical points:
Measure: (Metric) A routing protocol to determine the best way to reach the destination network path. When a router has multiple paths to a destination network, the routing protocol determines which one is best placed in the routing table, and the routing protocol calculates a value for each path, which is a measure, with no units. The smaller the measure, the better the path. Measure methods defined by different routing protocols no, the best path chosen may not be the same
Default route
Refers to the route that the router will eventually take if it cannot find a specific route to the destination in the routing table, and the default route is usually used in the egress network
The command is: IP route 0.0.0.0 0.0.0.0 {gateway Address | interface}
In the following: IP route 0.0.0.0 0.0.0.0 s0/0
IP Route 0.0.0.0 0.0.0.0 12.12.12.12
IP classless:
See this figure if the default route is configured on R1: IP route 0.0.0.0 0.0.0.0 s0/0/0, then whether router R1 will send the network data that arrives 10.2.2.0/24 from the s0/0/0 interface will depend on whether the IP classless command is executed , if the router has a default route when it executes (which is actually the default), all packets that do not find a specific route in the routing table will be sent through the default route
If "No IP classless" is executed, when the router has a subnet of a main class network, the router will assume that it already knows the route of all subnets of the network's main class network, so that if there is a default route, the packets arriving at the main class chair will not be sent through the default route. After the "No IP classless" is executed in the figure, the router R1 receives a packet that arrives at the 10.2.2.0/24 subnet because the router R1 has a 10.0.0.0 subnet 10.1.1.0/24 (which is a direct-attached route), which is not sent using the default route. However, if the packet is to be up to 20.2.2.0/24, the default route is adopted because R1 does not have any 20.0.0.0 subnet routes