...

Friday, April 2, 2010

CCNA 10

CSMA/CD are the rules of engagement in Ethernet networks. Up till the 90's, all Ethernet communications was done through a hub. A hub is a layer 1 device that repeats bits out of all ports except the one it received it from. In a hub, all packets are broadcasts. In this case, the hub is said to have 1 collision domain. In a collision domain, only one device can communicate at one time. A hub is also said to have 1 broadcast domain. A broadcast domain defines how far a broadcast travels before it stops.
In a hub, if two devices try to communicate at the same time, a collision will occur. Once you have 10 to 20 devices connected to a hub, the problem with collisions become apparent. When a collision happens, one device will send out a JAM signal. The devices then backs off for a random amount of time (in milliseconds) and begins sending.

This is when layer 2 segmentation is required. The network is separated into two hubs connected by a bridge. A bridge typically has two ports. The bridge listens and learns the MAC addresses on each interface and decides whether to forward packets to the other side. On a bridge, each port is a collision domain.

A switch is like a multi-port bridge. Each port is a collision domain. Because all links are in its own collision domain, it can transmit and receive at the same time, resulting in full-duplex operation.

All network cards are rated at half-duplex speeds. In essence, in a full-duplex environment, the effective throughput of Fast Ethernet is 200Mbps. A hub operates at wirespeed, while bridges use software bridging which is generally slower. Switches use ASIC to power their intelligence instead of software like in bridges, and therefore is able to route packets at wirespeed as well.

The switch (and bridge) is said to work at the Data Link layer of the OSI model. The Hub (and repeater) on the other hand is said to work at layer 1. When a switch first boots up, it has an empty CAM (Content Addressable Memory) table. The CAM table stores MAC addresses and needs to be populated for the switch to be smart. Whenever there is traffic, the MAC of the sender is stored in the CAM and associated to that port.

Assume we have 4 computers connected to a switch:
Host A - aaaa:aaaa:aaaa:aaaa
Host B - bbbb:bbbb:bbbb:bbbb
Host C - cccc:cccc:cccc:cccc
Host D - dddd:dddd:dddd:dddd

They are connected to port f0/1, f0/2, f0/3 and f0/4 respectively. Now, when Host A first wants to communicate to Host B, what does it do? Yes, it sends an ARP. That ARP request contains the MAC address of Host A. Immediately, the CAM table would look like this:
f0/1: aaaa:aaaa:aaaa:aaaa

Remember that an ARP request has a MAC of ffff:ffff:ffff:ffff. This means that it would be a broadcast and all hosts would receive it. Now Host B should reply with his MAC address. The packet would be intelligently forwarded only to port f0/1 as the destination MAC is destined only for that port. At this instant, the CAM table would contain:
f0/1: aaaa:aaaa:aaaa:aaaa
f0/2: bbbb:bbbb:bbbb:bbbb

Now any communication between Host A and Host B would only be heard on ports f0/1 and f0/2. Now assuming that Host A somehow knows of Host D's MAC and attempts to send a packet with dddd:dddd:dddd:dddd as the MAC. At this point of time, the switch still doesn't know which port Host D belongs to. Therefore, the packet is flooded out of all ports. When Host D replies, his MAC is known and associated with f0/4. The CAM table would then resemble:
f0/1: aaaa:aaaa:aaaa:aaaa
f0/2: bbbb:bbbb:bbbb:bbbb
f0/4: dddd:dddd:dddd:dddd

From this point on, any communication between Host A and Host D would only be seen on f0/1 and f0/4.

It typically takes only 15 seconds or less for a switch to learn all the MAC addresses of PCs on a port as computers are always chatty.

No comments :

Post a Comment

<