Re: disable local routing between eth0 and eth1 - iptables



astonishs@xxxxxxxxx wrote:
I've a Linux PC with 2 NICs eth0 and eth1 configured with IP 10.0.0.1
and 20.0.0.1 respectively.

|-------------------|
eth0 (10.0.0.1) ------------| |
| L2 SWITCH |
| |
eth1 (20.0.0.1) ------------| |
|-------------------|

I want to disable local routing between eth0 and eth1 so that whenever
I ping 20.0.0.1 from PC console, ICMP packets should come out of
interface eth0 and should reach eth1 through connected switch.

Similarly, whenever I ping 10.0.0.1 from PC console, ICMP packets
should come out of interface eth1 and should reach eth0 through
connected switch.

How can I do it using iptables, if at all possible?

Thanks in advance.
It will use the switch if you "ping -I eth0 20.0.0.1". Ping alone is using the loopback (127.0.0.1), since the destination is on the same machine.
.



Relevant Pages

  • Re: simple ping; pinging 101
    ... How are you selecting to ping via eth0 or eth1? ... arrakis can ping caladan from eth0. ...
    (Fedora)
  • Re: simple ping; pinging 101
    ... arrakis can ping caladan from eth0. ... > arrakis cannot ping caladan from eth1. ...
    (Fedora)
  • Re: Eth1 problems again
    ... fixed addresses and see if ping then works. ... Bringing up interface eth0: ... Bringing up interface eth1: sysfs class device: Permission denied ... ping: sendmsg: Operation not permitted ...
    (Fedora)
  • Odd networking problem.
    ... Only one of the interfaces can contact IP adresses outside of the local ... iface eth0 inet static ... iface eth1 inet static ... Ping from eth0 to local router works fine ...
    (comp.os.linux.networking)
  • Odd networking problem.
    ... Only one of the interfaces can contact IP adresses outside of the local ... iface eth0 inet static ... iface eth1 inet static ... Ping from eth0 to local router works fine ...
    (comp.os.linux.misc)