Static Routing and default Routing

Source: Internet
Author: User

II. Introduction to default and static routes
 
Note:
This is a small experiment I used to study at school. I will share it with you.
If you have any questions in the following command explanation and experiment, you can @ yourself. This is my contact information QQ: 914560310, YY: 283755973.
---------------------------------------
First, let's talk about the concept of Static Routing and default routing:

  1. Static Routing
When forwarding data on a vro, you must first find the route in the routing table to which the data to be forwarded is to reach the destination. There are three ways for a router to create a route table.
<1> direct connection network: The network connected by the router.
<2> Static Routing: The route entry manually entered by the Administrator.
<3> Dynamic Routing: A route dynamically established by the routing protocol. Advantages of Static Routing: Because dynamic routing requires frequent exchange of Route tables between routers, you can know the network topology, network address, and other information based on the analysis of the route table. Therefore, for the sake of network security, Static Routing is much safer, and Static Routing saves resources and bandwidth.
The command for configuring Static Routing is: ip route 192.168.1.0 255.255.255.0 followed by the next hop interface or address.
------------------------------------
2. Default route
The default route uses the default route when the route table cannot find the specific route to the destination. It is usually used in the entire network, also known as the stub network. As shown in


When the most external router in our network is connected to the Internet, this router is called the remote network.
------------------------------------

Here is a small experiment on Static Routing and default routing:



To enable communication between the loopback ports 1.1.1.0/24, 2.2.2.0/24, and 3.3.3.0/24 on each vro, follow these steps.
First, we configure each vro to Ensure network connectivity (remember to configure the loopback port ),. Take a vro as an example:
 
Router # configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router (config) # int lookpback0
 
% Invalid input detected at '^' marker.
 
Router (config) # int loopback 0 // enable a loopback port on Router R1 for experiment, which is equivalent to a simulated network.
 
% LINK-5-CHANGED: Interface Loopback0, changed state to up
 
% LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
 
Router (config-if) # ip address 1.1.1.1 255.255.0
Router (config-if) # exit
Router (config) # interface serial 0/3/0 // enter the WAN interface
Router (config-if) # ip address 192.168.12.1 255.255.0
Router (config-if) # no shutdown
 
% LINK-5-CHANGED: Interface Serial0/3/0, changed state to down
Router (config-if) # clock rate 64000 // configure the clock on the wide area network port. The wide area network port has some DTE devices and some DCE devices, in case of errors, you must set the clock on each port to communicate with the same device.
Router (config-if) # exit
Router (config) # hostname R1 // to facilitate the experiment, change the vro name to R1
R1 (config )#
 
After each vro is configured, we will find that the vro can communicate with its own directly connected route. Then we configure static routes on each vro to achieve our ultimate goal, so that the loopback on each vro can communicate with each other:
R1 (config) # ip route 2.2.2.0 255.255.255.0 s0/3/0
// There are two ways to configure the default route. This is the interface for the next hop, and s0/3/0 is a point-to-point link. Note: This should be s0/3/0 on R1.
R1 (config) # ip route 3.3.3.0 255.255.255.0 192.168.12.2
// This method is the IP address of the next hop. Note: 192.168.12.2 is the IP address of R2.
 
R2 (config) # ip route 1.1.1.0 route 255.255.0 s0/3/0
R2 (config) # ip route 3.3.3.0 route 255.255.0 s0/3/1
 
R3 (config) # ip route 1.1.1.0 255.255.0 s0/3/1
R3 (config) # ip route 2.2.2.0 255.255.255.0 s0/3/1
 
At this point, we will complete the configuration of this experiment. The following is an experiment debugging. If we confirm that we have not done anything wrong, we can view our route table on each vro. Let's see if there are any errors. This is the R1 route table example in the experiment:
R1 # shwo ip route
^
% Invalid input detected at '^' marker.

R1 # show ip route
Codes: C-connected, S-static, I-IGRP, R-RIP, M-mobile, B-BGP
D-OSPF, EX-VPN 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, L1-IS level-1, L2-IS level-2, ia-IS inter area
*-Candidate default, U-per-user static route, o-ODR
P-periodic downloaded static route
 
Gateway of last resort is not set
 
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 is directly connected, Serial0/3/0 // S0/3/0 in this region refers to the next hop exit
3.0.0.0/24 is subnetted, 1 subnets
S 3.3.3.0 [1/0] via 192.168.12.2 // this IP address is the next hop exit
C 192.168.12.0/24 is directly connected, Serial0/3/0
// "C" indicates a directly connected device and "S" indicates a static route. Let's take a look at the CIDR Block of the static route we set, and there is no error with the exit.
 
If no error is found, ping each other using the loopback port to check the result.
When loopback port pingR3 lookback on R1, you will find that the ping fails.
R1 # ping 3.3.3.3
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
// The above cannot be pinged, because when the ping command is used, if the source interface is not specified, the R1 router uses the IP address of the s0/0/0 interface (192.168.1.2.1) as the source IP address of the IP packet. When R3 responds to the R1 packet, the packet is sent to 192.168.12.1. However, because R3 does not have a route of 192.168.12.0/24, data packets cannot be sent. That is, once the packet owner R1 reaches R3, R1 cannot be returned.
 
We use the default route for debugging to achieve our ultimate goal.
First, delete the original static routes on R1 and R3.
R1 (config) # no ip route 2.2.2.0 255.255.255.0 s0/3/0
R1 (config) # no ip route 3.3.3.0 255.255.255.0 192.168.12.2
// To delete a route, add no before the original command.
R3 (config) # no ip route 1.1.1.0 route 255.255.0 s0/3/1
R3 (config) # no ip route 2.2.2.0 route 255.255.0 s0/3/1
 
Then we configure the default route on both R1 and R3.
R1 (config) # iproute 0.0.0.0 0.0.0.0 s0/3/0
R3 (config) # ip route 0.0.0.0 0.0.0.0 s0/3/1
 
 
Have you learned about Static Routing and default routing through the above experiment? Now you can ping it. Let's make a comparison. Think more,

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.