Article title: resolve multiple NICs in Linux with the same IP address segment. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Linux/documentation/ networking/ip-sysctl.txt:
Arp_filter-BOOLEAN
1-Allows you to have multiple network interfaces on the same
Subnet, and have the ARPs for each interface be answered
Based on whether or not the kernel wowould route a packet from
The ARP 'd IP out that interface (therefore you must use source
Based routing for this to work). In other words it allows control
Of which cards (usually 1) will respond to an arp request.
0-(default) The kernel can respond to arp requests with addresses
From other interfaces. This may seem wrong but it usually makes
Sense, because it increases the chance of successful communication.
IP addresses are owned by the complete host on Linux, not
Particle interfaces. Only for more complex setups like load-
Balancing, does this behaviour cause problems.
Arp_filter for the interface will be enabled if at least one
Conf/{all, interface}/arp_filter is set to TRUE,
It will be disabled otherwise
Arp_announce-INTEGER
Define different restriction levels for announcing the local
Source IP address from IP packets in ARP requests sent on
Interface:
0-(default) Use any local address, configured on any interface
1-Try to avoid local addresses that are not in the target's
Subnet for this interface. This mode is useful when target
Hosts reachable via this interface require the source IP
Address in ARP requests to be part of their logical network
Configured on the processing ing interface. When we generate
Request we will check all our subnets that include
Target IP and will preserve the source address if it is from
Such subnet. If there is no such subnet we select source
Address according to the rules for level 2.
2-Always use the best local address for this target.
In this mode we ignore the source address in the IP packet
And try to select local address that we prefer for talks
The target host. Such local address is selected by looking
For primary IP addresses on all our subnets on the outgoing
Interface that include the target IP address. If no suitable
Local address is found we select the first local address
We have on the outgoing interface or on all other interfaces,
With the hope we will receive reply for our request and
Even sometimes no matter the source IP address we announce.
The max value from conf/{all, interface}/arp_announce is used.
Increasing the restriction level gives more chance
Refreshing answer from the resolved target while decreasing
The level announces more valid sender's information.
Arp_ignore-INTEGER
Define different modes for sending replies in response
Protected Ed ARP requests that resolve local target IP addresses:
0-(default): reply for any local target IP address, configured
On any interface
1-reply only if the target IP address is local address
Configured on the incoming interface
2-reply only if the target IP address is local address
Configured on the incoming interface and both with
Sender's IP address are part from same subnet on this interface
3-do not reply for local addresses configured with scope host,
Only resolutions for global and link addresses are replied
4-7-reserved
8-do not reply for all local addresses
The max value from conf/{all, interface}/arp_ignore is used
When ARP request is already ed on the {interface}
Solution
Echo 2>/proc/sys/net/ipv4/conf/all/arp_announce
Echo 1>/proc/sys/net/ipv4/conf/all/arp_ignore
Or
Echo 1>/proc/sys/net/ipv4/conf/all/arp_filter