Computer Networks

Computer Networks

We all use the Internet, don't we? But how does the Internet work in reality? Do you want to learn more about the internet and networking? This blog will teach us about network fundamentals and much more. So, let's get this party started!

Network

A network is formed when two or more computers and computing equipment communicate with one another via communication channels such as cables or wireless media and share files.

A network is employed to:

  • Allow the devices to communicate with one another.

  • Allow numerous users to share network devices such as music and video servers, printers, and scanners.

The Internet is the world's largest network and has been dubbed "the network of networks."

Types of Networks

The types and sizes of networks differ. While the Internet is a global network with billions of users, a home computer network may include two or more PCs that share files and a printer.

There are three types of Networks:

  1. LAN (Local Area Network): A LAN is a local network that covers a small geographic region, such as a home or office. Wi-Fi and Ethernet technologies are the foundations of most LANs. Local Area Networks are utilized in schools, banks, laboratories, and university campuses. It is less expensive since it is constructed with low-cost hardware such as hubs, network adapters, and ethernet cables.

  2. MAN (Metropolitan Area Network): A metro area network (MAN) connects two or more Geographical Region networks within a Town, City, or Metropolitan area. Metropolitan Area networks include ATM networks in your city and networked offices of a company in your city. Its range is greater than that of the Local Area Network (LAN).

  3. WAN (Wide Area Network): A WAN spans a broad geographical area, spanning countries or even continents, and relies on transmission services supplied by telephone companies and ISPs (Internet Service Providers). WAN examples include banks and e-banking, networked offices of multinational corporations, and the Internet.

Network Components

  1. Switch: Several linked devices in a local area network can communicate with one another using a tiny device called a Network Switch. Many years before home broadband routers were widely deployed, standalone Ethernet switch devices were often employed on home networks. One of the primary tasks of contemporary home routers is the direct integration of Ethernet switches inside the device. Corporate networks and data centers continue to make use of high-performance network switches extensively. Network switches may also be referred to as MAC bridges, switching hubs, or bridging hubs.

Managed and Unmanaged Switches

Beyond connecting cables and electricity, basic network switches, such as those found in consumer routers, require no extra settings. High-end devices used on business networks, as opposed to these unmanaged switches, include a variety of additional capabilities meant to be operated by a professional administrator. SNMP monitoring, link aggregation, and QoS support are all popular features of controlled switches. Managed switches are often designed to be controlled using Unix-style command line interfaces. Smart switches, a newer kind of managed switches aimed at entry-level and midrange business networks, feature web-based interfaces comparable to a home router.

  1. Router: The router, or at least the typical home network device known as a router, is a piece of network gear that permits communication between your local home network (such as your PCs and other connected devices) and the internet. The router used in home and small network networks is more appropriately known as a residential gateway, although you'll never hear these devices referred to as such.
  1. Modem: A modem is a device that plugs into your wall and brings the internet into your home. Most modems today use coaxial cables, the cylindrical cords that screw into the wall. You may be able to access the internet by connecting your computer with an Ethernet cable; however, if you want to set up a Wi-Fi network and link multiple devices to the web wirelessly, you'll also need a router. When we receive any sort of signal, it is delivered to your device in the form of an analog signal, but your computer only understands digital signals (0 and 1). As a result, we are unable to transfer analog signals directly to the system. So, in this case, a modem is employed to convert your analog impulses to digital signals and vice versa. As a result, your ISP disabled the modem capabilities of your ADSL.

  2. Hub: A hub is a small, rectangular, inexpensive device that joins multiple network-enabled devices. They're often made of plastic and receive power from an ordinary wall outlet. The purpose of a hub is to form a single network segment on which all devices can communicate directly with each other. Until the early 2000s, Ethernet hubs were widely used for home networking due to their simplicity and low cost. While broadband routers have replaced them in homes, hubs still serve a useful purpose.

  3. NIC: It is known as Network Interface Card which is used to connect your computer to the internet. It is a wireless card preinstalled on the motherboard nowadays. It has a MAC(Media Access Control) address.

  4. Bridge: It is also a networking device that connects multiple LANs (local area networks) to form a larger LAN. It reduces the broadcasting part and stores the MAC address of the computer but now this device is also obsoleted and replaced by a switch.

Protocol

A network protocol is a set of rules which is set up by people that determine how particular data is transmitted between different devices in the same network. e.g:- HTTP, TCP, IP, FTP, SMTP etc.

IP Address

Every device on the internet must have at least one unique network address identifier known as the IP (Internet Protocol) address. This address is essential for routing packets of information through the network. Without our address, none can find our location and like that without an IP address, a device can't be found on a network.

There are two types of IP addresses - IPv4 and IPv6.

  • IPv4 This is a 32-bit IP address, which means it contains a combo of 32 (1 and 0's). In this version of the IP address, there are 4 groups of Octets(8 bits), and each octet is represented by a decimal value in the address. It is easy to remember.

  • IPv6 This IP address contains 128 bits. We use IPv6 because we have a shortage of IPv4, almost all IPv4 is used now and this is the reason IPv6 is commonly seen nowadays. This address is represented by a hexadecimal value.

Topologies

A network topology is the structure or organization of a network that connects computer systems or network devices. Topologies can specify both the physical and conceptual aspects of a network. In the same network, logical and physical topologies may be the same or distinct.

There are different types of Topology -

  • Bus Topology: In this topology, all devices share a single communication line or cable. For this topology, the main problem is for any cause if that cable breaks then the whole network will break down.

  • Ring Topology: In a ring topology, each host machine connects to two other machines, creating a circular network structure. For any cause, if any host breaks down then the whole network will break down. Thus, every connection in the ring is a point of failure.

  • Star Topology: In Star topology, all hosts are connected to a central device, known as a hub device, using a point-to-point connection. That is, there exists a point-to-point connection between the hosts and the hub. If the Hub fails for any cause, then the whole network will be broken.

  • Tree Topology: This topology is the combination of Bus and Star Topology. In this topology, each Star topology is connected via a single communication line or cable. This is the most common form of network topology in use presently. The main problem in this topology is if that single cable breaks then the whole network will break down.

  • Mesh Topology: In this topology, each host is interconnected with the other through various redundant connections. It does not contain the switch, hub, or any central computer which acts as a central point. The Internet is the main example of Mesh Topology. But the main issue with this network is this topology, networks are very large and very difficult to maintain and manage. If the network is not monitored carefully, then the communication link failure goes undetected.

Network Models

There are mainly two types of network models -

  1. OSI Reference Model

  2. TCP/IP Model

OSI Model

The OSI model (or Open Systems Interconnection Model) is an ISO (International Organization for Standardization) reference model that describes how various types of systems communicate with one another. The OSI model is comprised of seven distinct levels, each with its distinct function and duties. This is a fictitious model.

  1. Application Layer Any software which interacts directly with one human to another comes under the Application Layer. e.g:- WhatsApp, Gmail, Web browser, etc. Different types of protocols given below are used in the Application Layer.

    • HTTP (Hypertext Transfer Protocol) It is a client-server stateless (means it never stores any data of the client)protocol, and it tells us how it requests any data from the server and also tells us how the server will send the data back to the client.

      -- When a client makes a request - HTTP request

      -- When a server sends a response to a client - HTTP response

      HTTP Methods GET: Get some data from a server. POST: Post some form/data to a server. PUT: Put some data. DELETE: Delete some data on a server.

**Status Codes** 1XX - Informational 2XX - Success! 3XX - Redirecting 4XX - Client Error 5XX - Server Error

HTTP is a stateless protocol, which implies that it never stores any client data on the server. If you search amazon.com for the second time, it should be logged out of the server and you should have to log in again for the second visit, but you don't. It immediately logs you in the second time, and you can view all of your stored carts and data. So, how is it possible? **Cookies** enter the picture here.

Cookies are unique strings that are saved as files in your browser. When you search for the same website for the second time, the cookies saved in your browser will send the details through HTTP to the server, which will check it and automatically log you in.

**SMTP/POP (Simple Mail Transfer Protocol and Post Office Protocol)** SMTP is used in sending and receiving any email from the senders' SMTP server to Receiver's SMTP server. POP is used to download any email from the POP server

**FTP (File Transfer Protocol)** FTP is used to download, upload and transfer files from one host to another host.
  1. Presentation Layer This layer truly describes the Data Format (remember this). That is, when you visit a website such as Google.com or YouTube.com, you may view many videos, photos, thumbnails of videos, comments, and so on. As a result, the presentation layer aids in the representation of data in any format.

  2. Session Layer When data is sent to the Session Layer, the Session Layer creates and maintains sessions based on the time. Every bank website has a time limit when you open it. If you leave your keyboard for an extended period, the session will automatically log out. If you do not use your keyboard or mouse cursor, the session will be immediately terminated using a session layer algorithm designed by the creators. The Session Layer is in charge of this.

  3. Transport Layer This layer converts the data into little segments, which means that it separates the data into many portions or sections. This layer is also in charge of segment sequencing, which means it will append the serial number to each data segment. Because there is a potential that one part/segment of data will be lost when traveling from one PC to another across the internet. So, when the data is sent from Host-A to Host-B, B will verify OK! I received parts 1, 3, 4, and 5, but not the no. 2 section. Then B will ask A to re-transmit the second part once more. This layer employs a checksum and does congestion control. This layer is also in charge of re-transmission.

    TCP and UDP are used in this layer.

    • TCP (Transmission Control Protocol) If any data segments are transmitted from Host A to Host B using this protocol, the destination (Host B) will send back a receipt/acknowledgment to the sender (Host A). That is, anytime we send data through TCP, it handles acknowledgment. As a result, this protocol is dependable and automatically retransmits data segments if any are lost. This protocol is connection focused in network jargon because it believes in making end-to-end connections. Each segment requires 20 bytes to add TCP information. This data includes port numbers. Port numbers are used to identify the application you wish to transfer data. HTTP - port 80, MongoDB - port 27017, SQL - port 1433, and so on.

    • UDP(User Datagram Protocol) This protocol is connection-less, which means it does not establish a connection with the receiver to determine whether all data segments have been successfully sent to the receiver. As a result, it is untrustworthy because it does not ensure any recognition. This protocol does not allow for re-transmission. Each segment requires 8 bytes to add UDP information. These 8 bytes, like TCP, include the port number.

  4. Network Layer Each data segment is transformed into Packets in this layer. This layer adds the source IP address (sip) and destination IP address (dip) to each packet. Packets are the abstraction (layer) of Segments. A router is used in this layer to link one host to another (different network).

  5. Data-Link Layer Each packet is turned into a Frame at this layer. This layer adds the source MAC address and the destination MAC address (physical address of the device) to each packet. A frame is a Packet abstraction (layer) that contains both MAC addresses. The switch operates in this layer to determine which device should get data from the Switch.

  6. Physical Layer Encoding is the process of converting data into digital signals (0 and 1) in this layer. The signal will then be sent to another device via cable (receiver). These seven operations will now occur in the receiving device.

TCP/IP Model

This model is a real model which works in real. This model consists of 4 layers.

  1. Application Layer = (Application Layer + Presentation Layer + Session Layer) of OSI model

  2. Transport Layer

  3. Network Layer

  4. Network Interface Layer = (Data Link Layer + Physical Layer) of OSI model (remaining all are same like OSI model discussed above.)

DNS (Domain Name System)

The Domain Name System (DNS) converts human-readable domain names (such as amazon.com) to machine-readable IP addresses (for example, 192.0.1.24). It's like an Internet phone directory. Each Internet-connected device has a unique IP address, which other machines use to locate the device. DNS servers reduce the requirement for humans to remember IP addresses like 192.168.1.1 (in IPv4) or more complicated modern alphanumeric IP addresses like 2400:cb00:2048:1::c629:d7a2 (in IPv6). The Root DNS Server holds all top-level domains, such as.io,.com ,.org, and so on.

Subnet Mask

Subnet Mask represents the network bits. The computer needs extra information that the computer belongs to which network. A subnet mask is represented by / value. /8 = 255.0.0.0 means it represents 8 bits of an IP address and if you add all 8 bits like (2^7+2^6+2^5+2^4+2^3+2^2+2^1+2^0 = 255). Each octet can vary from 0-255.

The IP address is not immediately understood by the computer. Because the subnet works with bits, the computer may grasp the IP address using the subnet mask. We now know that just the first octet of a class A IP address will be checked for Network ID, as will the first two octets of a class B IP address, and the first three octets of a class C IP address. e.g: As This IP address 123.34.0.1/8 belongs to class A, therefore a computer may detect it by its subnet mask 255.0.0.0.

DEFAULT SUBNET MASK

Class A - 255.0.0.0 as it checks for the first octet or 8 bits

Class B - 255.255.0.0 as it checks for the first two octets or 16 bits

Class C - 255.255.255.0 as it checks for the first three octets or 24 bits