Sie sind auf Seite 1von 48

next →← prev

What is a Router?
The router is a physical or virtual internetworking device that is designed to receive, analyze, and forward data packets between
computer networks. A router examines a destination IP address of a given data packet, and it uses the headers and forwarding
tables to decide the best way to transfer the packets. There are some popular companies that develop routers; such
are Cisco, 3Com, HP, Juniper, D-Link, Nortel, etc. Some important points of routers are given below:

o A router is used in LAN (Local Area Network) and WAN (Wide Area Network) environments. For example, it is used
in offices for connectivity, and you can also establish the connection between distant networks such as from Bhopal to
o It shares information with other routers in networking.
o It uses the routing protocol to transfer the data across a network.
o Furthermore, it is more expensive than other networking devices like switches and hubs.
A router works on the third layer of the OSI model, and it is based on the IP address of a computer. It uses protocols such as
ICMP to communicate between two or more networks. It is also known as an intelligent device as it can calculate the best route
to pass the network packets from source to the destination automatically.

A virtual router is a software function or software-based framework that performs the same functions as a physical router. It may
be used to increase the reliability of the network by virtual router redundancy protocol, which is done by configuring a virtual
router as a default gateway. A virtual router runs on commodity servers, and it is packaged with alone or other network functions,
like load balancing, firewall packet filtering, and wide area network optimization capabilities.

Why Routers?

A router is more capable as compared to other network devices, such as a hub, switch, etc., as these devices are only able to
execute the basic functions of the network. For example, a hub is a basic networking device that is mainly used to forward the
data between connected devices, but it cannot analyze or change anything with the transferring data. On the other hand, the
router has the capability to analyze and modify the data while transferring it over a network, and it can send it to another
network. For example, generally, routers allow sharing a single network connection between multiple devices.

How does Router work?

A router analyzes a destination IP address of a given packet header and compares it with the routing table to decide the packet's
next path. The list of routing tables provides directions to transfer the data to a particular network destination. They have a set of
rules that compute the best path to forward the data to the given IP address.

Routers use a modem such as a cable, fiber, or DSL modem to allow communication between other devices and the internet. Most
of the routers have several ports to connect different devices to the internet at the same time. It uses the routing tables to
determine where to send data and from where the traffic is coming.

A routing table mainly defines the default path used by the router. So, it may fail to find the best way to forward the data for a
given packet. For example, the office router along a single default path instructs all networks to its internet services provider.

There are two types of tables in the router that are static and dynamic. The static routing tables are configured manually, and
the dynamic routing tables are updated automatically by dynamic routers based on network activity.

Features of Router
o A router works on the 3rd layer (Network Layer) of the OSI model, and it is able to communicate with its adjacent devices
with the help of IP addresses and subnet.
o A router provides high-speed internet connectivity with the different types of ports like gigabit, fast-Ethernet, and STM link
port.
o It allows the users to configure the port as per their requirements in the network.
o Routers' main components are central processing unit (CPU), flash memory, RAM, Non-Volatile RAM, console, network, and
interface card.
o Routers are capable of routing the traffic in a large networking system by considering the sub-network as an intact
network.
o Routers filter out the unwanted interference, as well as carry out the data encapsulation and decapsulation process.
o Routers provide the redundancy as it always works in master and slave mode.
o It allows the users to connect several LAN and WAN.
o Furthermore, a router creates various paths to forward the data.

Applications of Routers

There are various areas where a router is used:

o Routers are used to connect hardware equipment with remote location networks like BSC, MGW, IN, SGSN, and other
servers.
o It provides support for a fast rate of data transmission because it uses high STM links for connectivity; that's why it is used
in both wired or wireless communication.
o Internet service providers widely use routers to send the data from source to destination in the form of e-mail, a web page,
image, voice, or a video file. Furthermore, it can send data all over the world with the help of an IP address of the
destination.
o Routers offer access restrictions. It can be configured in a way that allows for few users to access the overall data and
allows others to access the few data only, which is defined for them.
o Routers are also used by software testers for WAN communications. For example, the software manager of an organization
is located in Agra, and its executive is located at a different place like Pune or Bangalore. Then the router provides the
executive the method to share his software tools and other applications with the manager with the help of routers by
connecting their PCs to the router using WAN architecture.
o In wireless networks, by configuring VPN in routers, it can be used in the client-server model, which allows sharing the
internet, video, data, voice, and hardware resources. As shown in the below picture:
o In modern times, routers have the facility of inbuilt USB ports within the hardware. They have enough internal storage
capacity. External storage devices can be used with routers to store and share data.
o Routers are used to set up the operation and maintenance center of an organization, which is known as the NOC center. All
equipment at a distant location are connected by routers on optical cable at a central location, which also offer redundancy
through the main link and protection link topology.

Types of Routers

There are various types of routers in networking; such are given below:

1. Wireless Router: Wireless routers are used to offer Wi-Fi connectivity to laptops, smartphones, and other devices with Wi-Fi
network capabilities, and it can also provide standard ethernet routing for a small number of wired network systems.

Wireless routers are capable of generating a wireless signal in your home or office, and it allows the computers to connect with
routers within a range, and use the internet. If the connection is indoors, the range of the wireless router is about 150 feet, and
when the connection is outdoors, then its range is up to 300 feet.

Furthermore, you can make more secure wireless routers with a password or get your IP address. Thereafter, you can log in to
your router by using a user ID and password that will come with your router.

2. Brouter: A brouter is a combination of the bridge and a router. It allows transferring the data between networks like a bridge.
And like a router, it can also route the data within a network to the individual systems. Thus, it combines these two functions of
bridge and router by routing some incoming data to the correct systems while transferring the other data to another network.

3. Core router: A core router is a type of router that can route the data within a network, but it is not able to route the data
between the networks. It is a computer communication system device and the backbone of networks, as it helps to link all network
devices. It is used by internet service providers (ISPs), and it also provides various types of fast and powerful data communication
interfaces.

4. Edge router: An edge router is a lower-capacity device that is placed at the boundary of a network. It allows an internal
network to connect with the external networks. It is also called as an access router. It uses an External BGP (Border Gateway
Protocol) to provides connectivity with remote networks over the internet.

There are two types of edge routers in networking:

o Subscriber edge router


o Label edge router
The subscriber edge router belongs to an end-user organization, and it works in a situation where it acts on a border device.

The label edge router is used in the boundary of Multiprotocol Label Switching (MPLS) networks. It acts as a gateway between
the LAN, WAN, or the internet.

5. Broadband routers: Broadband routers are mainly used to provide high-speed internet access to computers. It is needed
when you connect to the internet through phone and use voice over IP technology (VOIP).

All broadband routers have the option of three or four Ethernet ports for connecting the laptop and desktop systems. A broadband
router is configured and provided by the internet service provider (ISP). It is also known as a broadband modem, asymmetric
digital subscriber line (ADSL), or digital subscriber line (DSL) modem.

Benefits of Router

There are so many benefits of a router, which are given below:

o Security: Router provides the security, as LANs work in broadcast mode. The information is transmitted over the network
and traverses the entire cable system. Although the data is available to each station, but the station which is specifically
addressed reads the data.
o Performance enhancement: It enhances the performance within the individual network. For example, if a network has
14 workstations, and all generate approximately the same volume of traffic. The traffic of 14 workstations runs through the
same cable in a single network. But if the network is divided into two sub-networks each with 7 workstations, then a load of
traffic is reduced to half. As each of the networks has its own servers and hard disk, so fewer PCs will need the network
cabling system.
o Reliability: Routers provide reliability. If one network gets down when the server has stopped, or there is a defect in the
cable, then the router services, and other networks will not be affected. The routers separate the affected network,
whereas the unaffected networks remain connected, without interrupting the work and any data loss.
o Networking Range: In networking, a cable is used to connect the devices, but its length cannot exceed 1000 meters. A
router can overcome this limitation by performing the function of a repeater (Regenerating the signals). The physical range
can be as per the requirement of a particular installation, as long as a router is installed before the maximum cable range
exceeds.

Routing Protocols

Routing protocols specify a way for the router to identify other routers on the network and make dynamic decisions to send all
network messages. There are several protocols, which are given below:

Open Shortest Path First (OSPF): It is used to calculate the best route for the given packets to reach the destination, as they
move via a set of connected networks. It is identified by the Internet Engineering Task Force (IETF) as Interior Gateway Protocol.

Border Gateway Protocol (BGP): It helps manage how packets are routed on the internet via exchange of information between
edge routers. It provides network stability for routers if one internet connection goes down while forwarding the packets, it can
adapt another network connection quickly to send the packets.

Interior Gateway Routing Protocol (IGRP): It specifies how routing information will be exchanged between gateways within
an independent network. Then, the other network protocols can use the routing information to determine how transmissions
should be routed.

Enhanced Interior Gateway Routing Protocol (EIGRP): In this protocol, if a router is unable to find a path to a destination
from the tables, it asks route to its neighbors, and they pass the query to their neighbors until a router has found the path. When
the entry of routing table changes in one of the routers, it informs its neighbors only about the changes, but do not send the entire
table.

Exterior Gateway Protocol (EGP): It decides how routing information can be exchanged between two neighbor gateway hosts,
each of which has its own router. Additionally, it is commonly used to exchange routing table information between hosts on the
internet.

Routing Information Protocol (RIP): It determines how routers can share information while transferring traffic among
connected group of local area networks. The maximum number of hops that can be allowed for RIP is 15, which restricts the size
of networks that RIP can support.

Difference between Bridge and Router

Bridge Router

A bridge is a networking device that is used to connect two local A router is also a networking device that sends the
area networks (LANs) by using media access control addresses and data from one network to another network with the
transmit the data between them. help of their IP addresses.

A bridge is able to connect only two different LAN segments. A router is capable of connecting the LAN and WAN.

A bridge transfers the data in the form of frames. A router transfers the data in the form of packets.

It sends data based on the MAC address of a device. It sends data based on the IP address of a device.

The bridge has only one port to connect the device. The router has several ports to connect the devices.

The bridge does not use any table to forward the data. The router uses a routing table to send the data.

Difference between Hub, Switch, and Router

There are three primarily networking devices that connect the computers from one to another. These devices are hub, switch, and
router. These all have the ability to connect one computer to another, but there is some difference between them. The difference
between a hub, switch, and router are given below:

Hub: A hub is a basic networking device that is used to connect computers or other networking devices together. A hub does not
use any routing table to send the data to the destination. Although it can identify basic errors of networks like collisions, it can be
a security risk to broadcast all information to the multiple ports. As the hub is a dumb device, it does not need an IP address.
Furthermore, Hubs are cheaper than a switch or router.

Switch: A switch is a hardware device that also connects computers to each other. A switch is different as compared to a hub in
that way; it handles packets of data. Whenever a switch receives a packet, it decides the device to which the packet can be sent,
and sends it to that device only. A hub broadcasts the packet to all computers, but the switch does not circulate the packet to all
devices, which means bandwidth is not shared with the network, and thus it increases the efficiency of the network. That's why
switches are more preferred as compared to a hub.

Router: A router is more different from a switch or hub. It is mainly used to route the data packets to another network instead of
transmitting the data to the local networks only. A router is commonly found in homes and offices as it allows your network to
communicate with other networks through the internet. Basically, a router provides more features to your networks like firewall,
VPN, QoS, traffic monitoring, etc.

What is Routing Table in Router?

A routing table determines the path for a given packet with the help of an IP address of a device and necessary information from
the table and sends the packet to the destination network. The routers have the internal memory that is known as Random Access
Memory (RAM). All the information of the routing table is stored in RAM of routers.

For example:
Destination (Network ID) Subnet mask Interface

200.1.2.0 255.255.255.0 Eth0

200.1.2.64 255.255.255.128 Eth1

200.1.2.128 255.255.255.255 Eth2

Default Eth3

A routing table contains the following entities:

o It contains an IP address of all routers which are required to decide the way to reach the destination network.
o It includes extrovert interface information.
o Furthermore, it is also contained IP addresses and subnet mask of the destination host.

Network Element in Router

There are two types of a network element in the router which are as follows:

Control plane: A router supports a routing table that determines which path and physical interface connection should be used to
send the packet. It is done by using internal pre-configured directives, which are called static routes, or by learning routes with
the help of routing protocol. A routing table stores the static and dynamic routes. Then the control-plane logic eliminates the
unnecessary directives from the table and constructs a forwarding information base that is used by the forwarding plane.

Forwarding plane: A router sends data packets between incoming and outgoing interface connections. It uses information stored
in the packet header and matches it to entries in the FIB, which is supplied by the control plane; accordingly, it forwards the data
packet to the correct network type. It is also called the user plane or data plane.
How to buy a Router?

There are many points to keep in mind while buying a router:

1. Type of Connection: Which kind of router should you buy depends on the type of connection you have. For example, if
you want to use the internet connection from your telephone services providers like BSNL or MTNL, you will need an ADSL
router. In this router, you have to use the hardware that is provided to you with your connection. Although this router may
have limited functionalities on some fronts.
Alternatively, you can purchase an advanced router that allows you sharing storage, including printer over a wireless
connection. If you use the connection provided by the local cable operator, you will need a non-ADSL router.
2. Standard: The routers support standards like 802.11ac, 802.11n, etc. The routers that support 802.11ac standard,
enhances the speed to transfer the data more than three times the speed of 802.11n standard routers. It uses the 5GHz
frequency band, which is less crowded as compared to the regular 2.4GHz band. Furthermore, it also provides better
network performance for file transfers and streaming media content.
The routers that support 802.11ac standard are beneficial as they are compatible with 'n' standard, by which your older
devices can also work without any problem.Alternatively; you can save some money and full fill your requirements by
purchasing 'n' standard routers.
3. Dual-band: Most of 'n' standard routers operate in the 2.4GHz frequency, but a dual-band router is better as it supports
the 5GHz band. Furthermore, it can also connect with smartphones and laptops on 5GHz, while other routers can operate
over 2.4GHz only.
4. USB port: Routers with USB ports allow you to plug flash drives, including printers, to share these resources over the
network. These functions are suitable for a small area as they can be used within the wireless network without using the
internet.
Some routers provide backup internet by 3G data dongles when your main connection goes down. But these routers work
with specific brands only. So, before purchasing a router, check if it supports the dongle you are using.
5. Multiple antennas: External antennas are strong enough to increase the overall range of your router as well as are
suitable for environments where you need signals across multiple walls or doors.
OSI vs TCP/IP
What is OSI model?
The OSI stands for Open System Interconnection, which was developed in 1980s. It is a conceptual model used for network
communication. It is not implemented entirely, but it is still referenced today. This OSI model consists of seven layers, and
each layer is connected to each other. The data moves down the OSI model, and each layer adds additional information. The
data moves down until it reaches the last layer of the OSI model. When the data is received at the last layer of the OSI model,
then the data is transmitted over the network. Once the data is reached on the other side, then the process will get reversed.
What is TCP/IP model?
The TCP model stands for Transmission Control Protocol, whereas IP stands for Internet Protocol. A number of protocols
that make the internet possibly comes under the TCP/IP model. Nowadays, we do not hear the name of the TCP/IP model
much, we generally hear the name of the IPv4 or IPv6, but it is still valid. This model consists of 4 layers. Now, we will look at
the diagrammatic representation of the TCP/IP model.

As shown in the above diagram, the TCP/IP model has 4 layers, while the OSI model consists of 7 layers. Diagrammatically, it
looks that the 4 layers of the TCP/IP model exactly fit the 7 layers of the OSI model, but this is not reality. The application layer
of the TCP/IP model maps to the first three layers, i.e., application, session, and presentation layer of the OSI model. The
transport layer of the TCP maps directly to the transport layer of the OSI model. The internet layer of the TCP/IP model maps
directly to the network layer of the OSI model. The last two layers of the OSI model map to the network layer of the TCP/IP
model. TCP/IP is the most widely used model as compared to the OSI model for providing communication between computers
over the internet.

Similarities between the OSI and TCP/IP model


The following are the similarities between the OSI and TCP/IP model:

o Share common architecture

Both the models are the logical models and having similar architectures as both the models are constructed with the layers.

o Define standards

Both the layers have defined standards, and they also provide the framework used for implementing the standards and devices.

o Simplified troubleshooting process

Both models have simplified the troubleshooting process by breaking the complex function into simpler components.

o Pre-defined standards

The standards and protocols which are already pre-defined; these models do not redefine them; they just reference or use
them. For example, the Ethernet standards were already defined by the IEEE before the development of these models; instead
of recreating them, models have used these pre-defined standards.

o Both have similar functionality of 'transport' and 'network' layers

The function which is performed between the 'presentation' and the 'network' layer is similar to the function performed at
the transport layer.

Differences between the OSI and TCP/IP model


Let's see the differences between the OSI and TCP/IP model in a tabular form:

OSI Model TCP/IP Model

It stands for Open System Interconnection. It stands for Transmission Control Protocol.

OSI model has been developed by ISO (International Standard It was developed by ARPANET (Advanced Research
Organization). Project Agency Network).

It is an independent standard and generic protocol used as a It consists of standard protocols that lead to the
communication gateway between the network and the end user. development of an internet. It is a communication
protocol that provides the connection among the hosts.

In the OSI model, the transport layer provides a guarantee for The transport layer does not provide the surety for the
the delivery of the packets. delivery of packets. But still, we can say that it is a
reliable model.
This model is based on a vertical approach. This model is based on a horizontal approach.

In this model, the session and presentation layers are separated, In this model, the session and presentation layer are not
i.e., both the layers are different. different layers. Both layers are included in the
application layer.

It is also known as a reference model through which various It is an implemented model of an OSI model.
networks are built. For example, the TCP/IP model is built from
the OSI model. It is also referred to as a guidance tool.

In this model, the network layer provides both connection- The network layer provides only connectionless service.
oriented and connectionless service.

Protocols in the OSI model are hidden and can be easily replaced In this model, the protocol cannot be easily replaced.
when the technology changes.

It consists of 7 layers. It consists of 4 layers.

OSI model defines the services, protocols, and interfaces as well In the TCP/IP model, services, protocols, and interfaces
as provides a proper distinction between them. It is protocol are not properly separated. It is protocol dependent.
independent.

The usage of this model is very low. This model is highly used.

It provides standardization to the devices like router, It does not provide the standardization to the devices. It
motherboard, switches, and other hardware devices. provides a connection between various computers.
TCP vs UDP
What is the TCP?
The TCP stands for Transmission Control Protocol. If we want the communication between two computers and
communication should be good and reliable. For example, we want to view a web page, then we expect that nothing should be
missing on the page, or we want to download a file, then we require a complete file, i.e., nothing should be missing either it
could be a text or an image. This can only be possible due to the TCP. It is one of the most widely used protocols over
the TCP/IP network.

Features of TCP
The following are the features of the TCP:

o Data delivery
TCP protocol ensures that the data is received correctly, no data is missing and in order. If TCP protocol is not used,
then the incorrect data can be received or out of order. For example, if we try to view the web page or download a file
without using TCP, then some data or images could be missing.
o Protocol
TCP is a connection-oriented protocol. Through the word connection-oriented, we understand that the computers first
establish a connection and then do the communication. This is done by using a three-way handshake. In a three-way
handshake, the first sender sends the SYN message to the receiver then the receiver sends back the SYN ACK message
to confirm that the message has been received. After receiving the SYN ACK message, the sender sends the
acknowledgment message to the receiver. In this way, the connection is established between the computers. Once the
connection is established, the data will be delivered. This protocol guarantees the data delivery means that if the data is
not received then the TCP will resend the data.
What is UDP?
The UDP stands for User Datagram Protocol. Its working is similar to the TCP as it is also used for sending and receiving the
message. The main difference is that UDP is a connectionless protocol. Here, connectionless means that no connection
establishes prior to communication. It also does not guarantee the delivery of data packets. It does not even care whether the
data has been received on the receiver's end or not, so it is also known as the "fire-and-forget" protocol. It is also known as
the "fire-and-forget" protocol as it sends the data and does not care whether the data is received or not. UDP is faster than
TCP as it does not provide the assurance for the delivery of the packets.

Differences between the TCP and UDP


o Type of protocol
Both the protocols, i.e., TCP and UDP, are the transport layer protocol. TCP is a connection-oriented protocol, whereas
UDP is a connectionless protocol. It means that TCP requires connection prior to the communication, but the UDP does
not require any connection.
o Reliability
TCP is a reliable protocol as it provides assurance for the delivery of the data. It follows the acknowledgment
mechanism. In this mechanism, the sender receives the acknowledgment from the receiver and checks whether the
acknowledgment is positive or negative. If the ACK is positive means, the data has been received successfully. If ACK is
negative, then TCP will resend the data. It also follows the flow and error control mechanism.
UDP is an unreliable protocol as it does not ensure the delivery of the data.
o Flow Control
TCP follows the flow control mechanism that ensures a large number of packets are not sent to the receiver at the same
time, while UDP does not follow the flow control mechanism.
o Ordering
TCP uses ordering and sequencing techniques to ensure that the data packets are received in the same order in which
they are sent. On the other hand, UDP does not follow any ordering and sequencing technique; i.e., data can be sent in
any sequence.
o Speed
Since TCP establishes a connection between a sender and receiver, performs error checking, and also guarantees the
delivery of data packets while UDP neither creates a connection nor it guarantees the delivery of data packets, so UDP is
faster than TCP.
o Flow of data
In TCP, data can flow in both directions means that it provides the full-duplex service. On the other hand, UDP is mainly
suitable for the unidirectional flow of data.

Let's look at the differences between the TCP and UDP in a tabular form.

TCP UDP

Full form It stands for Transmission Control Protocol. It stands for User Datagram Protocol.

Type of It is a connection-oriented protocol, which means It is a connectionless protocol, which means


connection that the connection needs to be established that it sends the data without checking
before the data is transmitted over the network. whether the system is ready to receive or not.

Reliable TCP is a reliable protocol as it provides assurance UDP is an unreliable protocol as it does not
for the delivery of data packets. take the guarantee for the delivery of
packets.

Speed TCP is slower than UDP as it performs error UDP is faster than TCP as it does not
checking, flow control, and provides assurance for guarantee the delivery of data packets.
the delivery of

Header size The size of TCP is 20 bytes. The size of the UDP is 8 bytes.
Acknowledgment TCP uses the three-way-handshake concept. In UDP does not wait for any acknowledgment;
this concept, if the sender receives the ACK, then it just sends the data.
the sender will send the data. TCP also has the
ability to resend the lost data.

Flow control It follows the flow control mechanism in which too This protocol follows no such mechanism.
mechanism many packets cannot be sent to the receiver at
the same time.

Error checking TCP performs error checking by using a It does not perform any error checking, and
checksum. When the data is corrected, then the also does not resend the lost data packets.
data is retransmitted to the receiver.

Applications This protocol is mainly used where a secure and This protocol is used where fast
reliable communication process is required, like communication is required and does not care
military services, web browsing, and e-mail. about the reliability like VoIP, game
streaming, video and music streaming, etc.

TCP
TCP stands for Transmission Control Protocol. It is a transport layer protocol that facilitates the transmission of packets
from source to destination. It is a connection-oriented protocol that means it establishes the connection prior to the
communication that occurs between the computing devices in a network. This protocol is used with an IP protocol, so together,
they are referred to as a TCP/IP.

The main functionality of the TCP is to take the data from the application layer. Then it divides the data into a several packets,
provides numbering to these packets, and finally transmits these packets to the destination. The TCP, on the other side, will
reassemble the packets and transmits them to the application layer. As we know that TCP is a connection-oriented protocol, so
the connection will remain established until the communication is not completed between the sender and the receiver.

Features of TCP protocol


The following are the features of a TCP protocol:

o Transport Layer Protocol

TCP is a transport layer protocol as it is used in transmitting the data from the sender to the receiver.

o Reliable

TCP is a reliable protocol as it follows the flow and error control mechanism. It also supports the acknowledgment mechanism,
which checks the state and sound arrival of the data. In the acknowledgment mechanism, the receiver sends either positive or
negative acknowledgment to the sender so that the sender can get to know whether the data packet has been received or
needs to resend.

o Order of the data is maintained

This protocol ensures that the data reaches the intended receiver in the same order in which it is sent. It orders and numbers
each segment so that the TCP layer on the destination side can reassemble them based on their ordering.

o Connection-oriented

It is a connection-oriented service that means the data exchange occurs only after the connection establishment. When the
data transfer is completed, then the connection will get terminated.

o Full duplex

It is a full-duplex means that the data can transfer in both directions at the same time.

o Stream-oriented
TCP is a stream-oriented protocol as it allows the sender to send the data in the form of a stream of bytes and also allows the
receiver to accept the data in the form of a stream of bytes. TCP creates an environment in which both the sender and receiver
are connected by an imaginary tube known as a virtual circuit. This virtual circuit carries the stream of bytes across the
internet.

Need of Transport Control Protocol


In the layered architecture of a network model, the whole task is divided into smaller tasks. Each task is assigned to a
particular layer that processes the task. In the TCP/IP model, five layers are application layer, transport layer, network
layer, data link layer, and physical layer. The transport layer has a critical role in providing end-to-end communication to the
directly application processes. It creates 65,000 ports so that the multiple applications can be accessed at the same time. It
takes the data from the upper layer, and it divides the data into smaller packets and then transmits them to the network layer.

Working of TCP
In TCP, the connection is established by using three-way handshaking. The client sends the segment with its sequence number.
The server, in return, sends its segment with its own sequence number as well as the acknowledgement sequence, which is one
more than the client sequence number. When the client receives the acknowledgment of its segment, then it sends the
acknowledgment to the server. In this way, the connection is established between the client and the server.

Advantages of TCP
o It provides a connection-oriented reliable service, which means that it guarantees the delivery of data packets. If the
data packet is lost across the network, then the TCP will resend the lost packets.
o It provides a flow control mechanism using a sliding window protocol.
o It provides error detection by using checksum and error control by using Go Back or ARP protocol.
o It eliminates the congestion by using a network congestion avoidance algorithm that includes various schemes such as
additive increase/multiplicative decrease (AIMD), slow start, and congestion window.

Disadvantage of TCP
It increases a large amount of overhead as each segment gets its own TCP header, so fragmentation by the router increases
the overhead.

TCP Header format


o Source port: It defines the port of the application, which is sending the data. So, this field contains the source port
address, which is 16 bits.
o Destination port: It defines the port of the application on the receiving side. So, this field contains the destination port
address, which is 16 bits.
o Sequence number: This field contains the sequence number of data bytes in a particular session.
o Acknowledgment number: When the ACK flag is set, then this contains the next sequence number of the data byte
and works as an acknowledgment for the previous data received. For example, if the receiver receives the segment
number 'x', then it responds 'x+1' as an acknowledgment number.
o HLEN: It specifies the length of the header indicated by the 4-byte words in the header. The size of the header lies
between 20 and 60 bytes. Therefore, the value of this field would lie between 5 and 15.
o Reserved: It is a 4-bit field reserved for future use, and by default, all are set to zero.
o Flags
There are six control bits or flags:
1. URG: It represents an urgent pointer. If it is set, then the data is processed urgently.
2. ACK: If the ACK is set to 0, then it means that the data packet does not contain an acknowledgment.
3. PSH: If this field is set, then it requests the receiving device to push the data to the receiving application without
buffering it.
4. RST: If it is set, then it requests to restart a connection.
5. SYN: It is used to establish a connection between the hosts.
6. FIN: It is used to release a connection, and no further data exchange will happen.

o Window size
It is a 16-bit field. It contains the size of data that the receiver can accept. This field is used for the flow control between
the sender and receiver and also determines the amount of buffer allocated by the receiver for a segment. The value of
this field is determined by the receiver.
o Checksum
It is a 16-bit field. This field is optional in UDP, but in the case of TCP/IP, this field is mandatory.
o Urgent pointer
It is a pointer that points to the urgent data byte if the URG flag is set to 1. It defines a value that will be added to the
sequence number to get the sequence number of the last urgent byte.
o Options
It provides additional options. The optional field is represented in 32-bits. If this field contains the data less than 32-bit,
then padding is required to obtain the remaining bits.

What is a TCP port?


The TCP port is a unique number assigned to different applications. For example, we have opened the email and games
applications on our computer; through email application, we want to send the mail to the host, and through games application,
we want to play the online games. In order to do all these tasks, different unique numbers are assigned to these applications.
Each protocol and address have a port known as a port number. The TCP (Transmission Control Protocol) and UDP (User
Datagram Protocol) protocols mainly use the port numbers.

A port number is a unique identifier used with an IP address. A port is a 16-bit unsigned integer, and the total number of ports
available in the TCP/IP model is 65,535 ports. Therefore, the range of port numbers is 0 to 65535. In the case of TCP, the zero-
port number is reserved and cannot be used, whereas, in UDP, the zero port is not available. IANA (Internet Assigned Numbers
Authority) is a standard body that assigns the port numbers.

Example of port number:

192.168.1.100: 7

In the above case, 192.168.1.100 is an IP address, and 7 is a port number.

To access a particular service, the port number is used with an IP address. The range from 0 to 1023 port numbers are
reserved for the standard protocols, and the other port numbers are user-defined.

Why do we require port numbers?


A single client can have multiple connections with the same server or multiple servers. The client may be running multiple
applications at the same time. When the client tries to access some service, then the IP address is not sufficient to access the
service. To access the service from a server, the port number is required. So, the transport layer plays a major role in providing
multiple communication between these applications by assigning a port number to the applications.

Classification of port numbers


The port numbers are divided into three categories:

o Well-known ports
o Registered ports
o Dynamic ports

Well-known ports
The range of well-known port is 0 to 1023. The well-known ports are used with those protocols that serve common applications
and services such as HTTP (hypertext transfer protocol), IMAP (Internet Message Access Protocol), SMTP (Simple Mail Transfer
Protocol), etc. For example, we want to visit some websites on an internet; then, we use http protocol; the http is available
with a port number 80, which means that when we use http protocol with an application then it gets port number 80. It is
defined that whenever http protocol is used, then port number 80 will be used. Similarly, with other protocols such as SMTP,
IMAP; well-known ports are defined. The remaining port numbers are used for random applications.

Registered ports
The range of registered port is 1024 to 49151. The registered ports are used for the user processes. These processes are
individual applications rather than the common applications that have a well-known port.

Dynamic ports
The range of dynamic port is 49152 to 65535. Another name of the dynamic port is ephemeral ports. These port numbers are
assigned to the client application dynamically when a client creates a connection. The dynamic port is identified when the client
initiates the connection, whereas the client knows the well-known port prior to the connection. This port is not known to the
client when the client connects to the service.

TCP and UDP header


As we know that both TCP and UDP contain source and destination port numbers, and these port numbers are used to identify
the application or a server both at the source and the destination side. Both TCP and UDP use port numbers to pass the
information to the upper layers.

Let's understand this scenario.

Suppose a client is accessing a web page. The TCP header contains both the source and destination port.
Client-side
In the above diagram,

Source Port: The source port defines an application to which the TCP segment belongs to, and this port number is dynamically
assigned by the client. This is basically a process to which the port number is assigned.

Destination port: The destination port identifies the location of the service on the server so that the server can serve the
request of the client.

Server-side
In the above diagram,

Source port: It defines the application from where the TCP segment came from.
Destination port: It defines the application to which the TCP segment is going to.

In the above case, two processes are used:

Encapsulation: Port numbers are used by the sender to tell the receiver which application it should use for the data.

Decapsulation: Port numbers are used by the receiver to identify which application should it sends the data to.

Let's understand the above example by using all three ports, i.e., well-known port, registered port, and dynamic port.

First, we look at a well-known port.

The well-known ports are the ports that serve the common services and applications like http, ftp, smtp, etc. Here, the client
uses a well-known port as a destination port while the server uses a well-known port as a source port. For example, the client
sends an http request, then, in this case, the destination port would be 80, whereas the http server is serving the request so its
source port number would be 80.
Now, we look at the registered port.

The registered port is assigned to the non-common applications. Lots of vendor applications use this port. Like the well-known
port, client uses this port as a destination port whereas the server uses this port as a source port.

At the end, we see how dynamic port works in this scenario.


The dynamic port is the port that is dynamically assigned to the client application when initiating a connection. In this case, the
client uses a dynamic port as a source port, whereas the server uses a dynamic port as a destination port. For example, the
client sends an http request; then in this case, destination port would be 80 as it is a http request, and the source port will only
be assigned by the client. When the server serves the request, then the source port would be 80 as it is an http server, and the
destination port would be the same as the source port of the client. The registered port can also be used in place of a dynamic
port.

Let's look at the below example.

Suppose client is communicating with a server, and sending the http request. So, the client sends the TCP segment to the well-
known port, i.e., 80 of the HTTP protocols. In this case, the destination port would be 80 and suppose the source port assigned
dynamically by the client is 1028. When the server responds, the destination port is 1028 as the source port defined by the
client is 1028, and the source port at the server end would be 80 as the HTTP server is responding to the request of the client.
IPv4 vs IPv6
What is IP?
An IP stands for internet protocol. An IP address is assigned to each device connected to a network. Each device uses an IP
address for communication. It also behaves as an identifier as this address is used to identify the device on a network. It
defines the technical format of the packets. Mainly, both the networks, i.e., IP and TCP, are combined together, so together,
they are referred to as a TCP/IP. It creates a virtual connection between the source and the destination.

We can also define an IP address as a numeric address assigned to each device on a network. An IP address is assigned to each
device so that the device on a network can be identified uniquely. To facilitate the routing of packets, TCP/IP protocol uses a
32-bit logical address known as IPv4(Internet Protocol version 4).

An IP address consists of two parts, i.e., the first one is a network address, and the other one is a host address.

There are two types of IP addresses:

o IPv4
o IPv6

What is IPv4?
IPv4 is a version 4 of IP. It is a current version and the most commonly used IP address. It is a 32-bit address written in four
numbers separated by 'dot', i.e., periods. This address is unique for each device.

For example, 66.94.29.13

The above example represents the IP address in which each group of numbers separated by periods is called an Octet. Each
number in an octet is in the range from 0-255. This address can produce 4,294,967,296 possible unique addresses.

In today's computer network world, computers do not understand the IP addresses in the standard numeric format as the
computers understand the numbers in binary form only. The binary number can be either 1 or 0. The IPv4 consists of four sets,
and these sets represent the octet. The bits in each octet represent a number.
Each bit in an octet can be either 1 or 0. If the bit the 1, then the number it represents will count, and if the bit is 0, then the
number it represents does not count.

Representation of 8 Bit Octet

The above representation shows the structure of 8- bit octet.

Now, we will see how to obtain the binary representation of the above IP address, i.e., 66.94.29.13

Step 1: First, we find the binary number of 66.

To obtain 66, we put 1 under 64 and 2 as the sum of 64 and 2 is equal to 66 (64+2=66), and the remaining bits will be zero,
as shown above. Therefore, the binary bit version of 66 is 01000010.

Step 2: Now, we calculate the binary number of 94.

To obtain 94, we put 1 under 64, 16, 8, 4, and 2 as the sum of these numbers is equal to 94, and the remaining bits will be
zero. Therefore, the binary bit version of 94 is 01011110.
Step 3: The next number is 29.

To obtain 29, we put 1 under 16, 8, 4, and 1 as the sum of these numbers is equal to 29, and the remaining bits will be zero.
Therefore, the binary bit version of 29 is 00011101.

Step 4: The last number is 13.

To obtain 13, we put 1 under 8, 4, and 1 as the sum of these numbers is equal to 13, and the remaining bits will be zero.
Therefore, the binary bit version of 13 is 00001101.

Drawback of IPv4
Currently, the population of the world is 7.6 billion. Every user is having more than one device connected with the internet, and
private companies also rely on the internet. As we know that IPv4 produces 4 billion addresses, which are not enough for each
device connected to the internet on a planet. Although the various techniques were invented, such as variable- length mask,
network address translation, port address translation, classes, inter-domain translation, to conserve the bandwidth of IP
address and slow down the depletion of an IP address. In these techniques, public IP is converted into a private IP due to which
the user having public IP can also use the internet. But still, this was not so efficient, so it gave rise to the development of the
next generation of IP addresses, i.e., IPv6.

What is IPv6?
IPv4 produces 4 billion addresses, and the developers think that these addresses are enough, but they were wrong. IPv6 is the
next generation of IP addresses. The main difference between IPv4 and IPv6 is the address size of IP addresses. The IPv4 is a
32-bit address, whereas IPv6 is a 128-bit hexadecimal address. IPv6 provides a large address space, and it contains a simple
header as compared to IPv4.

It provides transition strategies that convert IPv4 into IPv6, and these strategies are as follows:

o Dual stacking: It allows us to have both the versions, i.e., IPv4 and IPv6, on the same device.
o Tunneling: In this approach, all the users have IPv6 communicates with an IPv4 network to reach IPv6.
o Network Address Translation: The translation allows the communication between the hosts having a different version
of IP.

This hexadecimal address contains both numbers and alphabets. Due to the usage of both the numbers and alphabets, IPv6 is
capable of producing over 340 undecillion (3.4*1038) addresses.

IPv6 is a 128-bit hexadecimal address made up of 8 sets of 16 bits each, and these 8 sets are separated by a colon. In IPv6,
each hexadecimal character represents 4 bits. So, we need to convert 4 bits to a hexadecimal number at a time

Address format
The address format of IPv4:

The address format of IPv6:


The above diagram shows the address format of IPv4 and IPv6. An IPv4 is a 32-bit decimal address. It contains 4 octets or
fields separated by 'dot', and each field is 8-bit in size. The number that each field contains should be in the range of 0-255.
Whereas an IPv6 is a 128-bit hexadecimal address. It contains 8 fields separated by a colon, and each field is 16-bit in size.

Differences between IPv4 and IPv6

Ipv4 Ipv6

Address length IPv4 is a 32-bit address. IPv6 is a 128-bit address.


Fields IPv4 is a numeric address that consists of 4 IPv6 is an alphanumeric address that
fields which are separated by dot (.). consists of 8 fields, which are separated
by colon.

Classes IPv4 has 5 different classes of IP address that IPv6 does not contain classes of IP
includes Class A, Class B, Class C, Class D, and addresses.
Class E.

Number of IP IPv4 has a limited number of IP addresses. IPv6 has a large number of IP addresses.
address

VLSM It supports VLSM (Virtual Length Subnet Mask). It does not support VLSM.
Here, VLSM means that Ipv4 converts IP
addresses into a subnet of different sizes.

Address It supports manual and DHCP configuration. It supports manual, DHCP, auto-
configuration configuration, and renumbering.

Address space It generates 4 billion unique addresses It generates 340 undecillion unique
addresses.

End-to-end In IPv4, end-to-end connection integrity is In the case of IPv6, end-to-end


connection unachievable. connection integrity is achievable.
integrity

Security features In IPv4, security depends on the application. In IPv6, IPSEC is developed for security
This IP address is not developed in keeping the purposes.
security feature in mind.
Address In IPv4, the IP address is represented in In IPv6, the representation of the IP
representation decimal. address in hexadecimal.

Fragmentation Fragmentation is done by the senders and the Fragmentation is done by the senders
forwarding routers. only.

Packet flow It does not provide any mechanism for packet It uses flow label field in the header for
identification flow identification. the packet flow identification.

Checksum field The checksum field is available in IPv4. The checksum field is not available in
IPv6.

Transmission IPv4 is broadcasting. On the other hand, IPv6 is multicasting,


scheme which provides efficient network
operations.

Encryption and It does not provide encryption and It provides encryption and
Authentication authentication. authentication.

Number of octets It consists of 4 octets. It consists of 8 fields, and each field


contains 2 octets. Therefore, the total
number of octets in IPv6 is 16.

HTTP vs HTTPS
What is HTTP?
An HTTP stands for Hypertext Transfer Protocol. The HTTP protocol provides communication between different communication
systems. When the user makes an HTTP request on the browser, then the webserver sends the requested data to the user in
the form of web pages. In short, we can say that the HTTP protocol allows us to transfer the data from the server to the client.

An HTTP is an application layer protocol that comes above the TCP layer. It has provided some standard rules to the web
browsers and servers, which they can use to communicate with each other.

An HTTP is a stateless protocol as each transaction is executed separately without having any knowledge of the previous
transactions, which means that once the transaction is completed between the web browser and the server, the connection gets
lost.

What is HTTPS?
The full form of HTTPS is Hypertext Transfer Protocol Secure. The HTTP protocol does not provide the security of the data, while
HTTP ensures the security of the data. Therefore, we can say that HTTPS is a secure version of the HTTP protocol. This protocol
allows transferring the data in an encrypted form. The use of HTTPS protocol is mainly required where we need to enter the
bank account details. The HTTPS protocol is mainly used where we require to enter the login credentials. In modern browsers
such as chrome, both the protocols, i.e., HTTP and HTTPS, are marked differently. To provide encryption, HTTPS uses an
encryption protocol known as Transport Layer Security, and officially, it is referred to as a Secure Sockets Layer (SSL). This
protocol uses a mechanism known as asymmetric public key infrastructure, and it uses two different keys which are given
below:

o Private key: This key is available on the web server, which is managed by the owner of a website.

It decrypts the information which is encrypted by the public key.


o Public key: This key is available to everyone. It converts the data into an encrypted form.

Main difference between the HTTP and HTTPS


The major difference between the HTTP and HTTPS is the SSL certificate. The HTTPS protocol is an extended version of the
HTTP protocol with an additional feature of security.

This additional feature of security is very important for those websites which transmit sensitive data such as credit card
information.
The HTTPS protocol is secured due to the SSL protocol. The SSL protocol encrypts the data which the client transmits to the
server. If someone tries to steal the information which is being communicated between the client and the server, then he/she
would not be able to understand due to the encryption. This is the main difference between the HTTP and HTTPS that the HTTP
does not contain SSL, whereas the HTTPS contains SSL that provides secure communication between the client and the server.

Which is better, HTTP or HTTPS?


Till now, we read that the HTTPS is better than HTTP because it provides security. Sometimes our website does not contain an
e-commerce page that requires sensitive data; in that case, we can switch to the HTTP protocol. Despite the security, HTTPS
also provides SEO. So, we do need to put more effort into boosting our SEO.

HTTP vs HTTPS performance


The speed of HTTP is faster than the HTTPS as the HTTPS contains SSL protocol, while HTTPS does not contain an SSL protocol.
This additional feature of SSL in HTTPS makes the page loading slower.

Differences between HTTP and HTTPS

The following are the differences between the HTTP and HTTPS:

o Protocol

The HTTP protocol stands for Hypertext Transfer Protocol, whereas the HTTPS stands for Hypertext Transfer Protocol Secure.

o Security

The HTTP protocol is not secure protocol as it does not contain SSL (Secure Sockets Layer), which means that the data can be
stolen when the data is transmitted from the client to the server. Whereas, the HTTPS protocol contains the SSL certificate that
converts the data into an encrypted form, so no data can be stolen in this case as outsiders do not understand the encrypted
text.

o Port numbers
The HTTP transmits the data over port number 80, whereas the HTTPS transmits the data over 443 port number. Under the
documentation issued by Tim Berners-Lee, he stated that "if the port number is not specified, then it will be considered as
HTTP".

When RFC 1340 was announced, then the IETF (Internet Engineering Task Force) provided port number 80 to the HTTP. When
the new RFC was released in the year 1994, the HTTPS is assigned with a port number 443.

o Layers

The HTTP protocol works on the application layer while the HTTPS protocol works on the transport layer. As we know that the
responsibility of the transport layer is to move the data from the client to the server, and data security is a major concern.
HTTPS operates in the transport layer, so it is wrapped with a security layer.

o SSL Certificates

When we want our websites to have an HTTPS protocol, then we need to install the signed SSL certificate. The SSL certificates
can be available for both free and paid service. The service can be chosen based on business needs.

The HTTP does not contain any SSL certificates, so it does not decrypt the data, and the data is sent in the form of plain text.

o SEO Advantages

The SEO advantages are provided to those websites that use HTTPS as GOOGLE gives the preferences to those websites that
use HTTPS rather than the websites that use HTTP.

o Online Transactions

If we are running an online business, then it becomes necessary to have HTTPS. If we do not use the HTTPS in an online
business, then the customers would not purchase as they are scared that their data can be stolen by the outsiders.

Let's understand the differences in a tabular form.

HTTP HTTPS
The full form of HTTP is the Hypertext Transfer The full form of HTTPS is Hypertext Transfer Protocol Secure.
Protocol.

It is written in the address bar as http://. It is written in the address bar as https://.

The HTTP transmits the data over port number The HTTPS transmits the data over port number 443.
80.

It is unsecured as the plain text is sent, which It is secure as it sends the encrypted data which hackers cannot
can be accessible by the hackers. understand.

It is mainly used for those websites that It is a secure protocol, so it is used for those websites that require to
provide information like blog writing. transmit the bank account details or credit card numbers.

It is an application layer protocol. It is a transport layer protocol.

It does not use SSL. It uses SSL that provides the encryption of the data.

Google does not give the preference to the Google gives preferences to the HTTPS as HTTPS websites are secure
HTTP websites. websites.

The page loading speed is fast. The page loading speed is slow as compared to HTTP because of the
additional feature that it supports, i.e., security.

Das könnte Ihnen auch gefallen