Lab Series 1: An introduction to computer networking.

?
computer networking: sharing information between one or more connected devices. 

When a device, such as a computer, printer, tablet, etc. wants to communicate with the outside world, it establishes or joins what is known a computer network. Once it has become part of a network, the computer can "talk" to the network by sending information via its network adapter to its intended recipient.

When a device joins a network, it is assigned a network address. Much like a home address, a network address tells other devices where to find this device, and similarly, this device is able to find other devices by their network address. If you are reading this right now, it means that your Internet Service Provider (ISP) (ex: Spectrum, Charter, AT&T, etc..) provided you with a device to talk to their network, and that device was assigned a network address which allows it to talk to your ISP's network, and allows your devices to find the vast array of other computers and networks around the around we collectively call the Internet. We will also refer to your network address as an IP or Internet Protocol address. For example, the IP address of the computer this web site is located at is 47.181.172.148. This is known as an IPv4 address, as it has four sets of numbers that make up its network address. There is also a newer class of IP addresses, IPv6, that look like this 2001:4860:4860::8888 (this address belongs to google.com). If you have either the IPv4 or IPv6 address of the intended recipient, then you know how to reach the device (there's a lot more to it that we'll cover, but this is just a simplified example.)  

Most devices that have network capabilities have the ability to talk to themselves by the way of a special network adapter known as the loopback adapter.  Remember we just discussed IP addresses? Well, the IP or network address of the loopback adapter is 127.0.0.1 and is only accessible from the device that it is attached to. In other words, any device communicating with 127.0.0.1 is talking to itself.

Who are you talking to? Why, myself of course

Although there's perfectly nothing wrong with talking to yourself, it probably would start to get boring after a while. It might make sense to get out and find someone else to talk to. For example, how would a computer such as the one you're reading this article on communicate with another device, such as the computer this article is located on or your bank website, or google.com?

Let's start by explaining what actually happens on a network. We discussed the device communicating with itself but let's expand that thought and discuss how a device might actually communicate with other devices. We covered that a network device has an internal loopback adapter IP address of 127.0.0.1 that it uses to talk to itself. However, in order to communicate with other devices, another network or IP address needs to be assigned to the device. This is the IP address that the device will use to communicate to the outside world, and the address the outside world will use to communicate with the device.  This will be the device's public IP address.

On the hardware side, there are two ways of connecting the physical device to a network, which are wired and wireless., and this primarily depends on the type of network interface or network card used to connect the device to the network. A desktop computer, for example might have both wired and wireless networking capabilities, whereas a device such as a tablet or phone will primarily only have wireless, also referred to as Wi-Fi. In order to really understand what's going on behind the scenes, lets take a look at both, starting with wired networking, which interchangably is also referred to as Ethernet.

Wired, or Ethernet networking, consists of connecting the device to another device via a physical cable, commonly referred to as an Ethernet cable.

Typical Ethernet cable. They come in different colors and lengths and configurations.
This is an Ethernet port that you'll find on devices that support Ethernet networking.

You would typically plug one end of the Ethernet cable into the Ethernet port on your device and you would plug the other end of the cable into a wall socket or port that is connected to your network gateway, which we'll discuss later.

Let's say for example, that we have two computers, computer A and computer B, and we want the two devices to be able to communicate with each other.

How would we do that? We could connect the two computers together via an Ethernet cable, and assign an IP address to computer A and a different IP address to computer B, and as long as we assign the right IP addresses to both computers, the two computers should then be able to communicate with each other and share information. For the purposes of this example, we are going to assign IP address 192.168.0.1 to Computer A, and 192.168.0.2 to Computer B, and we are going to connect the two computers together via an Ethernet cable.

Now, whenever Computer A wants to talk to Computer B, it would send information via its network adapter to the address 192.168.0.2 and Computer B should receive it. If Computer B wishes to respond back to Computer A it would then send information via its network adapter to the address 192.168.0.1 and Computer A should respond. Congratulations, we've created a computer network and each device has someone to talk to!

We have an issue here

What happens then if another computer, lets call it Computer C, comes along and wants to join the network that Computer A and Computer B are on? Well, Computer C has an available network adapter, so we can attach an Ethernet Cable to Computer C, but the network adapters on Computer A and Computer B are occupied by the cable connecting the two computers together, so right now, we need a way for Computer C to join in.

Ethernet cable splitter

Great! We found a solution. We'll just use this device called an Ethernet cable splitter, and plug one end into one of the computer devices, for example Computer A, and then plug the other two devices, Computer B and Computer C, into the two ends of this device and then we'll have a new network.

Our lovely new network

You could do this, but now you also put a lot of pressure on Computer A. In order for this network to function properly, Computer A has to be on all the time and is essentially the go-to between Computers B and Computer C. If Computer A is turned off, for example, Computers B and C are not able to communicate with one another, which makes Computers B and C sad because now they are only able to communicate with themselves again until Computer A comes back online and rejoins the network. So there has to be a better way, and luckily for us, there is.

Not so happy network. Since Computer A is away, Computers B and C are stuck talking to themselves again.

To alleviate this issue, we are going to connect the computers to a device called a switch. The purpose of a network switch is to connect multiple devices together to form a network.

Computers connected to a switch

Now, as long as the switch device remains on, Computers A, B, and C are free to talk to each other whenever they wish. If Computer A is turned off or removed from the network, that will not limit Computer B's ability to talk to Computer C or vise-versa as we saw in the previous example. We have created the basis of a private, also referred to as a local area network, or LAN. Our three computer devices are able to communicate with each other over the LAN. We can add additional devices, such as a printer or a game console, or really any other network device to our LAN, and as long as we have enough ports to accommodate the number of devices we have available, we should have no problem expanding our network. You can find switches that range in port sizes from 3 and 4 ports on smaller devices to 96 port devices you might find in some large businesses, and can differ based on the speed the port is designed to provide, but we'll get into that later.

Two networks

I'm now going to refer to two people in this example, Amir and his friend Rebecca, who have both been following along with this guide and have created their own local area networks, or LANs. Both of their LANs are functioning well, meaning that all the devices on Amir's LAN can talk to each other, and all the devices on Rebecca's local area network or LAN, can talk to each other. Now, what happens when Amir wants to share information with Rebecca? Does that then mean that Amir has to find a long enough cable to connect his switch to Rebecca's switch? Possibly, but lets take a look at that first.

As it stands, if Amir were to find a long enough cable and was able to connect his ethernet switch to Rebecca's ethernet switch, there would be instant trouble. Why? Because Amir has a computer with IP address 192.168.0.1 and Rebecca also has a computer with IP address 192.168.0.1, so if they were to connect the two computers together, and another device, say Amir's Computer B, wanted to talk to 192.168.0.1, it wouldn't be able to tell if that was the Computer A on his network, or the Computer A on Rebecca's network, and so forth.

Ok, so an easy solution would be to have Rebecca change all the IP addresses of all the devices on her network so that none of them share the same address with any of the device addresses on Amir's network. That could work, but its impractical for so many reasons. For example, she could change her devices in this scenario to 192.168.0.4, 192.168.0.5, and 192.168.0.6, and in this scenario, that would eliminate the conflict between the devices, but it could lead to other issues and other conflicts later down the line.  Is there another solution that would allow us to accomplish the same scenario without requiring Amir or Rebecca to change all the addresses of the devices that they have already set up? Yes there is.

To alleviate this new issue, we are going to connect our switches to another device called a router. The purpose of a router is to allow devices on different networks to be able to communicate with each other. What the router does is translate information from one network onto another to prevent the scenario described above. On most routers, you will typically see one port marked as a WAN port or Wide Area Network port and one or more ports marked as LAN or Local Area Network. You will typically connect your switch to one of the port(s) marked LAN port and assign it an IP address similar to the IP addresses on your network. You will then connect the WAN port to an outside network and assign it a different IP address, one not on your network. It is this alternate IP address that other networks will use to communicate with your network.

Switches connected to each other's networks via Routers

So in this example, we are going to assign Amir's router a WAN port address of 192.168.10.1 and his LAN port an address of 192.168.0.4, and we are going to assign Rebecca's router a WAN port address of 192.168.10.2, and her LAN port address an address of 192.168.0.4. (It is okay if Amir and Rebecca's router LAN port share the same IP address, because each network is hidden to the other person.) In this example, what will happen is that a computer on Amir's LAN, let's say Computer B with an IP address of 192.168.0.2, wants to exchange information with a computer on Rebecca's LAN, let's say Computer C with an address of 192.168.0.3. To make this work, what will happen is that Computer B on Amir's network will exchange information with the switch that it is connected to, which will exchange information with the router that it is connected to, which will then translate the information marked for Rebecca's network onto the network 192.168.10.1 with a destination address of 192.168.10.2 (what it believes Rebecca's network to be). So now, the router has converted all data bound for 192.168.0.3 on Rebecca's network to 192.168.10.2. Rebecca's router then responds and receives the information from address 192.168.10.2, and in reverse fashion, understands that this information was meant for the computer 192.168.0.3 on her network, and so then translates the destination address from 192.168.10.2 to 192.168.0.3. Because her router realizes that this information is destined for an device connected to an internal network, passes this data over the LAN port of the router onto the internal private network so that the information can reach its desination address. Lets see a better example of this.

Computer networking example exchanging data between different networks.

So in this example, Computer B on Amir's network with an IP address of 192.168.0.2, wants to communicate with Computer C on Rebecca's network with an IP address of 192.168.0.3. Let's see how this would work.

First, because Amir's computer and Rebecca's computer are on different networks, they wouldn't be able to communicate directly with one another. The data would need to be translated from Amir's network onto Rachel's network and we can do that with the assistance of Amir's and Rebecca's routers. The data sent out from Amir's network will then be routed to Rebecca's network, where it will be decoupled and delivered to the intended device.

Computer B (192.168.0.2) sends out information destined for the computer C on Rebecca's network (192.168.0.3). However, Amir cannot send directly to 192.168.0.3, because that information would then go to Computer C on his own network. So what Amir must do is send the data to Rebecca's network, and Rebecca's network will be responsible for routing the data to its intended device and vise-versa. So in this scenario, Computer B will send out information destined for 192.168.10.2, the public interface of Rachel's network. The information will pass through the switch on Amir's network and reach Amir's router. The data will reach the LAN interface of Amir's router, and once the router realizes that this request is for a device not on its network, it passes the data onto its WAN interface of Amir's network (192.168.10.1). Once the data reaches its destination, which is the public or WAN interface of Rebecca's router (192.168.10.2), Rebecca's router realizes that this information is destined for a device inside its network, and so passes the data onto the LAN interface of its network and translates the destination to 192.168.0.3, or Computer C, the intended device on her network.

?
In our first lab, we are going to set up a virtual environment which will enable us to setup the example shown above and test connectivity between devices on each network.