Reducing Congestion by Opening Up More Lanes on Each LAN


When you're using a hub, only one device can transmit data at any one point in time. With a switch, multiple devices can transmit at the same time, increasing the amount of data that can be sent over the LAN. All you have to do is replace the antiquated hub with a LAN switch.

Why is this true? Well, stay tunedthat's what most of the first section of this chapter is about! First, I'll explain why hubs only allow one device to send at a point in time; then I'll explain how a switch overcomes that problem.

Hubs: A One-Lane Road

To appreciate the potential traffic congestion problems when using an Ethernet hub, you need to review a couple of key facts. First, consider the logic used by a hub:

Hub: When I receive an electrical signal, I repeat it out all ports, except the port in which the signal was received.

That's how a hub operates. Now add to that the logic that NICs use in the PCs that are attached to the hub. Those PCs use carrier sense multiple access collision detect (CSMA/CD) logic, the first part of which is as follows:

PC: Listen before sending. If you're currently receiving a frame, wait until it is finished before you try to send your frame.

With these two facts combined, any time a device sends a frame, all other devices receive the frame. That means that those other devices choose not to send at the same time. Figure 6-1 illustrates the point.

Figure 6-1. Betty Waiting on Fred's Frame That Was Sent to Barney


As seen in the figure, Fred's frame is passing over the cable to the hub, and the hub repeats the frame out all other portsincluding the one connected to Betty. Due to CSMA/CD logicwhich is useful logic because it prevents collisionsBetty must wait even though she simply wants to send a frame to Wilma. It's like paving a beautiful wide road and only having one lane, so everyone must wait until one car finishes driving past before the next car can use the road.

Switches: How to Create Dozens of Lanes on the LAN

LAN switches provide the same cabling advantage that hubs do, while providing significant performance improvements. For example, you can run a single cable from each device to the wiring closet and connect those cables to a switch instead of a hub. You get much better cable management.

To appreciate why switches perform better than hubs, you need to consider the logic that a switch uses and compare it to the logic that a hub uses. A switch allows every device on the LAN to communicate with every other devicethe same result as when using a hubbut using different logic, which is summarized as follows:

When receiving a frame, examine the destination Ethernet address. Forward the frame out the one portand only that portthrough which that address can be reached.

So, in comparison to a hub, a switch does not simply repeat the electrical signal out all other ports. Instead, a switch forwards frames selectivelyonly forwarding the frame where it really needs to go. Switch logic actually examines the contents of the Ethernet frame and finds the destination Ethernet MAC address to make an intelligent decision. Figure 6-2 illustrates the logic, with Fred sending to Barney.

Figure 6-2. Switch Logic for Fred's Frame Sent to Barney


Figure 6-2 shows the same PCs and cables as were in Figure 6-1, but Figure 6-2 shows a switch instead of a hub. In fact, in real life, you can do that same thing: Simply replace a hub with a switch, and use the same cables. The switch still uses a twisted pair for transmission and another for receiving traffic in each cable. It uses the same pinouts in the RJ-45 connector. The switch receives on pins 1 and 2 and transmits on pins 3 and 6, just like a hubmeaning that you need a straight-through cable between the switch and each computer. So, the physical details can remain the same.

The difference between switches and hubs lies in how they choose to forward traffic. To make a forwarding decision, a switch uses a table that lists the MAC addresses in the network. As shown in Figure 6-2, the table tells the switch where Barney's MAC address, 0200.2222.2222, sits in the network. So, when the switch receives a frame whose destination is 0200.2222.2222, the switch forwards the frame out port E1and port E1 only. This table can be called many things; in this book, I'll refer to it as either the switching table or the MAC address table.

You can think of the MAC address table as a road sign and the switch as an intersection. The switch looks at the road sign and compares it to the destination of the frame (destination MAC address). The road sign gives the directionswhich turn, or switch port, to takeso the switch can forward the frame appropriately.

LAN switching logic improves LAN performance in part because the frame is not repeated to every computer that is attached to the switch. Notice that unlike Figure 6-1, Betty and Wilma do not receive the frame in Figure 6-2. Betty still uses CSMA/CD logic, which begins with the "Listen first, and wait if you are currently receiving a frame" logic. However, because Betty is not receiving a frame, if she had a frame to send to Wilma, she could indeed send, as shown in Figure 6-3.

Figure 6-3. Fred Sending to Barney, While Betty Sends to Wilma


This example shows two devicesFred and Bettysending a frame at the same time. With a hub, only one device could send at a time. With two devices sending at the same time, the capacity of the LAN to forward frames doubles!

The original Ethernet specifications define a 10-Mbps transmission rate. In Figure 6-3, two separate transmissions occur, each at 10 Mbps. In one way of thinking, this LAN has 20 Mbps of capacity because it allows two concurrent transmissions at 10 Mbps. Now imagine a switch with 24 ports, with the device on port 1 sending to the device on port 2; the device on port 3 sending to the device on port 4; and so on. All 12 of the odd-numbered ports are sending frames in this case, so this switch supports 12 x 10 Mbps, or 120 Mbps, of capacity.

By using a switch instead of a hub, multiple devices can send at the same time, vastly increasing overall traffic capacity.

The Perfect Roadway: No Wrecks Allowed!

In real life, it would be great if somehow you could drive your car as fast as you like, never have to stop at traffic lights, get where you are going easily, and never have a wreck. It almost sounds like something out of a bad science fiction movie, but with switches, the equivalent does occuryou can create a world without collisions.

With the switch logic you have learned about so far, multiple devices can send, but the example had the guys (Fred and Barney) talking and the gals (Betty and Wilma) talking. What if everyone wanted to talk (send) to Fred at the same time? Figure 6-4 shows the potential problem.

Figure 6-4. Potential Collision When Forwarding Multiple Frames onto the Same Pair


With what you've learned about switches so far, the switch would try to forward all three frames, which would cause a collision. However, to avoid sending all three frames at the same time, the switch uses buffers. Buffers consist of memory inside the switch that is used to store frames temporarily. The switch sends one frame, and it keeps the other two frames in buffers. After the switch finishes sending the first frame, it gets one of the frames from the buffers and sends it. Finally, the switch grabs the third frame from the buffer and sends it. By doing so, the switch usually avoids causing a collision. Figure 6-5 illustrates the same logic.

Figure 6-5. Switch Avoids Collisions by Buffering the Frames


So, the litany of switch logic now reads like this:

  • When receiving a frame, examine the destination Ethernet address. Forward the frame out the one portand only that portthrough which that address can be reached.

  • If multiple frames need to be sent out the same port, send one frame and buffer the rest, sending them when the port becomes available.

By buffering frames, switches do not create collisions. The original frames make it across the LAN with minimal buffering delay. For instance, if those three frames were each 1250 bytes long, it would only take 3 milliseconds (.003 seconds) for all three to be sent over the cable from the switch to Fred. If collisions had occurred, each frame would have taken longer to reach Fred, and both the collision and the time taken to resend the frames could have prevented other user traffic from crossing the LAN. So, the buffering of frames definitely improves LAN performance.

Using Full Duplex: Making the Streets Two Way

The network interface cards (NICs) in the computers in this chapter still use CSMA/CD logic. In most cases, because the switch forwards frames only out the right destination port, most of the PCs simply weren't receiving frames the majority of the time. With CSMA/CD, if you are not receiving a frame, it's okay for you to go ahead and send. The switch avoids collisions by buffering the frame if the output port is busy.

However, there is still one case for which a computer NIC, using CSMA/CD, believes it should not send. That's when the NIC is actually receiving a frame. Imagine that Fred is sending another frame to Barney, as in Figure 6-6. Barney wants to send a frame. (In this case, Barney wants to send a frame to Fred, but the destination does not really matter in this scenario.)

Figure 6-6. Barney Waiting to Send, When Fred Sends to Barney


With Barney's CSMA/CD logic enabled, he must wait before sending a frame. However, physically, there is a single cable between Barney and the switch. No collisions can occur on that cable because Barney sends on the pair using pins 1 and 2, and the switch sends to Barney on the pair using pins 3 and 6. And you already know that the switch will buffer any frames, rather than cause a collision, so there is truly no danger of a collision.

In this particular case, Barney chooses not to send the frame to Fred because his CSMA/CD logic tells Barney to wait. But if Barney sent the frame, he wouldn't cause a collision. The solution: Barney's NIC must suspend its CSMA/CD logic. By disabling CSCMA/CD logic, Barney can send and receive at the same instant in time as receiving the frame from Fred. The ability to send and receive at the same time is called full duplex. (The CSMA/CD imposed restriction of only sending or only receiving at one point in time is called half duplex.) Figure 6-7 shows the result with full duplex enabled on both Barney and Fred.

Figure 6-7. Barney and Fred Sending and Receiving at the Same TimeFull Duplex


This section started by making an analogy that a hub was like a one-lane road, and that you had to wait until the other car passed before you could use the road. With switches and full duplex enabled, the LAN works like you have a two-lane road between the switch and each device, plus another two-lane road between each port on the switch. The switch plays traffic cop, preventing collisions simply by buffering frames. Figure 6-8 illustrates the basic idea.

Figure 6-8. Full Duplex and Full Switching


Now that you understand why LAN switches perform better than hubs, you can appreciate why most Ethernet LANs today use switches. However, this chapter hasn't covered everything about how switches work yet. In the next section, you'll read a more thorough description of how switches work.




Computer Networking first-step
Computer Networking First-Step
ISBN: 1587201011
EAN: 2147483647
Year: 2004
Pages: 173
Authors: Wendell Odom

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net