Use multiple gateways for Static Routing

Source: Internet
Author: User

This article gives you a detailed description of how to configure Static Routing using multiple gateways and what operations should we perform? The following article will give us a detailed answer.

Our school has the following network environment. The 450 nodes in the school are divided into five subnets, and the network numbers of each subnet are 192.168.1.0 ~ 192.168.5.0 and all gateways are 192.168.1.1. Each subnet is connected to the R2600 egress router through the Huawei S2026B L2 Switch, And the egress is connected to Interne with a bandwidth of Mbps through the optical fiber.

Currently, the county has established an e-government network, which requires that the computer of leading cadres at or above the county offices must be able to directly access the county e-government network server 192.168.20.6/24. The county e-Government Network Office will assign the subnet number 10.1.26.0 to our school, the mask is 255.255.255.192, the gateway is 10.1.26.1, and the e-government network cannot access the Internet.

The county e-government network server is hosted by the Telecommunications Bureau, so the Telecommunications Bureau opened a 10 Mbps optical fiber connection to our school. The advice of the Telecommunications Bureau is to install two NICs for the computer that our school needs to directly access the e-government network, and set up two network gateways respectively to access the e-government network and Ineternet at the same time.

Manually add static routes

The above network needs are actually to solve the problem of access to different targets by two subnets 192.168.0.0 and 10.1.26.0. during the construction of the office building of our school, the Network cables connecting the offices to the network center have been embedded in the wall, if you install a network adapter for each computer that needs to directly access the county e-government network, you need to separately lay a network cable, regardless of the difficulty of laying and the layout of the office space, this is not a good solution.

If you use the network cable of the original campus network and set two gateways on the computer that needs to connect to the E-Government network, you need to manually switch the gateways, it is also a great deal of trouble. for some reasons, we decided not to adopt the recommendations of the Telecommunications Board, but to manually add static routes to achieve seamless switching between the two gateways.

1. Connect the optical fiber connecting to the E-Government Network to the original S2006B switch.

2. Add the IP address 10.1.26.0 to the computer that needs to access the e-government network. For example, 10.1.26.2, the mask is 255.255.255.255.192.

The procedure is as follows: Select "Internet protocol TCP/IP) properties → advanced → ipsettings → Add ". Note that the gateway 10.1.26.1 cannot be added after an IP address is added. For more information, see the following section.

3. Enter the doscommand mode, and enter: ip route add 192.168.20.0 mask 255.255.255.0 10.1.26.1 when prompted, so as to manually add a static route.

4. To enable the command to be automatically executed at startup, you can write it into a batch processing file because the method for creating a batch processing file is relatively simple and will not be mentioned here.

After the above four steps, you can use the route print command in the command line mode to see that a static route entry to the 192.168.20.0 network is added to the local route table. At this time, the local computer can access the Internet, you can also access the e-government network. Users cannot feel the gateway switching process during use.

Solution Principle

From the above introduction, we can see that this method has two highlights:

One is that the same switch can connect to different networks. In normal use, the general fixed thinking is that a switch can only connect to the same network. In fact, we can know from the principle of the switch that this way of thinking is incorrect, because the switch is in the data link layer of the OSI reference model and belongs to the bridge. The switch acts as a bridge, because some switches can access multiple different networks. The above scheme is using this point, thus eliminating unnecessary hardware investment.

The second is that the gateway of the 10.1.26.0 network is not set, and the static routing method is adopted, eliminating the network overhead of the amount.

So why cannot I set two gateways? This starts from the role of the Gateway. When setting the Gateway, a default route entry is added to the route table of the Local Computer:

0.0.0.0.0.0.0.0 Local interface hops of the gateway IP address if the path of the target network cannot be found in the routing table, the packets are sent to the Gateway in the default route. If the gateway corresponding to the local machine is deleted, the default route will also be deleted in the route table. If two IP addresses are set on the local machine and the sub-table corresponds to the two gateways, two default routes are added to the local routing table, which are:

0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.88 1

0.0.0.0 0.0.0.0 10.1.26.1193851.88 1

In this case, the local machine does not know how to handle the data when sending the data, but manually adding a static route is different from directly setting the Gateway access route path, data will be transmitted according to the path specified in the local route table during the file issuance process.

With the above method, you can achieve seamless access to different networks through a single Nic.

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.