1

I have a box with Linux Ubuntu 8.04 and 4 Ethernet ports. I enabled 2 ports, eth0 and eth1, and am trying to configure them with static IPs (eth0 = 192.168.0.205 and eth1 = 192.168.0.206).

If I plug 2 cables, one for each, I can to ping my equipment by each IP as expected. But, if I remove the cable from eth1, I still can ping both IPs still. After this I can disable eth1 and the 2 IPs still will be available for me on eth0.

If I to plug the cable in eth1 there is no difference, just eth0 port workings.

I did a test, and if I configure the 2 IPs in distinct subnets this problem doesn't occur.

Chris S
  • 77,945
  • 11
  • 124
  • 216
Adriano Leal
  • 111
  • 1
  • 2
  • 1
    I don't understand what the problem is. What do you want to achieve? – Kvisle Oct 20 '11 at 17:13
  • How did you configure the ports? Command line program or some sort of configuration utility? – Chris S Oct 20 '11 at 17:19
  • I would like than eth0 had 192.168.0.205 ip and eth1 192.168.0.206, but both are controlled just by eth0. – Adriano Leal Oct 20 '11 at 17:24
  • I configured the ports by /etc/network/interfaces file and after i restarted the networking process with '/etc/init.d/networking restart' command. – Adriano Leal Oct 20 '11 at 17:26
  • To have multiple ip-addresses on one interface, add the 2nd address with `ifconfig eth0:0 192.168.0.206 up`. Next address goes with eth0:1 up to eth0:255. You can use the 2nd adapter to connect to a physical different LAN. – ott-- Oct 20 '11 at 18:01
  • I don't think you actually asked a question. – jftuga Oct 20 '11 at 18:30

1 Answers1

2

This happens because by default Linux consider an IP address as a property of the whole host, not just a particular interface; therefore an ARP request from outside (which will be received by both interfaces) will cause a reply from all interfaces, not just the one with the requested IP.

Look at this answer to a question similar to yours (there is also another way involving arptables described there).

Sergey Vlasov
  • 6,288
  • 1
  • 21
  • 30