Network Hardware - Bridges and Switches
Essentially, the problem with extending LANs with hubs and repeaters is that signals are amplified, but so too is the noise. Since these devices are dumb, all data is forwarded onto the rest of the network. With many nodes, the result is that the amount of network traffic becomes too volumous and the collision rate increases.
A way around this is to use a more intelligent device such as a bridge. It should be noted that a bridge can be a dedicated piece of hardware, or may also be a suitably configured workstation with two Ethernet network cards.
Bridges allow LANs to be split up into smaller 'segments' (called internetworking), yet all machines in the divided network still form a single IP network. A node within a segment in this internetwork will only see frames transmitted by nodes within the same segment, and not frames from nodes in other segments of the internetwork, unless they are forwarded from one segment to the other by the bridge. Hence the bridge performs the filtering of frames in order to limit the amount of network traffic. This is possible because bridges work at Layer 2 (Data Link) of the OSI model. This means that they can examine the data being sent and determine which segment the data needs to be forwarded to.
How do they do this? Well, briefly... the bridge is able to read the destination MAC (Media Access Control) address stored in any Ethernet frame it receives. (If all this doesn't make much sense, check out the TCP/IP section. For now, it's sufficient to know that Ethernet sends data in 'packets' called frames, and each frame contains both the destination MAC address and sender's MAC address.)
By the way, a MAC address is simply a unique hardware address assigned to any network device. It is a 48 bit number, typically represented as 12 hexadecimal digits. For example, the MAC address of your Ethernet adaptor might be:
(You can determine your MAC address or addresses by typing "ipconfig /all" from a DOS prompt.)
Time for an example. First, imagine a LAN as shown below.
In this example, 6 machines have been connected using two hubs. Imagine that Node 1 wants to send some data to Node 2. Node 1 will send its frames destined for Node 2 onto the network. Because hubs are dumb devices, the first hub will see the frames from Node 1, and merrily forward these frames onto all of its ports. Hence the second hub will also receive these frames, and it too will forward them on to all the machines on its other side. Obviously, this is pointlessly reproducing network traffic.
A better approach is to divide the LAN into two segments using a bridge as shown in the diagram below.
Now we have split the network into two segments using a bridge. This bridge could be a dedicated hardware device, or perhaps a PC with a bridging configuration. We will designate the bridge network port on the 'Segment A side' as port 1, and the port on the other side of the bridge (i.e. connected to Segment B) as port 2.
Let's evaluate what happens when Node 1 tries to send data to Node 2, as before. When bridge port 1 receives a frame, the bridge knows it must be from segment A. The bridge examines the frame and determines its source MAC address. It then enters this MAC address into its forwarding table (if it is not already listed).
It then examines the destination MAC address of the frame. If the destination MAC address is not listed in its table, then the bridge does not yet know where this node 'lives'. Therefore, it forwards the frame onto port 2, and thereby onto segment B, in case the destination is in segment B. There is no point in forwarding the frame backwards through port 1, because all the machines on this side of the bridge will have already received this frame.
At this stage, there is no apparent advantage in using the bridge. But let's now consider what happens when Node 2 wants to reply to Node 1. Node 2 sends its data, and this is received by port 1 of the bridge. The bridge stores the MAC address of Node 2 in its forwarding table, and from now on knows that this MAC address exists on a node in Segment A. It now examines the destination MAC address of the frame. This MAC address matches the address it had previously stored for Node 1. Knowing that Node 1 is in the same segment as Node 2, it does not bother to forward the frame onto segment B. It simply discards the frame.
Over a period of time, the bridge can learn the source MAC addresses of all nodes in the network. By comparing source MAC addresses against destination MAC addresses in its forwarding table, it can determine if the addresses reside in the same segment or not. If they do, it doesn't forward; this is called filtering. If they are in different segments (or there is insufficient data in the forwarding table), then the frames are forwarded.
Because bridges do not always forward frames regardless of destination (and furthermore, they only forward complete correctly-formed frames), the amount of network traffic is reduced, and the global network is effectively split up into two (or more) collision domains. This results in improved network performance. If we refer to our hypothetical LAN once more... Once a bridge has ascertained the addresses of all the machines in the LAN, a 'conversation' that takes place solely between machines in Segment A will have no impact on the wire in Segment B! Thus, a conversation can happen in Segment B at the same time. I.e. no longer do machines on Segment B have to wait for all machines to be quiet before transmitting; as far as they're concerned, the cable is already quiet!
Thus, judicious placement of bridges (by grouping computers that talk to each other often into the same collision domain / segment) can lead to a considerably more efficient network LAN.
One last point to note... It is possible to connect multiple segments using what is known as a 'cycle of bridges'. In a complicated network, problems can arise when broadcasting, i.e. when sending messages destined for ALL machines on the network. When a node broadcasts, the bridge on that segment will always forward on that frame. However, if a set of bridges are connected in a cycle, it's possible to achieve a configuration where one bridge forwards to another, which forwards to another, until eventually the bridges end up forwarding in a cycle indefinitely! To circumvent this problem, bridges can communicate with each other and can configure themselves to avoid this problem using an algorithm called distributed spanning tree (DST).
At a glance, a switch resembles a hub. However, it's much more than that. Recall that the hub works at the physical layer of the OSI 7-layer model. This means that it does not examine the data it receives in any way. Any data it receives is simply forwarded on to all of its other ports. But remember that Ethernet uses CSMA/CD to limit collisions. Recall that with CSMA/CD in operation, only one node can send data at any given time. The upshot of this is that when a port forwards data at one port to all the other ports, all nodes in that collision domain must cease transmitting until the LAN is quiet again. This is called operating in half-duplex mode: i.e. messages through the hub are unidirectional and can only occur one at a time.
The switch is an intelligent device that combines the functionality of hubs and bridges. Essentially, each port also acts as a bridge, so that each node becomes a segment (see the description of segments in the Bridge section above). Thus, nodes now only talk to the switch port they are attached to, and not to the rest of the network. In turn, the switch, operating (usually) at Layer 2 of OSI model, inspects the frame arriving at that port and forwards the data only to the port connected to the destination with the correct MAC address. The switch does this using a forwarding or lookup table, much like those used by bridges. During a switch's learning phase, it does not yet know the MAC addresses of all the nodes it is attached to. At this time, frames that arrive that contain an unknown target MAC address will be forwarded onto all of the other ports, just like a hub. This is called flooding. However, once the lookup table becomes populated with MAC addresses, the switch can begin forwarding frames onto specific destinations, via a single port. Because each port-node combination is its own collision domain, the switch can handle multiple 'conversations' at any given time. This is known as full-duplex.
So, in summary, when using a hub, only one computer can send a message at any given time. All other machines on the LAN will hear this message and must remain quiet. With a switch, as many as half the machines on the network can send a message at the same time, assuming they're unicasting (i.e. sending a message to a particular machine, rather than broadcasting).
One might ask why you would ever use a hub, when a switch is so much more powerful and efficient. As always, the answer is: cost. Hubs are much cheaper. However, networking has come on leaps and bounds over the last few years, and switches are now very cheap. However, on a home network of half a dozen computers playing UT, using a switch is probably overkill!
The next section takes a look at routers.
|Just Too Good
Last updated: June, 2006 (DJL)