@ -134,11 +134,8 @@ than two devices on a network? I can't connect a single device to multiple devic
As it turns out, you can. Certain devices, called network switches, or just 'switches' for short, are built for this exact purpose. They have rows of ethernet ports (sometimes upwards of
As it turns out, you can. Certain devices, called network switches, or just 'switches' for short, are built for this exact purpose. They have rows of ethernet ports (sometimes upwards of
30), and are used as a central 'hub' for the devices on a network. They can receive incoming connections from one port, and forward them to another, based on the destination MAC
30), and are used as a central 'hub' for the devices on a network. They can receive incoming connections from one port, and forward them to another, based on the destination MAC
address. A switch maintains a list of ports, and the MAC addresses of the devices connected to those ports. This is called a
address. A switch maintains a list of ports, and the MAC addresses of the devices connected to those ports. This is called a CAM, or Content Addressable Memory, Table. This table is
the backbone of the switch, and is used to direct data to the correct device.
This way, a single switch can essentially connect a network together, providing internal communication.
This way, a single switch can essentially connect a network together, providing internal communication.
@ -155,14 +152,63 @@ heading, unceasingly, to their destination.
This is probably the layer that most people are familiar with. If you've ever heard the term 'IP address', you have at least some idea of the work that this layer does.
This is probably the layer that most people are familiar with. If you've ever heard the term 'IP address', you have at least some idea of the work that this layer does.
So, communication using MAC addresses works pretty well, for short distances. If you're connected to a single other device, you just send the data to them, and if you're part of a larger
So, communication using MAC addresses works pretty well, for short distances. If you're connected to a single other device, you just send the data to them, and if you're part of a larger
network, you send the data to the switch, which looks up the port in its table,
network, you send the data to the switch, which looks up the port in its CAM table, and then directs the data to the right device.
But, what if I want to change my device's MAC address? Remember that MAC address are 'burned-in'at the manufacturing process. More importantly, what if there are multiple networks
connected to each other, like an inter-connected network? Maybe even, an 'internet'?
In such cases, and many more, IP (Internet Protocol) addresses are extremely useful. They are 'logical' addresses, as opposed to the 'physical' addresses that MAC addresses
represent. What this means is that they don't represent a physical object (like a NIC), and can therefore be modified. Essentially, I don't need to know the MAC address of
a device, in order to send data to it.
One of the key uses of IP addresses is in connecting multiple networks together. In comparison with switches, which connect devices together, <b>routers</b> connect multiple networks
together. They use IP addresses to relay, or 'route', data between these networks, which is useful because they can route entire chunks of IP addresses, which isn't feasible with MAC
addresses.
Before getting into the technical details of IP addresses, let me provide a simple example that illustrates the benefit of them, and shows a key difference between IP and MAC addresses.
Let's suppose we have the following topology, which is just a fancy word for the layout of devices in a network:
This topology represents a single network, with two devices connected via a switch. PC1 and PC2 are just PC's, while S1 is a switch. The MAC address for each device is given below it. The
terms 'data' and 'frame' are used interchangably, although this is isn't completely accurate.
Let's suppose PC1 wants to send some data to PC2. It isn't directly connected to PC2, but it <i>is</i> connected to a switch. So it decides to send the data to the switch. The frame for
this data contains PC1's MAC address as the source address, and PC2's MAC address as the destination address.
S1 receives the frame. As it receives the data, it examines the frame for the <i>source</i> MAC address. If you're keeping track, that's the MAC address of PC1 (AA:BB:CC:DD:EE:FF).
So S1 takes the MAC address, and the port number on which it received the frame, and creates an entry in its CAM table.
The next step for S1 is to send the data to PC2. However, it doesn't know PC2's MAC address yet. So, it 'floods' the data, sending it out through all ports, except for the one from which
it received the frame. This means that both PC2 and PC3 will receive the frame. PC3, however, sees that the data wasn't meant for it, by examining the destination MAC address. Remember
that the destination address is still that of PC2. Therefore, PC2 receives the frame, recognizes that the data was meant for it, and generates a response.
The response, once again, goes to the switch. The switch creates another entry in its CAM table, this time for PC2. However, it doesn't have to flood the data this time, because it
already has an entry for PC1 in its MAC table. It just sends the data through the right port, and PC1 receives the response.
This is an important characteristic of switches: their ability to 'learn' MAC addresses over a period of time. Eventually, your switch would have learned the MAC address of every device
on its network, and doesn't need to flood the data anymore.
Now, let's examine another network, or rather a network of two networks: