There are only two ways to do a router: one is path selection and the other is data forwarding. It is relatively easier to forward data, but the difficult thing is how to determine the best path to the destination network. Therefore, path selection has become the most important task of the router.
Many routing protocols can perform path selection, common ones include RIP, OSPF, IGRP and EIGRP protocols, etc. Among these algorithms, we cannot simply say who is better or worse, because the advantages and disadvantages of the algorithm are... The thermal IP protocol, which sometimes cannot accurately select the optimal path, and the convergence time is a little longer. However, for small-scale networks without professional maintenance, it is the preferred routing protocol, and what we value is its simplicity.
If you have a small network project at hand, then let's arrange a plan to read this article in 30 minutes (first reading), and then read the commands and operation methods mentioned in this article in 20 minutes (second reading), and use 30 minutes to configure all routers on the network (small network, few routers can be equipped with). In the last 20 minutes, check whether the network is working properly. OK, in one hundred minutes, your RIP network is running. It's that simple, don't believe it, please continue reading.
1. What is RIP?
RIP (Routing Information Protocols) is the most widely used distance vector protocol. It was developed by Xerox in the 1970s. At that time, RIP was part of the XNS (Xerox Network Service) protocol cluster. The TCP/IP version of RIP is an improved version of the Xerox protocol. The biggest feature of RIP is that it is very simple in both implementation principles and configuration methods.
Measuring method
The RIP measurement is based on the hop count. For each router passing through, the hop count of the path is added to one. In this way, the more hops, the longer the paths will be, and the RIP algorithm will prefer paths with fewer hops. The maximum number of hops supported by RIP is 15, and networks with hops of 16 are considered unreachable.
Routing update
Updates to routes in RIP are achieved through timed broadcasting. By default, the router broadcasts its own routing table to the network connected to it every 30 seconds, and the router that receives the broadcast adds the received information to its own routing table. Every router broadcasts this way, and eventually all routers on the network will know all the routing information. Under normal circumstances, the router can receive a routing information confirmation every 30 seconds. If 180 seconds, that is, 6 update cycles, and no routing item is confirmed, the router will consider it to be invalid. If 240 seconds, that is, 8 update cycles, the routing item is still not confirmed, it is deleted from the routing table. The above 30 seconds, 180 seconds and 240 seconds delays are controlled by the timer, which are the update timer (Update Timer), the invalid timer (Invalid Timer) and the refresh timer (Flush Timer).
Routing loop
The algorithm of the distance vector class is prone to generate routing loops, and RIP is a kind of distance vector algorithm, so it is no exception. If there is a routing loop on the network, the information will be passed on loop and will never reach the destination. To avoid this problem, the RIP equidistance vector algorithm implements the following four mechanisms.
? Horizon split horizon. Horizontal segmentation ensures that the router remembers the source of each routing information and does not send it again on the port where it received it. This is the most basic measure to ensure that no routing loops occur.
? Poison reverse. When a path information becomes invalid, the router does not immediately delete it from the routing table, but broadcasts it with 16, that is, unreachable metrics. This increases the size of the routing table, but is helpful in eliminating the routing loop, which can immediately clear any loops between adjacent routers.
? Trigger update. When the routing table changes, the update message is immediately broadcast to all neighboring routers instead of waiting for the 30-second update cycle. Similarly, when a router just starts RIP, it broadcasts request messages. The adjacent router receiving this broadcast immediately answers an update message without having to wait until the next update cycle. In this way, changes in network topology will spread on the network as quickly as possible, reducing the possibility of routing loops.
? Suppress timer (holddown timer). After a route information is invalid, the route is in a suppressed state for a period of time, that is, no route updates about the same destination address will be received for a certain period of time. If the router knows that one path is invalid from one network segment, then immediately knows that the route is valid on another network segment. This valid information is often incorrect, and suppression timing avoids this problem. Moreover, when a link starts and stops frequently, suppression timing reduces route floating and increases network stability.
Even with the above four methods, the problem of routing loop cannot be completely solved, but it has been minimized. Once the routing loop really occurs, the measurement value of the routing term will be counted to infinity. This is because the routing information is transmitted loopfully. Every time a router is passed through, the metric value is added 1, and all the way to 16, the path becomes unreachable. It is clever to choose RIP 16 as an unreachable measure. It is both large enough to ensure that most networks can operate normally and small enough to make the time it takes to count to infinity the shortest.
Neighbor
Some networks are NBMA (Non-Broadcast MultiAccess), that is, broadcast transmission data is not allowed on the network. For such networks, RIP cannot rely on broadcast delivery routing tables. There are many solutions, the easiest one is to specify a neighbor, that is, to specify the routing table to a specific router.
Flaws of RIP
Although RIP is simple and easy to use and has been tested for a long time, it also has some very important flaws, mainly as follows:
? It is too simple, and the measurement value is calculated based on the hop number, and non-optimal routes are often obtained;
?The measurement value is limited to 16, which is not suitable for large networks;
? Poor security, accept route updates from any device;
? Classless IP addresses and VLSM are not supported (Variable Length Subnet Mask, variable-length subnet mask);
? The convergence is slow, and the time is often greater than 5 minutes;
?The bandwidth consumes a lot.
2. How to match the router
The router itself is a computer with multiple network interfaces. Like ordinary computers, it also has components such as central processing unit (CPU), system main memory (RAM), and read-only memory (ROM).
In addition, a very important part is its network interface. In order to connect different types of networks, there are many types of network interfaces for routers, such as Ethernet, Fast Ethernet, Token Ring interfaces applied in LANs, V.35, RS232, ISDN BRI PRI interfaces, etc. used in WAN.
There are two main external memory of routers: NVRAM (Non-Volatile RAM, nonvolatile RAM) and Flash (Flash). NVRAM stores the router's configuration file, Flash is used to store the operating system IOS (Internet Operating System).
Configuration mode
There are two basic configuration modes for CISCO routers: user (user) and privileged. In user mode, only the status of the router can be displayed, and privileged mode can also change the router's configuration.
In privileged mode, you can enter the installation mode, global configuration mode, and local configuration mode.
?The installation mode provides menu prompts to guide users to perform basic router configuration. After the new router is started for the first time, it will automatically enter the installation mode.
? In the global configuration mode, the global parameters of the router can be changed, such as host name, password, etc.
? Local configuration changes the local parameters of the router, such as the configuration of a certain network interface, the configuration of a certain routing protocol, etc.
Configuration method
There are many ways to configure a router, and the following five are the most common:
?Use the hyperterminal tool to log in to the console (console port) through the serial port.
? Connect the modem to the auxiliary port of the router and log in to the console remotely.
?Remote login (telnet) to a certain IP address of the router, and access the router through VTY (virtue terminal line, virtual terminal).
?Edit the configuration file and upload it to the router via TFTP.
?Remotely set router parameters through network management software (network management system).
Install the router
Suppose there are only three routers in our project network. The network topology is as follows:
They are placed in Beijing, Shanghai and Tianjin, and are named testBJ, testSH and testTJ respectively. We use Class B to reserve IP address 172.16.0.0, and divide four subnets into 172.16.1.0, 172.16.2.0, 172.16.3.0 and 172.16.4.0, and the subnet masks are all 255.255.255.0.
Basic configuration
Connect one end of the serial cable included in the package to the console port of the Beijing router, and the other end to the computer's com port. Start the hyperterminal program (in Win95/NT), make appropriate configuration, and connect to the router. Power on the router, type several carriage return in succession, and the following prompt appears, showing that the router is in user mode.
testBJ>
Transfer from user mode to privileged mode and use the enable command.
testBJ> enable
testBJ#
Like UNIX hosts, "#" represents a system prompt for a privileged (root) user, which means you are entering privileged mode. Contrary to enable, that is, the command to return to user mode from privileged mode is disabled.
In privileged mode, you can use the config terminal command to enter the global configuration mode. In global configuration mode, you can use the names of some configuration subkeys to enter local configuration mode. The returned methods are all exit commands. Among them, the command to directly return to the privileged mode from the local configuration mode is end. As shown below.
testBJ#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
testBJ(config)#router rip
testBJ(config-router)#exit
testBJ(config)#exit
testBJ#
A very attractive feature of CISCO IOS is its command line help, a? solves all problems. ?You can display the command list in the current mode, display the full name of the command, and also display the command parameters and help information. Type? anywhere you are not sure about the command and the system will give a prompt message.
The CISCO router also supports command abbreviation function. As long as there is no ambiguity, the first few characters of the command can be replaced by the entire command. In this way, the typing workload during configuration will be much smaller.
All configuration information of the router is stored in the configuration file. The configuration file currently in use is running-config, which is stored in the system memory. Our configuration modifications in privileged mode will be immediately reflected in the running-config. startup-config is a configuration file stored in NVRAM, only it is powered down and not lost, so if you want the modifications to remain valid until the next startup, you must save the current configuration. The saving command is as follows:
testBJ#copy running-config startup-config
Building configuration...
[OK]
testBJ#
Change the router name and password
The name of the router can be modified using the hostname command.
Router(config)#hostname testBJ
testBJ(config)#
The enable password and enable secret commands can modify the password in the privileged mode.
testBJ(config)#enable password cisco
testBJ(config)#enable secret cisco
Enter the line console local configuration mode and modify the console login password; enter the line vty local configuration mode and modify the telnet login password. The login command indicates that login is required, and the commands for modifying the password are passwords.
testBJ(config)#line console 0
testBJ(config-line)#password cisco
testBJ(config-line)#exit
testBJ(config)#line vty 0 4
testBJ(config-line)#login
testBJ(config-line)#password cisco
Test connectivity
Open the other two routers, configure them according to the above method, and then you can check whether they are connected.
There are three ways to test line connectivity: ping, traceroute and telnet. ping can detect whether the destination is reachable; trace not only detects connectivity, but also gives the path to reach the destination; telnet tests the connectivity of the application layer software, as shown below.
testBJ#ping 172.16.4.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.4.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/25/28 ms
testBJ#traceroute 172.16.4.2
Type escape sequence to abort.
Tracing the route to 172.16.4.2
1 172.16.2.2 16 msec 16 msec *
testBJ#telnet 172.16.4.2
Trying 172.16.4.2 ... Open
User Access Verification
Password:
testTJ>
172.16.4.2 is a port on the router testTJ. We run the above three commands on testBJ and we know that it is running normally.
Show current status
To enable network administrators to easily understand the status of the router, CISCO routers provide rich show commands. We introduce the simplest ones here, as shown below.
The show version command displays the router's hardware and software version number and configuration information.
show flash: The command is equivalent to the DOS dir command, displaying the file information contained in flash.
show interface command displays the status of the network interface.
In the process of configuring a router, the most important show command is to view the content of the configuration file. You can use the show command to view running-config or startup-config, as shown below.
show running-config
show startup-config
A configuration file is a text file that contains each configuration command you type. You can download the configuration file to your computer, modify it with a text editor, and then pass it back to the router.
3. What should RIP match?
IP address configuration
We can use the interface command to enter the local configuration mode, and then use the ip address to set the IP address of the interface. As shown below.
testBJ#conf t
Enter configuration commands, one per line. End with CNTL/Z.
testBJ(config)#interface e0/1
testBJ(config-if)#ip address 172.16.1.2 255.255.255.0
testBJ(config-if)#
For easy configuration and memory, you can also add some description information to each port. As shown below, use the description command in port local configuration mode.
testBJ(config-if)#description connect to testSH
testBJ(config-if)#end
testBJ#
Some networks are NBMA (Non-Broadcast MultiAccess), that is, broadcast transmission data is not allowed on the network. For such networks, RIP cannot rely on broadcast delivery routing tables. There are many solutions, the easiest one is to specify a neighbor, that is, to specify the routing table to a specific router.
Some networks are NBMA (Non-Broadcast MultiAccess), that is, broadcast transmission data is not allowed on the network. For such networks, RIP cannot rely on broadcast delivery routing tables. There are many solutions, the easiest one is to specify a neighbor, that is, to specify the routing table to a specific router.
RIP configuration
RIP is the easiest routing protocol to configure. Configuring it requires only two steps. First, specify the RIP protocol, and then declare the network number you are connected to, as shown below.
testBJ(config)#router rip
testBJ(config-router)#network 172.16.0.0
testBJ(config-router)#end
testBJ#
The router rip command is used to specify the use of RIP protocol. The network command declares the network number. Since RIP is a class-based routing protocol, there is no need to declare each subnet number.
Repeat the above operation for each router, and a network that uses RIP routing will be built.
Test configuration correctness
After configuring RIP, check whether the data can be routed correctly. In addition to using the connectivity testing tool mentioned above, there are also the following commands:
?sh ip route is used to detect routing tables;
?sh ip protocols is used to check the status of the routing protocol;
? debug ip rip is used to debug RIP protocol information.
Use the sh ip route command to display the routing tables of each router.
testBJ#sh 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,
* - candidate default, U - per-user static route, o - ODR
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 4 subnets
R 172.16.4.0 [120/1] via 172.16.2.2, 00:00:12, Serial1/0
C 172.16.1.0 is directly connected, Ethernet0/1
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.1.3, 00:00:09, Ethernet0/1
[120/1] via 172.16.2.2, 00:00:22, Serial1/0
The above is the routing information of the Beijing router. The letter C starts with a direct connection network, with 172.16.1.0 and 172.16.2.0, respectively connected to the e0/1 and s1/0 ports. The letter R begins with the route learned by the RIP protocol, with 172.16.3.0 and 172.16.4.0, of which, there are two paths to choose from, 172.16.3.0, via testSH and testTJ routers respectively. Comparing the network topology diagram, we can see that the actual situation is exactly the same as the design.
The content in the brackets is the management distance and measurement value of the routing item. The default management distance of RIP is 120, and the measurement value that reaches the 3 and 4 subnets is 1, that is, it can be reached through 1 router.
The same command runs on two other routers, and the result is as follows.
testSH#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 4 subnets
R 172.16.4.0 [120/1] via 172.16.3.2, 00:00:13, Ethernet0/0
C 172.16.1.0 is directly connected, Ethernet0/1
R 172.16.2.0 [120/1] via 172.16.1.2, 00:00:11, Ethernet0/1
[120/1] via 172.16.3.2, 00:00:13, Ethernet0/0
C 172.16.3.0 is directly connected, Ethernet0/0
testTJ#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 4 subnets
C 172.16.4.0 is directly connected, Ethernet0/0
R 172.16.1.0 [120/1] via 172.16.3.3, 00:00:07, Ethernet0/1
[120/1] via 172.16.2.3, 00:00:19, Serial1/0
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Ethernet0/1
When analyzing the output of the above command, you must refer to the topology diagram at any time. If you leave the network topology, the above information has no meaning. The flexibility of dynamic routing is reflected in the failure of a link, and the routing algorithm will automatically switch to the detour link. For example, we disconnect the serial cable between testBJ and testTJ, and after a period of time, check the routing table, as shown below.
testBJ#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.4.0 [120/2] via 172.16.1.3, 00:00:22, Ethernet0/1
C 172.16.1.0 is directly connected, Ethernet0/1
R 172.16.3.0 [120/1] via 172.16.1.3, 00:00:22, Ethernet0/1
We found that subnet 2 where the serial link is located is disconnected, and all packets to network 172.16.4.0 will circumvent the testSH router.
The sh ip protocols command can display the status of the current routing protocol, as shown below.
testBJ#sh ip protocols
Routing Protocol is "rip"
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: connected, rip
Default version control: send version 1, receive any version
Interface Send Recv Key-chain
Ethernet0/1 1 1 2
Serial1/0 1 1 2
Routing for Networks:
172.16.0.0
Routing Information Sources:
Gateway Distance Last Update
172.16.2.2 120 00:00:05
172.16.1.3 120 00:00:27
Distance: (default is 120)
From the command output, we can see the basic configuration of the RIP protocol. We can also know that the routers that exchange information with the current router include testTJ (172.16.2.2) and testSH (172.16.1.3). The last time the routing information was received was 5 seconds and 27 seconds respectively.
To learn more about exchanging routing information between routers, you can use the debug ip rip command. As shown below, after entering the command, information about receiving or sending RIP broadcasts appears on the console at a certain period of time.
testBJ#debug ip rip
RIP protocol debugging is on
testBJ#
RIP: received v1 update from 172.16.2.2 on Serial1/0
172.16.4.0 in 1 hops
172.16.3.0 in 1 hops
RIP: received v1 update from 172.16.1.3 on Ethernet0/1
172.16.4.0 in 2 hops
172.16.3.0 in 1 hops
RIP: sending v1 update to 255.255.255.255 via Ethernet0/1 (172.16.1.2)
subnet 172.16.4.0, metric 2
subnet 172.16.2.0, metric 1
RIP: sending v1 update to 255.255.255.255 via Serial1/0 (172.16.2.3)
subnet 172.16.1.0, metric 1
RIP: received v1 update from 172.16.1.3 on Ethernet0/1
172.16.4.0 in 2 hops
172.16.3.0 in 1 hops
RIP: received v1 update from 172.16.2.2 on Serial1/0
172.16.4.0 in 1 hops
172.16.3.0 in 1 hops
testBJ#no debug all
All possible debugging has been turned off
testBJ#
Details of RIP broadcast can be obtained from the above information. The router first receives the information from subnets 3 and 4 from testTJ, and then receives the information from subnets 3 and 4 from testSH. Among them, go to testTJ and go to testSH and go to testSH and go to testTJ. Therefore, the routing table reflects the distance from testTJ to subnet 4; the distance from subnet 3 is all hopped, so there are two parallel routes in the routing table.
After a period of time, the current router's update time reaches 30 seconds, so it broadcasts its own routing table information on both links. Note that when broadcast routing is updated, RIP adopts a horizontal segmentation mechanism, and the information learned from one port is not broadcast on this port, so the current router testBJ only sends the routing information of subnet 172.16.1.0.
Use the no debug all command to end the display of debug information. It should be noted that the debug command consumes router resources very much, so do not use it on routers that are busy with communication, otherwise the router will stop responding like a crash.
How about it, how much time did you take to read this article? Here are some routers and try to configure them, it’s not very difficult.
Experience the fun of network connection, and use this as the starting point for you to learn routers, such as IGRP, OSPF, HSRP, etc., but if you learn later, 100 minutes will not be enough...
Many routing protocols can perform path selection, common ones include RIP, OSPF, IGRP and EIGRP protocols, etc. Among these algorithms, we cannot simply say who is better or worse, because the advantages and disadvantages of the algorithm are... The thermal IP protocol, which sometimes cannot accurately select the optimal path, and the convergence time is a little longer. However, for small-scale networks without professional maintenance, it is the preferred routing protocol, and what we value is its simplicity.
If you have a small network project at hand, then let's arrange a plan to read this article in 30 minutes (first reading), and then read the commands and operation methods mentioned in this article in 20 minutes (second reading), and use 30 minutes to configure all routers on the network (small network, few routers can be equipped with). In the last 20 minutes, check whether the network is working properly. OK, in one hundred minutes, your RIP network is running. It's that simple, don't believe it, please continue reading.
1. What is RIP?
RIP (Routing Information Protocols) is the most widely used distance vector protocol. It was developed by Xerox in the 1970s. At that time, RIP was part of the XNS (Xerox Network Service) protocol cluster. The TCP/IP version of RIP is an improved version of the Xerox protocol. The biggest feature of RIP is that it is very simple in both implementation principles and configuration methods.
Measuring method
The RIP measurement is based on the hop count. For each router passing through, the hop count of the path is added to one. In this way, the more hops, the longer the paths will be, and the RIP algorithm will prefer paths with fewer hops. The maximum number of hops supported by RIP is 15, and networks with hops of 16 are considered unreachable.
Routing update
Updates to routes in RIP are achieved through timed broadcasting. By default, the router broadcasts its own routing table to the network connected to it every 30 seconds, and the router that receives the broadcast adds the received information to its own routing table. Every router broadcasts this way, and eventually all routers on the network will know all the routing information. Under normal circumstances, the router can receive a routing information confirmation every 30 seconds. If 180 seconds, that is, 6 update cycles, and no routing item is confirmed, the router will consider it to be invalid. If 240 seconds, that is, 8 update cycles, the routing item is still not confirmed, it is deleted from the routing table. The above 30 seconds, 180 seconds and 240 seconds delays are controlled by the timer, which are the update timer (Update Timer), the invalid timer (Invalid Timer) and the refresh timer (Flush Timer).
Routing loop
The algorithm of the distance vector class is prone to generate routing loops, and RIP is a kind of distance vector algorithm, so it is no exception. If there is a routing loop on the network, the information will be passed on loop and will never reach the destination. To avoid this problem, the RIP equidistance vector algorithm implements the following four mechanisms.
? Horizon split horizon. Horizontal segmentation ensures that the router remembers the source of each routing information and does not send it again on the port where it received it. This is the most basic measure to ensure that no routing loops occur.
? Poison reverse. When a path information becomes invalid, the router does not immediately delete it from the routing table, but broadcasts it with 16, that is, unreachable metrics. This increases the size of the routing table, but is helpful in eliminating the routing loop, which can immediately clear any loops between adjacent routers.
? Trigger update. When the routing table changes, the update message is immediately broadcast to all neighboring routers instead of waiting for the 30-second update cycle. Similarly, when a router just starts RIP, it broadcasts request messages. The adjacent router receiving this broadcast immediately answers an update message without having to wait until the next update cycle. In this way, changes in network topology will spread on the network as quickly as possible, reducing the possibility of routing loops.
? Suppress timer (holddown timer). After a route information is invalid, the route is in a suppressed state for a period of time, that is, no route updates about the same destination address will be received for a certain period of time. If the router knows that one path is invalid from one network segment, then immediately knows that the route is valid on another network segment. This valid information is often incorrect, and suppression timing avoids this problem. Moreover, when a link starts and stops frequently, suppression timing reduces route floating and increases network stability.
Even with the above four methods, the problem of routing loop cannot be completely solved, but it has been minimized. Once the routing loop really occurs, the measurement value of the routing term will be counted to infinity. This is because the routing information is transmitted loopfully. Every time a router is passed through, the metric value is added 1, and all the way to 16, the path becomes unreachable. It is clever to choose RIP 16 as an unreachable measure. It is both large enough to ensure that most networks can operate normally and small enough to make the time it takes to count to infinity the shortest.
Neighbor
Some networks are NBMA (Non-Broadcast MultiAccess), that is, broadcast transmission data is not allowed on the network. For such networks, RIP cannot rely on broadcast delivery routing tables. There are many solutions, the easiest one is to specify a neighbor, that is, to specify the routing table to a specific router.
Flaws of RIP
Although RIP is simple and easy to use and has been tested for a long time, it also has some very important flaws, mainly as follows:
? It is too simple, and the measurement value is calculated based on the hop number, and non-optimal routes are often obtained;
?The measurement value is limited to 16, which is not suitable for large networks;
? Poor security, accept route updates from any device;
? Classless IP addresses and VLSM are not supported (Variable Length Subnet Mask, variable-length subnet mask);
? The convergence is slow, and the time is often greater than 5 minutes;
?The bandwidth consumes a lot.
2. How to match the router
The router itself is a computer with multiple network interfaces. Like ordinary computers, it also has components such as central processing unit (CPU), system main memory (RAM), and read-only memory (ROM).
In addition, a very important part is its network interface. In order to connect different types of networks, there are many types of network interfaces for routers, such as Ethernet, Fast Ethernet, Token Ring interfaces applied in LANs, V.35, RS232, ISDN BRI PRI interfaces, etc. used in WAN.
There are two main external memory of routers: NVRAM (Non-Volatile RAM, nonvolatile RAM) and Flash (Flash). NVRAM stores the router's configuration file, Flash is used to store the operating system IOS (Internet Operating System).
Configuration mode
There are two basic configuration modes for CISCO routers: user (user) and privileged. In user mode, only the status of the router can be displayed, and privileged mode can also change the router's configuration.
In privileged mode, you can enter the installation mode, global configuration mode, and local configuration mode.
?The installation mode provides menu prompts to guide users to perform basic router configuration. After the new router is started for the first time, it will automatically enter the installation mode.
? In the global configuration mode, the global parameters of the router can be changed, such as host name, password, etc.
? Local configuration changes the local parameters of the router, such as the configuration of a certain network interface, the configuration of a certain routing protocol, etc.
Configuration method
There are many ways to configure a router, and the following five are the most common:
?Use the hyperterminal tool to log in to the console (console port) through the serial port.
? Connect the modem to the auxiliary port of the router and log in to the console remotely.
?Remote login (telnet) to a certain IP address of the router, and access the router through VTY (virtue terminal line, virtual terminal).
?Edit the configuration file and upload it to the router via TFTP.
?Remotely set router parameters through network management software (network management system).
Install the router
Suppose there are only three routers in our project network. The network topology is as follows:
They are placed in Beijing, Shanghai and Tianjin, and are named testBJ, testSH and testTJ respectively. We use Class B to reserve IP address 172.16.0.0, and divide four subnets into 172.16.1.0, 172.16.2.0, 172.16.3.0 and 172.16.4.0, and the subnet masks are all 255.255.255.0.
Basic configuration
Connect one end of the serial cable included in the package to the console port of the Beijing router, and the other end to the computer's com port. Start the hyperterminal program (in Win95/NT), make appropriate configuration, and connect to the router. Power on the router, type several carriage return in succession, and the following prompt appears, showing that the router is in user mode.
testBJ>
Transfer from user mode to privileged mode and use the enable command.
testBJ> enable
testBJ#
Like UNIX hosts, "#" represents a system prompt for a privileged (root) user, which means you are entering privileged mode. Contrary to enable, that is, the command to return to user mode from privileged mode is disabled.
In privileged mode, you can use the config terminal command to enter the global configuration mode. In global configuration mode, you can use the names of some configuration subkeys to enter local configuration mode. The returned methods are all exit commands. Among them, the command to directly return to the privileged mode from the local configuration mode is end. As shown below.
testBJ#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
testBJ(config)#router rip
testBJ(config-router)#exit
testBJ(config)#exit
testBJ#
A very attractive feature of CISCO IOS is its command line help, a? solves all problems. ?You can display the command list in the current mode, display the full name of the command, and also display the command parameters and help information. Type? anywhere you are not sure about the command and the system will give a prompt message.
The CISCO router also supports command abbreviation function. As long as there is no ambiguity, the first few characters of the command can be replaced by the entire command. In this way, the typing workload during configuration will be much smaller.
All configuration information of the router is stored in the configuration file. The configuration file currently in use is running-config, which is stored in the system memory. Our configuration modifications in privileged mode will be immediately reflected in the running-config. startup-config is a configuration file stored in NVRAM, only it is powered down and not lost, so if you want the modifications to remain valid until the next startup, you must save the current configuration. The saving command is as follows:
testBJ#copy running-config startup-config
Building configuration...
[OK]
testBJ#
Change the router name and password
The name of the router can be modified using the hostname command.
Router(config)#hostname testBJ
testBJ(config)#
The enable password and enable secret commands can modify the password in the privileged mode.
testBJ(config)#enable password cisco
testBJ(config)#enable secret cisco
Enter the line console local configuration mode and modify the console login password; enter the line vty local configuration mode and modify the telnet login password. The login command indicates that login is required, and the commands for modifying the password are passwords.
testBJ(config)#line console 0
[1][2][3] Next page
Article entry: csh Editor in charge: cshtestBJ(config-line)#login
testBJ(config-line)#password cisco
testBJ(config-line)#exit
testBJ(config)#line vty 0 4
testBJ(config-line)#login
testBJ(config-line)#password cisco
Test connectivity
Open the other two routers, configure them according to the above method, and then you can check whether they are connected.
There are three ways to test line connectivity: ping, traceroute and telnet. ping can detect whether the destination is reachable; trace not only detects connectivity, but also gives the path to reach the destination; telnet tests the connectivity of the application layer software, as shown below.
testBJ#ping 172.16.4.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.4.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/25/28 ms
testBJ#traceroute 172.16.4.2
Type escape sequence to abort.
Tracing the route to 172.16.4.2
1 172.16.2.2 16 msec 16 msec *
testBJ#telnet 172.16.4.2
Trying 172.16.4.2 ... Open
User Access Verification
Password:
testTJ>
172.16.4.2 is a port on the router testTJ. We run the above three commands on testBJ and we know that it is running normally.
Show current status
To enable network administrators to easily understand the status of the router, CISCO routers provide rich show commands. We introduce the simplest ones here, as shown below.
The show version command displays the router's hardware and software version number and configuration information.
show flash: The command is equivalent to the DOS dir command, displaying the file information contained in flash.
show interface command displays the status of the network interface.
In the process of configuring a router, the most important show command is to view the content of the configuration file. You can use the show command to view running-config or startup-config, as shown below.
show running-config
show startup-config
A configuration file is a text file that contains each configuration command you type. You can download the configuration file to your computer, modify it with a text editor, and then pass it back to the router.
3. What should RIP match?
IP address configuration
We can use the interface command to enter the local configuration mode, and then use the ip address to set the IP address of the interface. As shown below.
testBJ#conf t
Enter configuration commands, one per line. End with CNTL/Z.
testBJ(config)#interface e0/1
testBJ(config-if)#ip address 172.16.1.2 255.255.255.0
testBJ(config-if)#
For easy configuration and memory, you can also add some description information to each port. As shown below, use the description command in port local configuration mode.
testBJ(config-if)#description connect to testSH
testBJ(config-if)#end
testBJ#
Some networks are NBMA (Non-Broadcast MultiAccess), that is, broadcast transmission data is not allowed on the network. For such networks, RIP cannot rely on broadcast delivery routing tables. There are many solutions, the easiest one is to specify a neighbor, that is, to specify the routing table to a specific router.
Some networks are NBMA (Non-Broadcast MultiAccess), that is, broadcast transmission data is not allowed on the network. For such networks, RIP cannot rely on broadcast delivery routing tables. There are many solutions, the easiest one is to specify a neighbor, that is, to specify the routing table to a specific router.
RIP configuration
RIP is the easiest routing protocol to configure. Configuring it requires only two steps. First, specify the RIP protocol, and then declare the network number you are connected to, as shown below.
testBJ(config)#router rip
testBJ(config-router)#network 172.16.0.0
testBJ(config-router)#end
testBJ#
The router rip command is used to specify the use of RIP protocol. The network command declares the network number. Since RIP is a class-based routing protocol, there is no need to declare each subnet number.
Repeat the above operation for each router, and a network that uses RIP routing will be built.
Test configuration correctness
After configuring RIP, check whether the data can be routed correctly. In addition to using the connectivity testing tool mentioned above, there are also the following commands:
?sh ip route is used to detect routing tables;
?sh ip protocols is used to check the status of the routing protocol;
? debug ip rip is used to debug RIP protocol information.
Use the sh ip route command to display the routing tables of each router.
testBJ#sh 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,
* - candidate default, U - per-user static route, o - ODR
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 4 subnets
R 172.16.4.0 [120/1] via 172.16.2.2, 00:00:12, Serial1/0
C 172.16.1.0 is directly connected, Ethernet0/1
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.1.3, 00:00:09, Ethernet0/1
[120/1] via 172.16.2.2, 00:00:22, Serial1/0
The above is the routing information of the Beijing router. The letter C starts with a direct connection network, with 172.16.1.0 and 172.16.2.0, respectively connected to the e0/1 and s1/0 ports. The letter R begins with the route learned by the RIP protocol, with 172.16.3.0 and 172.16.4.0, of which, there are two paths to choose from, 172.16.3.0, via testSH and testTJ routers respectively. Comparing the network topology diagram, we can see that the actual situation is exactly the same as the design.
The content in the brackets is the management distance and measurement value of the routing item. The default management distance of RIP is 120, and the measurement value that reaches the 3 and 4 subnets is 1, that is, it can be reached through 1 router.
The same command runs on two other routers, and the result is as follows.
testSH#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 4 subnets
R 172.16.4.0 [120/1] via 172.16.3.2, 00:00:13, Ethernet0/0
C 172.16.1.0 is directly connected, Ethernet0/1
R 172.16.2.0 [120/1] via 172.16.1.2, 00:00:11, Ethernet0/1
[120/1] via 172.16.3.2, 00:00:13, Ethernet0/0
C 172.16.3.0 is directly connected, Ethernet0/0
testTJ#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 4 subnets
C 172.16.4.0 is directly connected, Ethernet0/0
R 172.16.1.0 [120/1] via 172.16.3.3, 00:00:07, Ethernet0/1
[120/1] via 172.16.2.3, 00:00:19, Serial1/0
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Ethernet0/1
When analyzing the output of the above command, you must refer to the topology diagram at any time. If you leave the network topology, the above information has no meaning. The flexibility of dynamic routing is reflected in the failure of a link, and the routing algorithm will automatically switch to the detour link. For example, we disconnect the serial cable between testBJ and testTJ, and after a period of time, check the routing table, as shown below.
testBJ#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.4.0 [120/2] via 172.16.1.3, 00:00:22, Ethernet0/1
C 172.16.1.0 is directly connected, Ethernet0/1
R 172.16.3.0 [120/1] via 172.16.1.3, 00:00:22, Ethernet0/1
We found that subnet 2 where the serial link is located is disconnected, and all packets to network 172.16.4.0 will circumvent the testSH router.
The sh ip protocols command can display the status of the current routing protocol, as shown below.
testBJ#sh ip protocols
Routing Protocol is "rip"
Previous page [1][2][3] Next page
Article entry: csh Editor in charge: cshSending updates every 30 seconds, next due in 19 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Redistributing: connected, rip
Default version control: send version 1, receive any version
Interface Send Recv Key-chain
Ethernet0/1 1 1 2
Serial1/0 1 1 2
Routing for Networks:
172.16.0.0
Routing Information Sources:
Gateway Distance Last Update
172.16.2.2 120 00:00:05
172.16.1.3 120 00:00:27
Distance: (default is 120)
From the command output, we can see the basic configuration of the RIP protocol. We can also know that the routers that exchange information with the current router include testTJ (172.16.2.2) and testSH (172.16.1.3). The last time the routing information was received was 5 seconds and 27 seconds respectively.
To learn more about exchanging routing information between routers, you can use the debug ip rip command. As shown below, after entering the command, information about receiving or sending RIP broadcasts appears on the console at a certain period of time.
testBJ#debug ip rip
RIP protocol debugging is on
testBJ#
RIP: received v1 update from 172.16.2.2 on Serial1/0
172.16.4.0 in 1 hops
172.16.3.0 in 1 hops
RIP: received v1 update from 172.16.1.3 on Ethernet0/1
172.16.4.0 in 2 hops
172.16.3.0 in 1 hops
RIP: sending v1 update to 255.255.255.255 via Ethernet0/1 (172.16.1.2)
subnet 172.16.4.0, metric 2
subnet 172.16.2.0, metric 1
RIP: sending v1 update to 255.255.255.255 via Serial1/0 (172.16.2.3)
subnet 172.16.1.0, metric 1
RIP: received v1 update from 172.16.1.3 on Ethernet0/1
172.16.4.0 in 2 hops
172.16.3.0 in 1 hops
RIP: received v1 update from 172.16.2.2 on Serial1/0
172.16.4.0 in 1 hops
172.16.3.0 in 1 hops
testBJ#no debug all
All possible debugging has been turned off
testBJ#
Details of RIP broadcast can be obtained from the above information. The router first receives the information from subnets 3 and 4 from testTJ, and then receives the information from subnets 3 and 4 from testSH. Among them, go to testTJ and go to testSH and go to testSH and go to testTJ. Therefore, the routing table reflects the distance from testTJ to subnet 4; the distance from subnet 3 is all hopped, so there are two parallel routes in the routing table.
After a period of time, the current router's update time reaches 30 seconds, so it broadcasts its own routing table information on both links. Note that when broadcast routing is updated, RIP adopts a horizontal segmentation mechanism, and the information learned from one port is not broadcast on this port, so the current router testBJ only sends the routing information of subnet 172.16.1.0.
Use the no debug all command to end the display of debug information. It should be noted that the debug command consumes router resources very much, so do not use it on routers that are busy with communication, otherwise the router will stop responding like a crash.
How about it, how much time did you take to read this article? Here are some routers and try to configure them, it’s not very difficult.
Experience the fun of network connection, and use this as the starting point for you to learn routers, such as IGRP, OSPF, HSRP, etc., but if you learn later, 100 minutes will not be enough...
Previous page [1] [2][3]
Article entry: csh Editor in charge: csh