[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IP aliasing question



>> > why after I did IP aliasing on one computer for second computer,
>> > and both computers are running
>> > ping to the second computer doesn't returns dups?
>>
>> because there is only one entry in the arp table for that IP address...
>> why the HELL would you want two machines with the same IP?
>>
>> --
>> Ira Abramov ;  whois:IA58  ;  www.scso.com ;  all around Linux enthusiast
>> `When you say "I wrote a program that crashed Windows", people just stare
>> at you blankly and say  "Hey, I got those with the system,  *for free*".'
>>                                                          (Linus Torvalds)
>>
>>
>
>Hi,
>I have found that when you put two or more machines with the same IP
>address on the same network segment the behaviour can depend on the type
>of hub you are using. If your hub is smart it could bind to one interface
>and send all packets there. In this case you don't get DUPs.
>
>To answer Ira's question, it can be instructive to put two machines with
>the same IP on a network to test how the network reacts. We then note the
>behaviour and show the client so that he will recognize the problem. As I
>said, the behaviour seems to differ if you are using a switching hub, but
>I don't really know why.

A switch is, in technical terms, a bridge. Such a device indeed sends
frames only to the port(s) to which they apparently should go, however
it does so based on MAC address rather than IP address (for the purist,
this assumes a conventional L2 switch and not a L3 switch/router).

Hence, Ira's answer is correct. The process of sending an IP packet
to a host involves first going for ARP, to find the MAC address of
that host. This MAC address is inserted into an ARP cache where it
remains for some amount of time. Then, the IP packet is sent in a MAC
frame, unicast to that specific host.

When two machines assume the same IP address, they still have different
MAC addresses (assuming you didn't fiddle with this either, in which
case you are gonna get a whole different set of issues...). When a 3rd
machine sends a packet to that IP address (say, a PING), it first issues
an ARP. One of the two twins will be the *first* to reply; this reply will
be placed in the ARP cache, and then the actual PING frame will go, unicast,
to that one machine only. Hence, only that machine will even *see* the packet,
and then reply.

If you read this far, you will immediately see: It does not matter whether
all your hosts are connected via hubs, or switches, or even a shared coax
segment. When two machines assume the same IP address, and a 3rd one pings
them, only one will reply -- hence no DUPs.

Doron Shikmoni