Skip to content

Switching#


When it comes to networking, there are two things you need to be concerned with at this stage in your career: switching and routing. We looked at the physical hardware behind these concerns in an earlier chapter but now it's time to look at the actual logic jobs of switching and routing.

Computers tend to have, at minimum, a single piece of networking hardware inside of them known as a Network Interface Card or NIC. We've covered this previously. This piece of hardware has a unique identifier embedded into it called a Media Access Control (MAC) address. This MAC address is unique across the entire planet. No other NIC in the world has the same MAC address.

But why do computer NICs have this hardware address? One of the reasons is ARP - Address Resolution Protocol.

When a computer is connected to a network, to a switch, it has (typically) two things: a MAC address and an IP address. Both are unique to the computer, but only the MAC address is globally unique. The IP address will be different to the other computers on the same network but not on another networks. Two computers on different networks, whether inside the same building or 10,000kms away from each other, can share the same IP address.

It's the MAC address that's used at the local network level - between systems on the same network - to send data between systems and identify which system is which.

What ARP does is translates between an IP address and a MAC address. Here's an illustration of a simple set of networks:

Simple set of networks Simple set of networks

Two networks and a router

We have two networks represented by switches. Each switch has two devices connected. Notice how in both networks the connected devices have identical IP address but unique MAC addresses?

Let's pretend that in "network 1" (on the left) the IP 192.168.88.11 wants to send some data to 192.168.88.10 because it wants to print a document. To do this the operating system (the kernel - remember that?) will use ARP to "translate" the IP address 192.168.88.10 to the MAC address of the printer, which according to the diagram is 1:2:3:4. Once it's completed this translation, it can send data over the network to the printer by asking the switch to "packet switch" its data between itself and the printer.

The printer would report back on the progress of the print job using the same principle: asking the switch to packet switch the data to the laptop that requested the print job.

But here's a super important point: if that same computer wanted to talk to another computer in "network 2" (on the right), it would not use ARP to do that. That's because it's in an entirely different network and MAC addresses only concern themselves with the local network and other devices attached directly to it.

We need routing if we want to go between networks and we need to do something different with our choice of IP address.

Next#

Now let's continue our journey and look at routing between our two networks above because a computer in "network 2" wants to print something in "network 1".