How exactly does a switch work?

DAM

Diamond Member
Jan 10, 2000
6,102
1
76
Today in class we were talking about how a switch directly connects one computer to another computer without having to send the data to all other computers connected to the switch. However, if I want to send something to computer C, how does the computer know where computer C is? I hope I am making my question clear.




dam())
 

Vegito

Diamond Member
Oct 16, 1999
8,329
0
0
arp resolution finds the mac address of the card that it needs, and after it finds it, it'll only go to that switched port..
 

DoctorBooze

Senior member
Dec 10, 2000
313
0
0
The switch works like a computer with 24 (or however many) ethernet cards in it. The ethernet effectively becomes a star topology with exclusively point-to-hub links. The switch is clever enough to make broadcasts still work though :) Usually the switch will accept then forward packets, trying to avoid collisions; this is important where a workgroup all talks to the one server, and also where ports have different speeds (e.g. some have 10b-T and some 100b-T). Every one of the 24 (or however many) ports on the switch has a different MAC address. You already knew how unswitched hub and old-style hubless 10b-2 co-ax ethernet networks worked out what packets went where didn't you?

Sorry forcesho, arp is a higher-level protocol which binds IP addresses to MAC addresses, nothing to do with how ethernet packets get from one computer to another.
 

SPAnDAU

Senior member
Oct 15, 1999
677
0
0
To expand on that respons, if you have 4 computers, A,B,C,D the switch initially does not know where any of the computers are, so it does this:

Computer A is on port 1
Computer B is on port 2
Computer c is on port 3
Computer D is on port 4

If A tries to send a packet to comoputer D, the packet will arrive on port 1, the switch will make a note that Computer A is on port 1. It then broadcasts to all ports, and when Computer D responds, it sends that packet to port 4 and makes a note that computer D is on port 4. If computer B wants to send a packet to computer C, the switch will record computer B's address, then broadcast to the other ports on the switch until it finds computer C on port 3, when it finds computer C, it will record computer C's address on port 3.

Once the switch has recorded all of these addresses in it's ARP table, it no longer needs to broadcast, and the switch can then operate at it's full potential.
 

DoctorBooze

Senior member
Dec 10, 2000
313
0
0
SPAnDAU, it's not ARP. Sorry I don't remember the right name. The switch keeps a table of what MAC addresses are where, just like you said, but ARP is an IP-level protocol, and switches only need to deal in Ethernet packets. Remember you can run IPX, NetBIOS, EtherTalk and god knows what else over an ethernet as well as IP.