Understand Networking Devices: Switches & Routers

Reading Time: 3 minutes

In today’s post, we are going to find out why we should gain some networking related knowledge. The short answer: it’s dope!

The convenient Mr. Networking

Nowadays, when the term IoT (Internet-of-Things) might have aged a little bit, we probably familiarized ourselves with the fact that things are hooked into networks.

But, as strange as it might seem, we tend to take it for granted when it comes to networking, as if it’s some kind of plug-and-play thing (can’t blame us, we literally plug it in and bam, we’re connected).

It even got worse with WIFI because most of the times, we can connect our devices to the network after just a few clicks/touches. So in short, networking seems like magic!

The only two devices you’ll need

The reason is understandable, we likely focus onto things that matter the most: logical functionalities. That’s why we spend most of the time writing codes and actually enjoy it.

And when it comes to networking, chances are we got our heads already pre-exposed to the following myths:

  • Networking is freaking hard, so many hard-to-digest terms: OSI, TCP/IP, EIGRP, OSPF, STP etc
  • Networking is boring

And most importantly:

  • There are so many devices. It’s costly and I don’t know what does what!?

Well, my friends, I’m here to tell you that all myths above are far away from being true.

Just like software development, networking does have a learning curve and it’ll click once you understand the fundamentals. And no, it’s not boring. It’s so much fun!

Regarding the last one, yes, there’s an overwhelming list of devices out there. But, what you need to upgrade your home network to another level only requires two of those: a switch and a router.

Switches

If you’ve just stepped into networking, just start with a switch!

Network switches actually have an ancestor which we called, a hub. But it’s in the past now, don’t bother look it up.

Googling what a switch does, you’ll see the result immediately. The thing is, do you really get it?

At its core, network switches are layer-2 devices. What it means is that within one network, it forwards signals (called frames) using MAC addresses.

Therefore, if you have two devices, just plug them into a switch and they can talk to each other. Sounds familiar? Yes, it’s the most basic form of what we call a LAN (local area network).

One switch and two PCs

In the example above, I set up a network with two PCs and one switch. Ignore the IP addresses (i.e. 192.168.1.1/24 etc) for now. They’re there to make it clear that two PCs are on the same network. As you can see, PC1 can talk to PC2 and vice versa.

Routers

Network switches may sound strange but I bet we’re familiar with the term router.

Everyday, we may actually hear it a lot: home routers, wireless routers etc. Technically speaking, it’s nothing wrong with those product names, other than it may give us a wrong impression of what a router actually does.

In short, a router’s job is to route signals (called packets) from one network to another network using IP addresses.

I may have lost a few audience at this time 😉

Let me explain. I will assume that we’re all familiar with 192.168.x.x or as we usually called them local IP addresses.

Have you ever seen someone else’s 10.x.x.x IP addresses? Or have you ever heard someone say they have two local networks at home? How’s that even possible?

While I’m not going into details regarding IP addresses and subnetting, I’ll show you one simple trick to know whether two networks are different.

An IP address in its full form has two parts: the IP address itself and a subnet mask (ex: IP: 192.168.1.5, subnet: 255.255.255.0). All you need to do is to compute the bitwise AND of the two and compare the results.

For example, are 192.168.1.5 255.255.255.0 and 192.168.1.200 255.255.255.0 on the same network?

192.168.1.5 & 255.255.255.0 = 192.168.1.0

192.168.1.200 & 255.255.255.0 = 192.168.1.0

The answer is yes, they belong to the same network.

What about 192.168.1.5 255.255.255.0 vs 10.100.1.5 255.255.255.0?

192.168.1.5 & 255.255.255.0 = 192.168.1.0

10.100.1.5 & 255.255.255.0 = 10.100.1.0

So the answer is no, they are on separate networks.

Naturally, devices on different networks can’t talk to each other. That’s where a router comes in handy.

With proper setups, a router can help devices on different networks talk to each other.

One router and two PCs

In the setup above, we have two PCs on two different networks (192.168.1.0 and 10.100.1.0). With router R1 in between, we can set it up so that PC1 can talk to PC2 and vice versa.

One quick note though, some switches can also do routing (we call them layer-3 switches). But let’s talk about those in another time.

Combine switches and routers

Once we have the basic understanding of networking and how devices like switches and routers work, we can combine and create a more complicated topologies (i.e. network setups). A more complex topology typically improves network reliability, security and so much more.

For instance, we can create the following topology for three offices with separate networks. And of course, devices from all offices can communicate with each other without problems.

Three offices with separate networks

As you can see, the possibilities are literally endless! The more you understand networking, the more you find it so straight-forward to digest and so much fun to play around.

Conclusion

In today’s post, I have walked you through the most important networking devices: switches and routers.

My hope is that after reading, you can have a better intuition regarding what they are and what they actually do.

And that’s it from me today. Thank you very much for your time! Stay safe & I’ll see you around.

Trung Tran is a software developer + AI engineer. He also works on networking & cybersecurity on the side. He loves blogging about new technologies and all posts are from his own experiences and opinions.

Leave a reply:

Your email address will not be published.