Parsing route in Linux

Source: Internet
Author: User

In the Linux system, the route parsing encountered A problem today, and server A telnet server B 873 failed. Both parties checked the firewall and found that all permissions were activated and there was no problem. Later it was found that the routing problem A routing is as follows (only look at the Intranet): [root @ BJ-YF-3 ~] # Route-nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use route 0.0.0.0 255.255.255.0 U 0 0 0 eth0192.168.0.0 255.255.255.0.0 UG 0 0 0 255.255.255.255.0.0.0 UG 0 0 0 eth0 [root @ BJ-YF-3 ~] # Because server A and server B are in different segments of A C segment address. The correct mask of A and B should be 255.255.255.255.128, but both of them are configured with 255.255.255.0. Because it is an online service, you cannot change it and restart the NIC. Therefore, you can only add the specified route. Q: Why is the mask incorrect ??? When server A accesses server B, the route will match from top to bottom. The IP address of server A is 10.127.3.156, And the IP address of server B is 10.127.3.101 because of the mask configuration error, therefore, the first route is matched successfully. 10.127.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0, but this does not have a gateway. It is directly removed from the eth0 NIC (normally, only those with the same CIDR block can use A route without A gateway. Obviously, A and B are not in the same CIDR block.) For other CIDR blocks, there is no problem, for example, 10.127.2, because 10.127.3 does not match, therefore, we continue to match the next 10.0.0.0 10.127.3.254 255.0.0.0 UG 0 0 0 eth0 to solve the emergency problem. Therefore, we need to add routes for a single server, change the mask after maintenance, and restart the NIC. Route add-host 10.127.3.101 gw 10.127.3.254 the route is as follows: [root @ BJ-YF-3 ~] # Route-nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use invalid parameter 255.255.255.255.255.255 UGH 0 0 0 255.0.0.0.0 255.255.255.0 U 0 0 0 eth0192.168.0.0 255.255.255.0.0 UG 0 0 0 0 0 eth0 [root @ BJ-YF-3 ~] # If 10.127.3.101 is accessed, the first entry matches successfully and can be accessed. Ps: 1. For both parties to be OK, the two sides must be added to the corresponding Route 2. To continue to take effect after the restart, add the/etc/rc. local file to start automatically

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.