With the popularization of broadband access, many families and small businesses have established 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. Under www.2cto.com, we will take some typical applications for beginners of the sweet potato network as an example. Let the master prawn explain under what circumstances Static Routing and static routing entries need to be set, and the specific role of Static Routing.
Example 1: the simplest series-type dual-router environment usually occurs in the networks where the original routers share the Internet, 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:
(Note: the possible switch layer devices are omitted in the figure) 1. LAN 1 is the standard class C network segment 192.168.0.0, router R1 is the original router, and its WAN port is connected to the broadband, the LAN port (IP Address: 192.168.0.1) is hung with the WAN port (IP Address: 192.168.0.100) of the host and router R2 ). 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 www.2cto.com is set up in Internet sharing mode, the host gateway of 192.168.0.0 should point to the LAN port of R1 (192.168.0.1 ), the host gateway of the 192.168.1.0 network segment points to the LAN port of R2 (192.168.1.1), so long as the WAN port gateway of R2 points to 192.168.0.1, all Hosts in 192.168.1.0 can access hosts in the 192.168.0.0 CIDR Block and access the Internet through broadband connections. 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.
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. Www.2cto.com
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,
Figure 3 Example 2: two parallel routers and the environment in which hosts in the subnetwork need to communicate with each other. In this case, the upper layers of the two parallel routers should have a total egress gateway, the Gateway may be unable to set a route for some reason, but 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 www.2cto.com.
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. 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:
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. The static route entry configuration is as follows: R1: Destination IP Address 192.168.1.0, subnet mask 255.255.0, And next hop 192.168.0.100. Destination IP address 172.16.0.0, subnet mask 255.0.0, Next Hop 10.1.1.3. Www.2cto.com 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.
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: www.2cto.com:
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. 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. Such as www.2cto.com, this summary route only contains two subnets: 192.168.0.0 and 192.168.1.0, which 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.255.254.0, And 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. Www.2cto.com
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 and 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 .)