Linux – Multiple NICs with IPs from same network at Linux host respond to a single MAC

arplinuxmac addressnetworking

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.

Best Answer

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.