In this blog, we will learn about the computer networking basics, starting from the definition of a computer network. We’ll then look at the major elements that form a computer network, before finally the different devices that are used for creating an actual network.
We can define a computer network as a set of computers connected via a wired or wireless transmission media to exchange data, including files and resources. Every computer network can be divided into two parts, i.e., hardware and software components. The hardware includes personal computers, smartphones, and networking devices like routers, bridges, repeaters, etc. The software includes operating systems, servers, firewalls, etc.
Let’s have a quick overview of the basic elements of a computer network.
A node refers to a device that serves as a connecting point and also as a communication endpoint, such as a server, end user system, etc. These nodes help in data transmission between the network. Every node has a MAC address, and if it processes a layer 3 header (such as routers and end machines), it also has an IP address. However, we can assign easy-to-remember names to nodes along with their corresponding address. We’ll comment more on addressing and naming shortly. Some common examples of nodes are routers, repeaters, switches, bridges, servers, printers, end computers, etc.
A link is a wired or wireless communication link connecting two nodes. For example, we can connect our laptops to the internet using an Ethernet cable (LAN) or a wireless connection (Wi-Fi). It is to be noted that routers in the ISPs and intercontinental networks are usually connected using optical fiber links, the latter links being below sea level in some cases. A comparison of some of the commonly used communication links is given in the table below.
| Twisted Pair Cable | Coaxial Cable | Fiber Optic Cable | Bluetooth | Wi-Fi |
Bandwidth | 10 Mbps–100 Mbps | 10 Mbps | 100 Mbps–1Gbps | 2–3 Mbps | 11 Mpbs |
Distance Covered | 100 meters | 200–500 meters | 2 km–100 km | 10 m | 100 m |
Installation Cost | Cheap | Normal | Costly | Low | Costly |
It is commonly understood that two human beings need to have a common vocabulary (language) to communicate with each other. Similarly, we need some sort of rules that will define how two computers will send messages to each other so that they each understand the message. These rules in computer networks are referred to as protocols. These rules specify the messages exchanged, their sequence, and the structure of data and control information in these messages. The protocols may also specify application specific rules, such as those for error detection and recovery, message synchronization, and resource or entity lookup. Some examples of such protocols are HTTP, HTTPS, SMTP, FTP, etc.
The IP address refers to a unique 32-bit (IPv4) or 64-bit (IPv6) address that is assigned to every device in a network. These addresses can be fixed or random. In case it is fixed, then every time, that device will get the same IP address when it becomes part of a network. However, usually, these addresses are random/dynamic, and a device can be assigned a different address each time it becomes part of a network. A 32-bit IP address is, in fact, a sequence of 32 bits ranging from all 0s to all 1s. However, for better ease of use, we use the dotted decimal notation, which converts each byte (8-bit) to a decimal number ranging from 0 to 255. That makes a 32-bit IP address in the range of 0.0.0.0 to 255.255.255.255.
Another important aspect with respect to an IP address is subnetting, which is the process of splitting a network into two or more networks. Using subnetting, nodes that belong to the same subnet are addressed with an identical group of left bits (most significant bits). Organizations can decide to implement subnetting to make the network efficient. This is because the network traffic travels faster as unnecessary routers are avoided. There are two parts of an IP address, i.e., the network part and the host part. For subnetting, we borrow some bits from the host part and make it part of the subnet.
Suppose we have a large network with an IP address of 199.100.20.0, and we want to create two subnets. In this case, we have 24 bits for the network ID (first 3 octets) and the remaining 8 bits for hosts. For creating two subnets, we need 1 bit, so we borrow one bit from the host. Now, the IP address of the two subnets will be the following:
199.100.20.00000000 = 199.100.20.0
199.100.20.10000000 = 199.100.20.128
For subnet 1, we have a total of 126 hosts that can be configured. Their range is [199.100.20.00000000, 199.100.20.01111111] = [199.100.20.0, 199.100.20.127]. For subnet 2, again we have a total of 126 hosts that can be configured. Their range is [199.100.20.10000000, 199.100.20.11111111] = [199.100.20.128, 199.100.20.255].
A MAC address is a 12-character long string that is unique for each device, and it is usually assigned by the manufacturer. It is to be noted that this address is fixed and cannot be changed. It is sometimes also referred to as a device/physical address. For example, a0:78:17:a4:2a:ca
is the MAC address of my Wi-Fi.
Suppose a student is using his smartphone while roaming in a university. Due to the large size of the university, there are multiple networks deployed there. Each network has its geographical limit. At some points, these networks overlap each other, so when a user leaves the coverage of one network, they are automatically connected to another network. The smartphone of the student has basically two types of addresses i.e., a MAC address and an IP address. When they are connected to the internet, they are assigned an IP address using the DHCP server. Every message/data sent through his mobile has two types of addresses integrated into it, i.e., IP address and MAC address. Now suppose while roaming, the student leaves the coverage area of the network and enters the coverage area of the next network. In this case, the student's smartphone will be assigned a new IP address, and all the messages/data sent through his network will now have an updated IP address, but the MAC address will remain the same.
It is difficult for humans to remember IP addresses since they are just numbers and do not translate to anything. For this to be a workable system, a commonly used protocol is DNS. Using DNS, a server is assigned a human-readable name corresponding to its IP address. The client, a web browser, sends a hostname (for example, www.wikipedia.com)to it and it provides the translated IP address. This way, the client never has to remember the IP address.
A firewall is a software related to computer networking that monitors the incoming and outgoing traffic of a system. It prevents a system from external malicious attacks. These firewalls use a set of rules to filter the traffic. We can even define our rules e.g., incoming traffic can be blocked based on the IP address of the source machine or network, or type of application from which the traffic originates. Traffic such as video streaming may be blocked in offices so that workers focus on their work. Outgoing traffic may also be blocked e.g., companies would like to prevent private data going out on. Similarly companies can block certain social websites to be used in the office so that the employees would not waste time during office hours.
Computer networks are commonly divided into three broad categories, as explained below, based on their geographical coverage.
A computer network confined to the premises of a building/campus is referred to as a LAN. Some common examples are private networks established in schools, colleges, universities, hospitals, etc. LANs operate at a very fast speed, and there is a minimum propagation delay.
A computer network confined to the premises of a town/city is referred to as a MAN. It is larger than a LAN but smaller than a WAN. Mostly, telecom operators establish such networks. It operates at a moderate speed, and there is an acceptable propagation delay.
A computer network that connects cities or even countries is referred to as a WAN. It is usually used for long-distance communication and connects multiple LANs and MANs. It operates at a slow speed, and there is a large propagation delay.
Authoritative registries carefully record unique identifiers to maintain consistency and prevent overlaps among protocol users. The smooth functioning of the Internet depends on several distinct identifiers, such as the following:
Domain name: A domain name is like an address for a website. It's a simpler way to reach a website than remembering complex numbers. When you want to visit a website, you type its domain name into the browser. For example, to visit Google, you'd type in "google.com."
Hostname: The hostname is a unique identifier for devices in a network, often referred to as the computer or site name. It helps differentiate local networks and is a component of the fully qualified domain name. For example, ‘www in www.google.com is a hostname.
Internet Protocol (IP) address: An IP address is a number that helps identify devices on a network. Computers rely on IP addresses to interact with each other, whether on the internet or within private networks.
MAC Address: A MAC address, which stands for Media Access Control address, is a unique 12-digit hexadecimal identifier designated to every device connected to a network. Typically located on a device's Network Interface Card (NIC), it is essential for finding devices and conducting network diagnostics.
Port number: A port number serves as an identifier for a specific process, guiding internet or network messages to their intended destination when they reach a server.
Socket: A socket represents one end of a bidirectional communication channel between two programs on a network. It facilitates inter-process communication (IPC) by creating designated contact points through which the communication occurs.
Improved communication and access to information
Efficient resource sharing
Simplified file and data exchange
High versatility
Enhanced cost efficiency
Augmented storage capabilities
Reduced device autonomy
All computer networks can be classified into two categories, as explained below.
This is the most commonly used network architecture in which one of the nodes requests some data and is referred to as a client. The node responsible for the provision of data is referred to as a server. For example, when we use our browser and type www.wikipedia.com, our system acts as a client, and the Wikipedia server acts as a server.
In this type of computer network, every node acts as a client and a server. It means that sometimes a node requests data from other nodes, and sometimes it provides data to the other nodes. There is no concept of a dedicated data provider like a server. A common example of such a network is torrenting, which is commonly used to share data, such as movies and software, between different users. This P2P approach is also used in blockchain technology.
In order to transfer data among two nodes in a network, we need the help of a network device. A network device can be any equipment that helps in the smooth functioning and establishment of a network. Let’s look at an overview of the most commonly used network devices.
A router, as the name implies, is used to route data in a computer network. A router usually has multiple available routes for the data to be forwarded, and the routing protocols are responsible for determining the best path. The routing algorithm's goal may be to minimize the total cost incurred by the service provider or to find a path that has a high bandwidth or low latency. For example, for real-time traffic such as video conferencing or online gaming, the algorithm would avoid a path having a satellite link because these have a very high propagation delay. A data packet may have to traverse several routers to reach its destination.
A switch is a networking device that connects multiple devices on a network. The main difference between it and a router is that a router transmits data between networks, while a switch transfers data between nodes of a single network.
Each communication medium has an effective range beyond which the signal gets so weak that it can’t be understood. A repeater extends the range by reconstructing the original signal from a weak (but still readable) signal and transmitting it. They are generally used to extend the coverage area of some other network device.
A network bridge is a network device that is used to create a single network from multiple networks. In contrast to a router that allows multiple networks to communicate, they still work as a separate network. A bridge, after combining multiple networks, results in a single network.
In computer networks, we refer to how nodes are arranged in a network as a topology. There are many possible ways to arrange nodes in a network, leading to different types of network topologies. Let’s have a brief look.
A network topology describes the physical and logical layout of nodes and their interconnections. Typically, nodes include devices like switches and routers, as well as software that embodies switch and router functionalities.
In the bus topology, we have a single transmission medium to which all the nodes are connected. In this arrangement, if multiple nodes start sending data at the same time, then the data might get corrupted. Therefore, we need to allocate slots to each node. It is the simplest form of topology, but there is a single point of failure. If there is an issue in the main transmission medium, then the complete network malfunctions.
In the star topology, all the nodes are connected via a single central hub. All the nodes send their data to this central device which then forwards them to the destination node. It is to be noted that the hub can be a switch/repeater/router depending on the network requirement. As with the bus topology, it too has a single point of failure, i.e., if the central hub fails, then the complete network malfunctions.
In the ring topology, a node is connected to other nodes in a way that forms a circular shape. If a node wants to send data to another node with whom it is not directly connected, then all the nodes in between them need to forward that data. This topology, too, has a single point of failure; if one of the nodes fails, data will not pass through the network.
In the mesh topology, a node is connected to every other node in the network. Because of these excessive connections, this topology does not have a single point of failure. If one of the nodes or connections fails, then the rest of the network can function normally.
The table below provides an overview of the pros and cons of these network topologies.
Topology Name | Pros | Cons |
Bus Topology |
|
|
Star Topology |
|
|
Ring Topology |
|
|
Mesh Topology |
|
|
To deepen your understanding about computer networking basics, take a look through this selection of specialized courses on the Educative platform.
Grokking Computer Networking for Software Engineers
Don't pass up this chance to increase your knowledge and expertise about computer networking. Take the first step toward becoming an expert in the field of computer networking by enrolling in Educative courses right away!
Free Resources