Computer Network Basics
This article is to help you understand computer network basics and enable you to troubleshoot network problems by yourself.
In this article we will cover the basics of the IP address, subnet mask, router, default gateway and DHCP.
IP Address Basics
For a computer to communicate with another computer it needs an IP address, and it must be unique. If there is another computer on the same network with the same IP there will be an IP address conflict and both computers will lose network capability until this is resolved.
The IP address consists of 4 numbers separated by decimals. The IP address itself is separated into a network address and a host address. This means that one part of the IP address identifies the computer network ID and the other part identifies the host ID.
As an example, an IP address of 192.168.0.45 is known as a class C address (more on classes later). A class C networks uses the first 3 numbers to identify the network and the last number to identify the host. So, the network id would be 192.168.0 and the host id would be 45. Computers can only communicate with other computers on the same network id. In other words networking will work between 2 computers with IPs 192.168.0.231 and 192.168.0.45 respectively but neither can communicate with 192.168.1.231 because it is part of the 192.168.1 network.
IP Address Classes
As we are only covering computer network basics I am only going to discuss 3 classes of IP addresses. Before we look at these however, it is important to point out that IP address classes are more or less redundant now. These days subnet masks (explained later) are used to define which part of an IP address is the network ID and which is the host ID.
Class A address – A class A IP address denotes that the first number out of the four defines the network id and the last 3 define the host id. A class A address is identified by the first number ranging from 0-127. This means that as long as the IP address starts with 126 (for example) it can communicate with another computer that has an IP address starting with 126 also.
Class B address – A class B address means that the first 2 numbers represent the network id and the second 2 represent the host id. A class B IP address is identified by the first number ranging from 128-191. Again as an example a computer with an IP address of 172.16.34.21 can communicate with a computer with an IP address of 172.16.45.72 but not 172.17.45.72. This is because 172.16.x.x and 172.17.x.x are separate networks.
Class C address – The class C address is what we are most familiar with. This uses the first 3 numbers to define the network id and the last number to define the host id.
A class C IP address is identified by the first number ranging from 192-223. The range that you will come across the most is 192.168.0.x. Again as an example a computer with an IP address of 192.168.0.23 can communicate with a computer with an IP address of 192.168.0.234 but not with 192.168.1.5. This is because 192.168.0.x and 192.168.1.x are separate networks.
With the appearance of the subnet mask there is no longer a need for different classes of IP addresses. The subnet mask introduces classless IP addresses.
This means is that you can use a class C IP address of 192.168.0.1 and make it a class B or A address by altering the subnet mask. This sounds very complicated, and it is when you get into it further but we are only covering network basics remember!
As a general rule wherever there is a 255 in the subnet mask then the corresponding number of the IP address is part of the network id; where there is 0 in the subnet mask the corresponding number in the IP address is part of the host id. This is easier to explain with another example. Let’s say you have an IP address of 192.168.0.1 with a subnet mask of 255.0.0.0. This tells the computer that the first number (of the IP address, not the subnet mask) is to be used as the network address and the last 3 are to be used as the host id. In this example the computer network would be 192.x.x.x. As long as another computer has the same subnet mask and an IP address starting with 192 they can communicate with each other. If the subnet mask was 255.255.0.0 then this means that the first 2 numbers identify the network instead (192.168.x.x). Therefore to be on the same network both computers must have IP addresses starting with 192.168.
I explained above that computers on different network ids can’t communicate with each other. This isn’t necessarily true, I said this is to keep things simple to start with. Networking will work across different network IDs as long as there is a router between them. A router in its basic form is simply a network device with 2 network interfaces (NICs), each being on separate network ids. So, you may have 2 networks; 192.168.1.x and 192.168.2.x. On one NIC the router would have the IP address 192.168.1.1 and on the other it would have an IP address of 192.168.2.1. Computers on the 192.168.1.x network can now communicate with computers on the 192.168.2.x network via the router.
Learn more how routers work here.
Default Gateway Basics
The default gateway is where your computer sends traffic to if it doesn’t know where the destination IP address. The default gateway is always a router.
When a computer tries to communicate with another computer on the same network it sends the data directly to it. If it is on a separate network it forwards the data to whatever IP address is specified in the default gateway. This is because it doesn’t know of this other network and it needs to send the data to a gateway out of it’s own network . This is why you always put the IP address of the router in the default gateway field. Because a router will be attached to multiple networks it knows where these other networks are so it can route traffic to them. Routers also have default gateways so that if they don’t know where the destination is it also sends the data onto it’s own default gateway. This continues up the IP network hierarchy until it eventually finds a router that is part of the destination network. This last router knows where the destination is and sends it on it’s way. Hopefully this now makes a bit of sense as to why your home internet router is how you get internet access. You have your OWN network in your house but the internet is a different network. When you want to access that website half way around the world your computer has no idea how to get there so it first of all sends it onto the default gateway. Your home router is connected to your network and another network (the internet) so it sends it on it’s way to other routers on the internet until it gets to it’s destiniation. If you configure your default gateway incorrectly data can never leave your network so you lose your internet access.
As mentioned above computers need to be configured with an IP address, subnet mask and default gateway that will be unique to that network. You may wonder why you never had to do this on any computer, it just seem to work? It is because it is configured automatically when your computer boots up by a process known as DHCP.
DHCP stands for Dynamic Host Configuration Protocol. Servers and some routers can be configured to act as a DHCP server. Basically all it does it assign out out all the corect IP information to computers automatically so everything is configured to work on that network without user input.
We have only covered computer network basics here; TCP/IP is an advanced subject and it will take time to learn it all so stay tuned for more advanced articles. After reading this you may be interested in How NAT Works and How Routers Work.
If you are looking to make a career out of networking or just fascinated by how the Internet works I would seriously advise getting a copy of CCENT640-822 Official Cert Guide. This is the book that started my networking career and as the name suggests it is the official study material for Cisco’s CCENT exam aimed at beginners. Not only is it a great book but it will prepare you for the exam if you are thinking of taking it in the future