Knowledge about static route table settings and route summary

Source: Internet
Author: User

With the popularization of broadband access, many families and small enterprises have set up local networks to share broadband access. In addition, with the expansion of the Lan, the applications of two or more routers are involved in many areas. When there are more than two routers in a LAN, you often need to set up routes because of the mutual access between hosts. Because the network size is small and does not change frequently, static routing is the most suitable choice.

As an entry-level article, this article will explain static routing with several simple examples, and at the end of the article, I will explain a little knowledge about routing summary (induction. This article takes the simplest broadband router as an example because this type of home and small office LAN generally use medium and low-end broadband routers. (In fact, no matter what type of router, except for the configuration method and command, the principle of configuring static routing is no different .) A common broadband router with 1 WAN port and 4 LAN port can be considered as the simplest dual-Ethernet router and a four-port small switch, and its WAN port is connected to the Internet, the LAN port is connected to the intranet for differentiation.

A route is the act of transmitting information from the source to the destination. In terms of image, the information package is like a person who wants to go to a specific location. Routing is the process of selecting a path for this person. The route table is like a map marking various routes. The information package relies on route guidance in the route table to reach the destination. The route entries are like road signs. In most broadband routers, if static routes are not configured, a default route exists internally, this route forwards information packets from all destinations not in the LAN to the Gateway of the WAN port. The broadband router only needs to configure the WAN port parameters, and the intranet host can access the Internet, that is, this route is working. This article will be divided into two parts. The first part describes the application of static routing settings, and the second part describes the routing induction methods and functions.

The following uses some typical applications for beginners of the sweet potato network as an example to describe how to set up static routes, the composition of static route entries, and the specific functions of static routes.

Example 1: Simple series dual-router environment

This often occurs in small and medium-sized enterprises that share the Internet with their original routers. As a result of expansion, they need to connect to a vro to connect to another new CIDR block. This is also likely to happen in the family. For example, after a broadband router is used to share the bandwidth, a wireless router is added to meet the needs of wireless client access.
Sweet potato: the company's original LAN 1, which relies on a router to share the Internet, now adds a router in it, and mounts the host of another network segment LAN 2. After simple settings, it is found that all hosts share the Internet, but the host of LAN 1 cannot communicate with the host of LAN 2, however, the host in LAN 2 can Ping the host in LAN 1. What's going on?

Prawns: This is because the vro isolates broadcast and divides the broadcast domain. At this time, the hosts of LAN 1 and LAN 2 are located in two different CIDR blocks, which are isolated by the newly added vro. In this case, the host under LAN 1 cannot "view" the host in LAN 1, and the information package can only be sent to the default gateway first. At this time, the gateway is not configured with a route to LAN 2, no valid forwarding is allowed. In this case, you must set static route entries. The topology of this network environment is as follows:


Figure 1

(Note: possible switch-layer devices are omitted in the figure)

1. As shown in, LAN 1 is the standard class C network segment of 192.168.0.0. Router R1 is the original router, and its WAN port is connected to broadband and LAN port (IP address: 192.168.0.1) the WAN port (IP address: 192.168.0.100) of the host and vror2 R2 with the IP address range 192.168.0.0 (class C network with 255.255.255.0 subnet mask ). The LAN port of R2 (IP address: 192.168.1.1) is hung with the host of the newly added class c cidr block of LAN 2 192.168.1.0.

If you follow the Internet sharing method for simple settings, at this time you should point the host gateway of 192.168.0.0 to the LAN port of R1 (192.168.0.1), the host gateway of the 192.168.1.0 network segment to the LAN port of R2 (192.168.1.1 ), as long as the WAN port gateway of R2 points to 192.168.0.1 and 192.168.1.0 hosts can access hosts in the 192.168.0.0 CIDR block and access the Internet through broadband. This is because a default route in the aforementioned broadband router is working. It sends all the IP packets that are not in this segment to the WAN port Gateway (that is, router R1 ), it is determined by R1 that the information packet should be forwarded to its own intranet or to the Internet. However, the host gateway of the 192.168.0.0 network segment must point to 192.168.0.1, while R1 does not know the correct location of the LAN 2 of 192.168.1.0. In this case, only Internet access and mutual access within the network segment are allowed, you cannot access hosts in the 192.168.1.0 CIDR block. In this case, you need to specify a static route on R1 so that the information packet with the destination IP address of 192.168.1.0 can be forwarded to vror2 R2.

Knowledge about static route table settings and route aggregation (2)
11:11:13

A static route entry consists of three parts: 1. The destination IP address or destination network, subnet; 2. Subnet mask; 3. Gateway or next hop.

In example, the static route entry set on R1 should be: the destination IP address 192.168.1.0 (representing the 1. x network segment), subnet mask 255.255.255.0 (because it is a Class C network segment), and next hop 192.168.0.100. 2, this figure is the static route table configuration in the TP-LINK R410, save to take effect. For a Cisco Router, type the command: Router (config) # ip route 192.168.1.0 255.255.255.0 192.168.0.100 in global configuration mode.

Note: The Gateway IP address must belong to the same network segment as the WAN or LAN port. The default route is written as follows: the destination IP address is 0.0.0.0, the subnet mask is 0.0.0.0, and the next hop is the default gateway on the WAN port, sometimes we call it "eight 0 default routes ". In addition, if the destination IP address is a specific host IP address (such as 192.168.1.2), the route entry should be: destination IP address 192.168.1.2, subnet mask 255.255.255, next hop or gateway 192.168.0.100.


Figure 2

Using this connection method, you can also conveniently set the access permissions of hosts under LAN 2 using the built-in access control list of the router, which is very convenient for enterprise users. The "Firewall settings" in the broadband router is actually a simplified Access Control list, that is, ACL-Access Control Lists. For example, if you want a computer with the IP address 192.168.1.7 in LAN 2 to be unable to send and receive emails, and a computer with the IP address 192.168.1.8 to access the ERP Server in LAN 1 (assuming its IP address is 192.168.0.10 ), no restrictions are imposed on other computers in the LAN. In this case, you must specify the following data packet filtering table,

Knowledge about static route table settings and route summary (3)
11:10:10

Example 2: an environment in which two parallel routers need to communicate with each other in the downlink subnet

In this case, there should be a general egress gateway on the upper layer of the two parallel connected routers, and this gateway may be unable to set a route for some reason, at this time, there are three different network segments in the network.

Sweet potato: My family is shared-bandwidth access in the community. I built a home LAN with a broadband router to share the Internet. Just like my neighbors, I used a broadband router to build another home LAN. However, the hosts in our respective Lan cannot communicate with each other, and the ping fails. What is the problem?

Prawns: In this case, the whole community is actually a large LAN, and the host cannot communicate with each other. In fact, this is the same reason why LAN 1 cannot be pinged to LAN 2, the reason is that the default gateway on the upper layer does not know the correct location of the destination IP address's CIDR block and cannot forward it effectively. The typical environment is as follows:


Figure 4

In the figure, the intranet gateway is the gateway of the residential area. R1 and R3 are the two broadband routers respectively. They are generally connected through the access switch on the floor and the backbone switch of the residential area, this part is omitted in this figure. Figure 4 in this case, as long as two routes are added to the gateway device in the example 1 method, mutual access between hosts in the two subnets can be achieved, in addition, hosts in the 10.0.0.0 class a cidr block can also access the intranet machines under R1 and R3 through these two routes. However, if it is a gateway device in the residential area, it will certainly not allow users to configure routing entries at will, and you should also do not want all users in the residential area to directly access your intranet host. In this case, we can add a route pointing to the other side on R1 and R3 to achieve direct mutual access between hosts on R1 and R3.

Knowledge about static route table settings and route aggregation (4)
11:08:33

On R1: the destination IP address 172.16.0.0, subnet mask 255.255.0.0 (Class B network segment), next hop 10.1.1.3.

On R3: the destination IP address 192.168.0.0, subnet mask 255.255.0 (class C network segment), next hop 10.1.1.2.

Note: Some new residential area using P-VLAN technology, this network is more complex, so the above simple static routing settings may not achieve the goal.

Example 3: an environment with a serial and multi-level routing device in the network.

This situation can be said to be the integration and extension of the two types of applications, which seems complicated and simple.

Sweet potato: in an environment like example 2, I would like to add another vro to my home LAN and mount another CIDR block for expansion. How should I set it?

Prawns: the network structure you mentioned is indeed a combination of examples and examples. At this time, a total of four CIDR blocks coexist. Our setting is to allow the three sub-network hosts under the two household Lan to communicate with each other. At this time, the gateway of the residential area still cannot be set. The topology is as follows:


Figure 5

As you can see, Figure 5 is to integrate Figure 1 and Figure 4. Since the topology graph is a combination of Example 1 and example 2, can I add the route entries in example 1 and example 2 together? Of course it is not that simple. If only the routing entries of the first two examples are configured, hosts under R3 cannot directly access the subnet 192.168.1.0 under R2. Therefore, add a route entry to the subnet 192.168.1.0 on R3. Static route entries are configured as follows:

R1: destination IP address 192.168.1.0, subnet mask 255.255.0, next hop 192.168.0.100.

Destination IP address 172.16.0.0, subnet mask 255.0.0, next hop 10.1.1.3.

R3: destination IP address 192.168.0.0, subnet mask 255.255.0, next hop 10.1.1.2.

Destination IP address 192.168.1.0, subnet mask 255.255.0, next hop 10.1.1.2.

Sweet potato: Why does the next hop of the second route in R3 not direct to R2, but also to R1?

Prawns: you will know that you will ask this question. This question should be explained from the principle of communication between routers. A vroarp uses the ARP resolution protocol to obtain the MAC address of the next hop router. ARP is based on broadcast. Generally, the vro does not forward broadcast packets, that is, broadcast packets cannot pass routing. So for router R3, R1 and R3 are of the same level. It can only see R1, but cannot see R2. This is why we mentioned in the note in Example 1: "the gateway IP address must belong to the same network segment as the WAN or LAN port. The static route entries mentioned in this article constitute Part 1: The Gateway is also called the next hop, not the next two hops or the next three hops. Generally, the IP address of the next hop route must be in the same CIDR block as an interface of the router.

Knowledge about static route table settings and route aggregation (5)
11:06:24

The following sections of this article will explain the knowledge about route aggregation (or routing induction.

In the preceding example, the static route entry on R3 can be written as the destination IP address 192.168.0.0, subnet mask 255.255.0.0 (no longer the mask of class C subnet), and the next hop is 10.1.1.2. At this time, 192.168.0.0, mask 255.255.0.0, the network segment cannot be referred to as a Class C or Class B subnet. Because it exceeds the scope of its Class C network segment, it can be called a super network. This CIDR block contains 192.168.0.0 ~ All subnets of 192.168.255.0. That is to say, this static route will send all the information packets of the destination IP in this range to router R1 of 10.1.1.2. Summarize multiple route entries into one that contains the total route entries. This is a route summary or route induction. When a router checks and computes a route, resources are consumed. The more route entries there are, the longer the route table is, the more time it takes. Therefore, the route table length is reduced through route aggregation, it is helpful to improve the efficiency of the router. Although this small network with only a few routers plays a limited role in the example, if it is a large network with dozens, hundreds, or even thousands or tens of thousands of routers, the role of route induction is very obvious. It can be said that routing induction is unimaginable.

Example 4:


Figure 6

Readers may have discovered that, although the last inductive route in example 3 contains all two subnets (192.168.0.0 and 192.168.1.0) under R1 ), but it also contains some subnets that do not actually exist under R1 (192.168.2.0 ~ 192.168.255.0 ). If these subnets still exist under other routers in the Lan (192.168.2.0 subnet exists under 6 and R4), the routing will fail, so this summary route is an inaccurate summary.

We all know that IPv4 addresses are composed of four 8-bit binary numbers, one is the network bit, and the other is the host bit. The subnet mask Network bit is the binary number of all 1, and the host bit is the binary number of all 0. When each information packet passes through a vro, it checks its destination IP address, performs "and" operation with the subnet mask of the route entry in the routing table, and compares it with the destination IP address in the route entry, if they are the same, they will be forwarded according to this routing rule. If they are different, they will be checked and compared to the next one. We can see that the summary routing operation is to extract the network bits with the same destination IP addresses from multiple route entries into one. In this example, the reason why the summary route in section 3 is not accurate is that the same part cannot be all proposed.

Knowledge about static route table settings and route summary (6)
11:04:13

In example 3, the first IP address on R3 is 192.168.0.0, and the second IP address is 192.168.1.0. We have extracted only the first two segments of 192.168, and the third segment of the network bit still has the same part. In 192.168.0.0, the third part is written as 00000000 binary (8 bits 0), and in 182.161.0, the third part is written as 00000001 binary (7 bits 1 bits), so their first seven digits are the same, the corresponding subnet mask should be 11111110 (7-bit, 1-bit, 0) and the synthetic decimal value is 254. Therefore, this summary route should be written as follows: the destination IP address is 192.168.0.0, the subnet mask is 255.254.0, and the next hop is 10.1.1.2. In this way, this summary route contains only two subnets: 192.168.0.0 and 192.168.1.0. It is a precise summary route. In section 6, the 172.16.0.0 host under R3 is sent to the information package of the 192.168.2.0 network segment, and the third network bit is written as binary 00000010 (the first 6 digits 0 ), it is not included in this precise summary route.

In this case, the static route entries on R3 should be:

1. Destination IP address 192.168.0.0, subnet mask 255.254.0, next hop 10.1.1.2.

2. Destination IP address 192.168.2.0, subnet mask 255.255.0, next hop 10.1.1.4.

When collecting routes, we should try to use accurate summary entries as much as possible. In line with the principle that the total entries can be aggregated, entries that cannot be accurately summarized will not be aggregated. In this way, route tables can be added and modified in a more organized manner in the future expansion and change of the network, reducing the chance of errors.

Summary:

Static routing is easy to set, stable and error-free in infrequently changing networks. Therefore, static routing is also used in small and medium-sized enterprises or even some large campus networks, it is very common in practical applications and belongs to the basic knowledge of network workers. As described in this article, the setting principle of static routing is relatively simple, but it can be said that it is the basis for learning various routing protocols and is a required part for learning routing knowledge. In addition, the more complex the network is, the more significant the effect of summarizing routes is, and the efficiency of effectively summarizing and summarizing routes is, are closely related to the distribution of IP address segments in the network structure. The more continuous and organized the IP address deployment, the easier and more effective the route summary. Therefore, we should pay attention to systematic addressing when deploying the network. (Note: In a subnet, routing induction is most effective when the network address is a continuous block in the form of 2 .)

Knowledge about static route table settings and route summary

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.