So far, we’ve shown you the ins and outs of setting up a single network. But what if you need to share resources with another network? That’s where routers come in handy. Routers specialize in seamlessly moving network traffic from one network to another, and this tutorial will show you how. We’ll show you how to program your router and how the router itself can assist you in troubleshooting.
We briefly discussed routers and modems in the first tutorial. In this tutorial, we will go over routers in great detail.
As is usual, let us begin by learning about routers from the ground up. Consider the following scenario.
You and your mate Hermione have created your own network. All of your devices can now communicate with one another and share resources. Your friend Ron has also set up a network in his home. Let us now connect the two networks.
Let’s connect the two networks. But first take a look at the network Ron had set up in his home.
Now let us compare the two networks.
Ron has used a switch of model 2950-24 whereas in your network the model of your switch is 2960-24TT. To know more about these switches follow this link. However, because you are new to networking, you may not understand anything useful from the specifications. So, for the time being, let us keep things simple.
If you left-click on the switch and zoom in on the physical view, you’ll see the following.
This is the physical view of the 2960-24TT switch(switch 0).
This is the physical view of the 2950 switch(switch 1).
We won’t go over the differences between the two switches. This will lengthen the tutorial unnecessarily. Most importantly, it doesn’t matter which switch you use to set up a network at this point. To connect the devices to the switch, we will only use ethernet cables and RJ-45 connectors.
Both networks’ end devices are clearly different. But the way we connect them to the switch is the same.
Now that we have a firm grasp on both networks, let us focus on connecting them.
First let us draw a diagram. Network#1 is yours and Sam’s network and Network#2 is Ron’s network.
The device we will be using to connect the networks is A Router.
So, how do you connect two networks in general?
The first requirement is a functional local area network (LAN). Second, you must connect to the other network. This could be done via a Cat 5 cable, fiber optic cable, or even a radio link. Finally, a router is required to connect the two networks. The router connects networks both physically and logically.
The hardware that makes up a physical network includes cables, switches, hubs, and routers. The logical network is responsible for network addressing.
The diagram shown above was created using Cisco Packet Tracer. If you look closely, you will notice that even though we have physically connected the networks with ethernet cables, we are unable to communicate between them. That is indicated by the red arrows. The issue is that a node on one network does not understand how to send frames to a node on another network. A router understands how to transfer data from one network to another.
Q: So why do we have to use a router? Can’t the switch connect the two networks?
When connecting two networks, we must use a router. Between the two networks, the router serves as a “translator.” Simple switches lack the necessary intelligence.
Q: What is the router “translating”?
Simply put, network addresses. The two networks are like two different cities. The router is responsible for moving data from one network to another.
Q: So do I always need to connect a computer to a switch?
To a switch or to a hub, but never directly to a router.
Q: But I have a DSL router at home, and my computer is directly connected to it. What is that all about?
Excellent observation. There are switches with routing capabilities and routers with switched ports. There is no clear distinction between the two devices. It has more to do with their primary function. Switching routers are now used in large networks. These are equipped with software that allows them to function as routers on switched ports. They are easy to use and make it simple to build large sophisticated networks, but they are very expensive.
Remember from a previous tutorial that data on an Ethernet network is transmitted in discrete units known as frames. The frames are routed based on the MAC address contained within the frame. Remember that in order to send and receive network traffic, every network device on an Ethernet network must have a MAC address.
A switch can only communicate with network nodes that have the same IP network address. A switch can only process MAC addresses. To connect two different IP networks, a router is required. Routers use IP addresses to transfer data from one node to another.
Why Do We Need IP Addresses?
Let us first explain why we do not use MAC addresses to move network traffic.
Every device connected to an Ethernet network is given a MAC address. In your computer, that is the network card. The manufacturer is designated by the first part of the MAC address. The manufacturer then increments so that all of their products have unique MAC addresses. It’s similar to a social security number in that you can’t tell where someone lives just by looking at it.
The MAC address is not capable of storing network information. Each address is specific to the hardware to which it is assigned. The 6 bytes used to determine the MAC Address are used to uniquely identify the hardware device. We cannot store any network information in these 6 bytes. In practice, it would be somewhat inefficient to do so. The manufacturer has no idea who will buy and use a network device when they are manufacturing the device. Even if they knew who was going to buy it, they have no idea on which network the device will be used.
You could, for example, purchase a network card. You may want to upgrade the network card after some time. Then you go out and get a new one. You give the previous one to a friend. As you can see, the network card has adapted the network. Consequently, storing network information in the MAC Address is inefficient.
A network address and a host address are combined to form an IP address. The host part is the one-of-a-kind bit assigned to a specific network device. It’s similar to a phone number. which includes a country code, area code, and local calling area—and, finally, your unique personal number.
The ability to create IP address groups, known as IP networks, is built into the number itself.
IP addresses provide our networks with a sense of location, as well as network nodes with a sense of belonging to that location. IP addresses are used to create an address space in order for different networks to communicate with one another, similar to how area codes relate to different geographical areas. The IP address then assigns a unique network and specific address to each network node.
The subnet mask indicates whether two nodes are on the same network. If you have a network address of 192.168.0.0/16, a node at 192.168.0.1 is on the same network as 192.168.100.1, and no router is required to connect them.
Q: I thought I just needed a MAC address for a frame to get somewhere.
That’s all it takes for an Ethernet frame to get somewhere. But, as mentioned in the previous tutorial, Ethernet frames contain packets, which contain data in the form of protocols. In the case of TCP/IP networks, IP addresses are required to move packets between networks.
Q: If my computer has an IP address, why does it need a MAC address too?
On the same network, a computer can communicate using multiple network protocols. The MAC address allows Ethernet frames to travel between network devices such as routers and switches. The network protocols enable the computer to communicate with devices on other networks.
We’ve already mentioned that a router can transfer data from one network to another. It performs this by reading the packet’s destination and source IP addresses (packets are encapsulated in frames).
But how does it accomplish this? Isn’t it supposed to know about both networks, or at the very least how to connect to the outside network?
Also, how does a network node know to send traffic bound for another network to its router?
We need to program a router so that it knows about the networks to which it is connected and how to connect to other networks.
Before we get into how to program a router, let’s talk about “protocol”. We will do so in the following tutorial.
Why do we not use the MAC address as an IP address or instead of an IP address in networking?
Assume that we were able to overcome all of the limitations mentioned and that computers can communicate over the Internet solely through their MAC addresses. And suppose you run a website that receives tens of thousands of unique visitors every day. That website is hosted on a server, and that server has a network adapter, which has a MAC address.
What happens if that network adapter or the entire server fails? In most cases, you simply purchase a new server, restore a backup of the old server, and you’re good to go. However, keep in mind that, as previously stated, a MAC address is unique to the physical network adapter, and your new server has a new network adapter with a new MAC address. Instead of your website being up and running, you now have to go tell those tens of thousands of unique visitors a new address (perhaps you can do this via DNS, or perhaps DNS does not exist in our alternate universe).
IP addresses perform all of the functions described in the other answers, but they also provide a layer of abstraction so that hardware-level changes do not disrupt network- or application-level communication.