Ping one interface from the other
The simplest solution is to disable reverse path filtering. By default linux filters out packets coming in on an interface which it thinks should have come in on a different interface (because the packet matches the other interface's subnet).
To do this
echo 'net.ipv4.conf.eth0.rp_filter = 0' >> /etc/sysctl.conf
echo 'net.ipv4.conf.eth1.rp_filter = 0' >> /etc/sysctl.conf
echo 'net.ipv4.conf.lo.rp_filter = 0' >> /etc/sysctl.conf
sysctl -p
This adds the setting to the sysctl config file and then reloads the config. You can also temporarily disable the setting by doing echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter
.
You probably need to setup multiple default routes for both interfaces with iproute2 so that packets coming in from one interace are replied to on the same interface
Patrick's answer
To do this
echo 'net.ipv4.conf.eth0.rp_filter = 0' >> /etc/sysctl.conf echo 'net.ipv4.conf.eth1.rp_filter = 0' >> /etc/sysctl.conf echo 'net.ipv4.conf.lo.rp_filter = 0' >> /etc/sysctl.conf sysctl -p
did not work for me on Ubuntu 16.04.
This worked:
sysctl -w net.ipv4.conf.all.rp_filter=0