linux 同一网段多网卡多ip设定

两块网卡在同一网段会出现一块断线但是ping这块网卡的ip依然能够ping通,这两个ip被指向了同一的MAC地址


eth0 192.168.1.10
eth1 192.168.1.11

echo "252    net2" >> /etc/iproute2/rt_tables
echo "251    net3" >> /etc/iproute2/rt_tables


ip route add 192.168.1.0/24 dev eth0 src 192.168.1.10 table net2
ip route add 192.168.1.0/24 dev eth1 src 192.168.1.253 table net3
ip route add default dev eth0 table net2
ip route add default dev eth1 table net3

ip rule add from 192.168.1.10 table net2
ip rule add from 192.168.1.11 table net3

ip route flush cache

ping通,然后arp验证mac地址不一样

arp -a

原文地址:https://www.cnblogs.com/zelos/p/2348023.html