Questions about LINUX Policy Routing

Source: Internet
Author: User
For more information about LINUX Policy Routing-Linux general technology-Linux technology and application, see the following. We can see that many prawns implement policy routing, because the current work needs to solve a problem, on the host configured with multiple interfaces, You need to select the output interface based on the source address. After investigation, we wanted to adopt a policy routing method, so we designed the following scheme for testing.

Two hosts, A and B, with two NICs, are connected by the HUB. The two IP addresses 192.168.1.2 and 192.168.1.3 of a are used as the source address, and the IP address 192.168.1.1 of B is used as the destination address, and S1, S2, and D1 are both located in the same network segment.

① Ping the address of B on A, and ping the addresses of A on B respectively, but only one default Interface is used for data;

② Configure a policy route: view the route table as three local, main, and default routes before configuration;
Use the iproute command on A to create different policy route tables for different source addresses;
Ip rule add from 192.168.1.2 table 10
Ip rule add from 192.168.1.3 table 20
View the route table. At this time, Tables 10 and 20 are added;
Use the iproute command to add route entries for Route Tables 10 and 20;
Ip route add 192.168.1.1 dev eth0 table 10
Ip route add 192.168.1.1 dev eth1 table 20
View route Tables 10 and 20. The route table entry has been added;
Use the package sending software that can specify the address, and use the packet capture software to view the packet sending and receiving status of the corresponding interface.
The result packet still follows the default interface, and finds that the policy route table does not work, and still queries the main route table.

I would like to ask you to see if there is a problem with the settings or whether the policy routing method cannot solve this problem. Very worried...
Related Article

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.