Score:0

How does a switch communication map ip address to Mac address?

in flag

Assuming 10 computers are connected via hub. Pc1 sends data to ip address of pc2. But hub broadcasts it to all computers.

Whereas if I replace hub with switch, then switch will maintain table of switch plug and Mac address.

When PC1 sends data to PC2's ip address, then how does switch ensure that it is send to correct computer (Pc2)? I am asking because switch doesn't keep record of ip address.

Nikita Kipriyanov avatar
za flag
The switch doesn't care about IP addresses. If you have such questions, probably SuperUser is a better place to ask, but I am sure this topic is it is answered in vast amount of places in the Internet, even in the Wikipedia. Just google it.
Valentin Bajrami avatar
br flag
Is this a layer 2(L2) or layer (L3) switch? The former (hub) is very insufficient as you already mentioned. It will always broadcast to all connected devices since a hub doesn't keep a Mac address table. Assuming you are using an L2 switch then the switch will keep record of mac addresses of all devices connected to that switch. At this point, data is exchanged only at layer 2. No IP header is added to the payload.. so until L3.. IP's are irrelevant
Nikita Kipriyanov avatar
za flag
@ValentinBajrami the question is basically how switch operation is different from hub opertaion. Don't scare this young soul with L3 switches, they simply aren't ready for that depth. And, as I mentioned, it is answered virtually everywhere, but it is offtopic on ServerFault. We deal with business problems here, not with novice questions about basic networking concepts.
Valentin Bajrami avatar
br flag
@NikitaKipriyanov you are right. Hopefully all these little pieces of information get`variable` going! The intension is definitely not to scare this young soul :)
Score:1
cv flag

In a nutshell, a switch learns which MAC addresses are associated with which switch ports. A network host wishing to communicate with another network host resolves the ip address of the destination host to the MAC address of the destination host and addresses the communication (at the data link layer) to that MAC address. The switch sees the destination MAC address and forwards it to the appropriate switch port.

in flag
So the pc2 must have an ip address for it to receive data from pc1?
joeqwerty avatar
cv flag
Yes............
Nikita Kipriyanov avatar
za flag
Wrong. No. The IP-address requirement is the result of Internet widespread, which uses Internet protocol (IP for short), which uses a 32-bit number ("address") to identify a machine. If you don't need Internet, you are free to use any other communication protocol, not necessarily IP, so you don't always need IP address to communicate. Use IPX, IPv6 (which is different from IP), etc.
joeqwerty avatar
cv flag
@NikitaKipriyanov In the context of this question the OP requires an ip address for his hosts. This answer isn't meant to be a comprehensive networking lesson. For that the OP can purchase and read the following. - https://www.amazon.com/TCP-Illustrated-Vol-Addison-Wesley-Professional/dp/0201633469
Nikita Kipriyanov avatar
za flag
Not only the question is offtopic here, but learning material or course recommendations too :) By answering this question, you gave the impression that it is appropriate. Do you want to have a blast of such questions on ServerFault?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.