Solution to the RedHat two-Gateway Static Routing Problem (Linux route table; Linux route table added)

Source: Internet
Author: User

Because the system needs to access the server separately from the Intranet, that is, the Internet users access the server from the Internet, and the Intranet users access the server from the Intranet, the result is that the Intranet cannot be accessed after the dual gateway is configured, use the route command to view the cause of the route problem and reset the route to solve the problem.

To avoid routing problems after the server is restarted, add/etc/rc. Local in the configuration file.

route add-net 172.0.0.0 netmask route 0.0.0 GW 172.31.255.254 Dev eth1 # Intranet route
route add-net 222.211.64.120 netmask route 255.255.255 GW then Dev eth0 # Is route
route GW Internet egress IP address eth0 # default route
route del-net default netmask 0.0.0.0 GW 172.31.255.254 Dev eth1 # Delete the route added by the System

In this way, after the system is restarted, the correct static route can be automatically set to ensure normal access to the Intranet and Internet.
Principle Description: Generally, only one route can be created by default. Even if two route entries are added, only the one with a small metric route is unavailable (such as port down) the other one takes effect. Therefore, the port that does not know the remote address (such as accessing the internet) must refer to the default route, for a port that clearly knows the distribution of the remote address (usually the Intranet address segment), it refers to a static route.

In Linux, the route print Command similar to Windows is:
1. Route-e
2. IP Route list
3. netstat-Rn

Netstat-in: View Interface Card Information
Netstat-Rn view route information

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.