Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

CentOS host is armed with multiple NICs. All NICs are bound to the same subnetwork (let it be 10.0.0.0/24). Their IP configuration is provided with DHCP server (as reservations).

While trying to get ARP entry remotely for some particular IP address belonging to some particular NIC (with arp -a from Windows host), I always get the same MAC address, which is equal to the host’s first interface MAC address (eth0), regardless of the real adapter’s MAC. Example:

adapter, ip, mac, arpcache entry:

eth0, 10.0.0.1, aa:aa:aa:aa:aa:00, aa-aa-aa-aa-aa-00

eth1, 10.0.0.2, aa:aa:aa:aa:aa:11, aa-aa-aa-aa-aa-00

eth2, 10.0.0.3, aa:aa:aa:aa:aa:22, aa-aa-aa-aa-aa-00

…

For Windows hosts in similar configuration I am getting different MACs for different adapters (according to the adapter’s configuration).

Why do Linux hosts respond with single MAC? Why do Windows hosts act in opposite way? What are the reasons for such behavior?

How to configure current major Linux distributions to respond with different MACs? I’ve read the similar topic Ubuntu Linux - multiple NICs, same LAN... ARP responses always go out a single NIC, but proposed answers do not work for my CentOS 6.4 host - adapters above eth0 become unreachable.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Because Linux kernel default implementation of IPv4 is base on 'weak host model': http://en.wikipedia.org/wiki/Host_model

You can setup multiple routing tables, each with a separate default for the appropriate gateway, and rules to tell traffic from certain ips to use the appropriate route.

share|improve this answer
add comment

From what I understand, you want the arp reply to be transmitted from the NIC that gets the request?

Put the following in your /etc/sysctl.conf

net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.default.arp_announce = 2

And then run

sysctl -p

These rules ensure that arp requests are only responded to on the interface on which they arrived

share|improve this answer
    
Yes. While querying with arp IP address 10.0.0.2 assigned to eth1 which MAC=aa:aa:aa:aa:aa:11, I'm expecting to receive aa-aa-aa-aa-aa-11 in response. But in current configuration I'm receiving eth0's MAC instead. –  s.zaprudsky Aug 20 '13 at 21:23
    
With settings you provided adapters above eth0 become unreachable (no ping replies directly after sysctl -p) - as it stated in original question, it doesn't work for fresh CentOS 6.4. –  s.zaprudsky Aug 20 '13 at 21:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.