0

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.

2 Answers 2

2

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.

1

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

2
  • 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. Commented Aug 20, 2013 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. Commented Aug 20, 2013 at 21:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .