Module 4
Module 4
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
• Internetworking devices are the building blocks that allow different computers and devices to
communicate and share resources on a network
What is a Repeater?
• Repeaters are defined as a networking device that is used to amplify and generate the incoming
signal. Repeaters work at the physical layer of the OSI model. The main aim of using a repeater is to
increase the networking distance by increasing the strength and quality of signals.
• Using repeaters helps to reduce error, and loss of data and provides with delivery of data at specified
locations only. The major advantage of using a repeater is that it provides with transfer of data with
more security and over a long distance.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
• Features of Repeaters
• Repeater can regenerate the signal without modifying it.
• Repeaters can be used in analog signals and digital signals.
• Repeaters can extend the range of networks.
• Dynamic networking is supported by repeater.
• Use of Repeaters reduces error and loss of data.
• Power is required for working of repeaters.
• Using repeater can add complexity in the network.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
2. Hub – A hub is a basically multi-port repeater. A hub
connects multiple wires coming from different branches,
for example, the connector in star topology which
connects different stations. Hubs cannot filter data, so
data packets are sent to all connected devices.
In other words, the collision domain of all hosts
connected through Hub remains one.
Also, they do not have the intelligence to find out the best
path for data packets which leads to inefficiencies and
wastage.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
Types of Hub
• Active Hub:- These are the hubs that have their power supply and can clean, boost,
and relay the signal along with the network. It serves both as a repeater as well as a
wiring center. These are used to extend the maximum distance between nodes.
• Passive Hub:- These are the hubs that collect wiring from nodes and power supply
from the active hub. These hubs relay signals onto the network without cleaning
and boosting them and can’t be used to extend the distance between nodes.
• Intelligent Hub:- It works like an active hub and includes remote management
capabilities. They also provide flexible data rates to network devices. It also enables
an administrator to monitor the traffic passing through the hub and to configure
each port in the hub.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
3. Bridge – A bridge operates at the data link layer. A bridge is a
repeater, with add on the functionality of filtering content by reading
the MAC addresses of the source and destination. It is also used for
interconnecting two LANs working on the same protocol. It has a
single input and single output port, thus making it a 2 port device.
Types of Bridges
• Transparent Bridges:- These are the bridge in which the stations are
completely unaware of the bridge’s existence i.e. whether or not a
bridge is added or deleted from the network, reconfiguration of the
stations is unnecessary. These bridges make use of two processes i.e.
bridge forwarding and bridge learning.
• Source Routing Bridges:- In these bridges, routing operation is
performed by the source station and the frame specifies which route
to follow. The host can discover the frame by sending a special frame
called the discovery frame, which spreads through the entire
network using all possible paths to the destination.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
4. Switch – A switch is a multiport bridge with a buffer and a design that can
boost its efficiency(a large number of ports imply less traffic) and performance.
A switch is a data link layer device. The switch can perform error checking
before forwarding data, which makes it very efficient as it does not forward
packets that have errors and forward good packets selectively to the correct
port only.
• Switches may operate at one or more layers of the OSI model. They may
operate in the data link layer and network layer; a device that operates
simultaneously at more than one of these layers is known as a multilayer
switch.
• A Switch can check the errors before forwarding the data, which makes it
more efficient and improves its performance. A switch is the better version of
a hub. It is a multi-port bridge device.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
Types of Switch
1. Unmanaged switches: These switches have a simple plug-and-play design and do not offer advanced
configuration options. They are suitable for small networks or for use as an expansion to a larger
network.
2. Managed switches: These switches offer advanced configuration options such as VLANs, QoS, and
link aggregation. They are suitable for larger, more complex networks and allow for centralized
management.
3. Smart switches: These switches have features similar to managed switches but are typically easier to
set up and manage. They are suitable for small- to medium-sized networks.
4. Layer 2 switches: These switches operate at the Data Link layer of the OSI model and are responsible
for forwarding data between devices on the same network segment.
5. Layer 3 switches: These switches operate at the Network layer of the OSI model and can route data
between different network segments. They are more advanced than Layer 2 switches and are often
used in larger, more complex networks.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
5. Routers – A router is a device like a switch that routes data packets based on their IP addresses. The
router is mainly a Network Layer device. Routers normally connect LANs and WANs and have a
dynamically updating routing table based on which they make decisions on routing the data packets. The
router divides the broadcast domains of hosts connected through it.
• Routers are small physical devices that operate at the network layer to join multiple networks together.
• A router is a device like a switch that routes data packets based on their IP addresses.
• Routers normally connect LANs and WANs and have a dynamically updating routing table based on
which they make decisions on routing the data packets.
• A Router divides the broadcast domains of hosts connected through it.
• Routers perform the traffic directing functions on the Internet. A data packet is typically forwarded
from one router to another through the networks that constitute the internetwork until it reaches its
destination code.
• Routers may also be used to connect two or more logical groups of computer devices known as
subnets, each with a different subnetwork address.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
Two types of routers −
1. Static routers – Static routers are configured manually and route data packets based on the
information in a router table.
2. Dynamic routers – Dynamic routers use adaptive routing which is a process where a router can
forward data by a different route.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Internetworking & devices: Repeaters, Hubs,
Bridges, Switches, Router, Gateway
A gateway is a device that can connect networks that use different protocols. It acts as a translator
between different networks. A gateway is an internetworking capable of joining together two networks
that use different base protocols.
• A network gateway can be implemented completely in software, hardware, or a combination of both,
depending on the types of protocols they support.
• A network gateway can operate at any level of the OSI model. A broadband router typically serves as
the network gateway, although ordinary computers can also be configured to perform equivalent
functions.
• A gateway is a router or proxy server that routes between networks.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
IP ADDRESSES
Solution
We replace each group of 8 bits with its equivalent decimal number and add dots for
separation
Example
Change the following IPv4 addresses from dotted-decimal notation to binary notation.
Solution
We replace each decimal number with its binary equivalent
Example
Find the error, if any, in the following IPv4 addresses.
Solution
a. There must be no leading zero (045).
b. There can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal notation is not allowed.
3. Classful addressing
1. Unicast
Transmitting a packet from one source node to one destination node is called as unicast.
We can say, it is a one to one transmission.
CASTING AND ITS TYPES CONTD…
2. Broadcast
In Broadcasting, Packet is send to all residing host in the same or different network,
depending on its types.
It is a one to all transmission.
Broadcasting is of two types [Limited Broadcast, Direct Broadcast]
CASTING AND ITS TYPES CONTD…
3. Multicast
Transmitting data packet from one source Node to a particular group of Nodes is known
as Multicast.
It is also an example of one to many transmission.
CLASSFUL ADDRESSING CONTD…
Mask
Although the length of the netid and hostid (in bits) is predetermined in classful
addressing, we can also use a mask (also called the default mask)
32-bit number made of contiguous 1’s followed by contiguous 0’s. The masks for classes
A, B, and C. The concept does not apply to classes D and E.
The mask can help us to find the netid and the hostid.
Example
Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
4. Classless addressing
To overcome address depletion and give more organizations access to the Internet,
classless addressing was designed and implemented.
Here are no classes, but the addresses are still granted in blocks.
Address Blocks
In classless addressing, when an entity, small or large, needs to be connected to the
Internet, it is granted a block (range) of addresses.
The size of the block (the number of addresses) varies based on the nature and size of
the entity.
Classless addressing contd…
Restriction: To simplify the handling of addresses, the Internet authorities impose three
restrictions on classless address blocks:
1.The addresses in a block must be contiguous, one after another.
2.The number of addresses in a block must be a power of 2 (I, 2, 4, 8, ... ).
3.The first address must be evenly divisible by the number of addresses.
CLASSLESS ADDRESSING CONTD…
Mask
A better way to define a block of addresses is to select any address in the block and the
mask.
A mask is a 32-bit number in which the n leftmost bits are I’s and the 32 - n rightmost
bits are 0’s.
However, in classless addressing the mask for a block can take any value from 0 to 32. It
is very convenient to give just the value of n preceded by a slash (CIDR notation)
i. /n [denotes the prefix length]
ii. /(n-32) [denotes the suffix length]
Example
A block of addresses is granted to a small organization. We know that one of the addresses is
205.16.37.39/28. What is the first address in the block?
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or 205.16.37.32.
Example
Find the last address for the block
Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or 205.16.37.47
Internet Protocol version 6 (IPv6)
IPv6 was developed by Internet Engineering Task Force (IETF) to deal with the
problem of IPv4 exhaustion.
IPv6 is a 128-bits address having an address space of 2128, which is way bigger than
IPv4.
IPv6 use Hexa-Decimal format separated by colon (:) .
Internet Protocol version 6 (IPv6)
Unicast
Multicast
Anycast
Unicast Address
Unicast Address identifies a single network interface. A packet sent to a unicast address
is delivered to the interface identified by that address.
Addressing methods
Multicast Address
Anycast Address
Introduction To Subnetting
When a bigger network is divided into smaller networks, to maintain
security, then that is known as Subnetting. So, maintenance is easier for
smaller networks. For example, if we consider a class A address, the
possible number of hosts is 224 for each network, it is obvious that it is
difficult to maintain such a huge number of hosts, but it would be quite
easier to maintain if we divide the network into small parts.
Uses of Subnetting
• Subnetting helps in organizing the network in an efficient way which
helps in expanding the technology for large firms and companies.
• Subnetting is used for specific staffing structures to reduce traffic
and maintain order and efficiency. In the above diagram, there are two
• Subnetting divides domains of the broadcast so that traffic is routed Subnets.
efficiently, which helps in improving network performance. Note: It is a class C IP so, there are 24 bits in
• Subnetting is used in increasing network security. the network id part and 8 bits in the host id
The network can be divided into two parts: To divide a network into two part.
parts, you need to choose one bit for each Subnet from the host ID
part.
Subnetting
Benefits of Subnetting:
• Improved Network Efficiency: By dividing a large network into subnets, you can reduce broadcast traffic.
Broadcast traffic is like shouting to everyone in a city, whereas sending data within a subnet is like talking to a
specific person in their neighborhood. Less overall network traffic means better performance for everyone.
• Enhanced Security: Subnetting allows you to isolate network segments. This can be helpful for implementing
security policies and restricting access to certain parts of the network. For example, you can create a separate
subnet for guest users, limiting their access to sensitive resources.
• Better Network Management: Subnetting makes it easier to manage and troubleshoot network issues. By
isolating problems within a specific subnet, you can identify and fix them more quickly.
• Efficient IP Address Allocation: Subnetting allows you to allocate IP addresses more efficiently. With a large
network, you might end up wasting a lot of addresses if you don't subnet. Subnetting helps you create subnets
with the exact number of addresses you need.
Subnetting
Advantages of Subnetting
• Subnetting is used to decrease the presence of Internet Protocol (IP) range.
• Subnets helps in stopping the devices or gadgets from occupying the whole network, only allowing the hosts to
control which kind of user can have access to the important information. Simply, we can tell that network is safe
just because of the subnetting concept.
• Subnetting concept increases the performance of the total network by deleting the repeated traffic causing
errors.
• We can convert the whole big network into smaller networks by using the concept of subnetting as discussed
earlier.
Disadvantages of Subnetting
• If the number of subnets increases, then the number of routers must also increase along with the subnet
increase number. This happens because each subnet has its own subnet mask, broadcast address and network
address.
• As told earlier, if we create many subnets many IP Addresses are wasted because of the wastage of Host ID Bits
• The cost of the entire network is increased by subnetting, which calls for the acquisition of pricey internal
routers, switches, hubs, and bridges, among other things.
• The complexity of the network is increased through subnetting. The subnet network must be managed by a
skilled network administrator.
Static vs. dynamic routing
What is Static Routing?
• It is also known as "non-adaptive routing". The network administrator contains the routes in the
routing table while using this routing. As a result, the router transfers data from the source to
the destination using the administrator-defined route. Routing decisions don't depend on factors
like network traffic or topology.
• Advantages
• It can easily implement in small networks.
• It doesn't need bandwidth usage between the routers.
• It doesn't need additional resources as update mechanisms are not required.
• It is a more secure routing.
• It is more predictable because the route is specified to the destination.
• Disadvantages
• It is not helpful for complicated topologies and large networks.
• When the link is failed, it may affect the traffic rerouting.
• The administrator must use extreme caution when configuring the routes.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Static vs. dynamic routing
What is Dynamic Routing?
• Dynamic routing is also known as "adaptive routing", and it is a method of automatic routing. In other words,
when new routers are introduced to the network, the routing tables change. When a router fails, the routing
table automatically modifies to get the destination. As a result, dynamic routing responds to network and traffic
changes. This routing method employs dynamic routing algorithms to find new routes to the destination. As a
result, all network routers should use dynamic routing protocols that are consistent.
• Dynamic routing needs fewer routes. Moreover, it offers more accurate results in determining the optimum
path based on network changes. However, this routing method needs more bandwidth and offers less security.
• Advantages
• It is very helpful to all the topologies.
• Topologies automatically support traffic rerouting.
• The activities of the router are unaffected by network size.
• Disadvantages
• Dynamic routes depend on the current topologies.
• It needs extra resources like CPU, memory, and link bandwidth.
• It may be complex to implement.
• It is less secure as routing updates are broadcast and multicast.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity Univ
ersity, Gwalior, Madhya Pradesh, India
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity Univ
ersity, Gwalior, Madhya Pradesh, India
Routing algorithms: shortest path algorithm
• In between sending and receiving data packets from the sender to the receiver, it will go through
many routers and subnets. So as a part of increasing the efficiency in routing the data packets and
decreasing the traffic, we must find the shortest path
What is Shortest Path Routing?
• It refers to the algorithms that help to find the shortest path between a sender and receiver for
routing the data packets through the network in terms of shortest distance, minimum cost, and
minimum time.
• It is mainly for building a graph or subnet containing routers as nodes and edges as communication
lines connecting the nodes.
• Hop count is one of the parameters that is used to measure the distance.
• Hop count: It is the number that indicates how many routers are covered. If the hop count is 6, there
are 6 routers/nodes and the edges connecting them.
Common Shortest Path Algorithms
• Dijkstra’s Algorithm
• Bellman Ford’s Algorithm
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Routing algorithms: shortest path algorithm
Dijkstra’s Algorithm
• The Dijkstra’s Algorithm is a greedy algorithm that is used to find the minimum distance between a
node and all other nodes in a given graph. Here we can consider node as a router and graph as a
network. It uses weight of edge .ie, distance between the nodes to find a minimum distance route.
• Algorithm:
1: Mark the source node current distance as 0 and all others as infinity.
2: Set the node with the smallest current distance among the non-visited nodes as the current node.
3: For each neighbor, N, of the current node:
Calculate the potential new distance by adding the current distance of the current node with the
weight of the edge connecting the current node to N.
If the potential new distance is smaller than the current distance of node N, update N’s current
distance with the new distance.
4: Make the current node as visited node.
5: If we find any unvisited node, go to step 2 to find the next node which has the smallest current
distance and continue this process.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Routing algorithms: shortest path algorithm
Dijkstra’s Algorithm
• Example: Now,we will start normalising graph one by one starting from
• Consider the graph G: node 0.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Routing algorithms: shortest path algorithm
Dijkstra’s Algorithm
Step 2:-Nearest neighbour of 0 are 2 and 1 so we will normalize them first .
Step4:- Similarly we will normalize other node
considering it should not form a cycle and will keep track
in visited nodes.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Routing algorithms: shortest path algorithm
• Bellman Ford’s Algorithm
• The Bell man Ford’s algorithm is a single source graph search algorithm which help us to find the shortest path
between a source vertex and any other vertex in a give graph. We can use it in both weighted and unweighted
graphs. This algorithm is slower than Dijkstra’s algorithm and it can also use negative edge weight.
• Algorithm
• 1: First we Initialize all vertices v in a distance array dist[] as INFINITY.
• 2: Then we pick a random vertex as vertex 0 and assign dist[0] =0.
• 3: Then iteratively update the minimum distance to each node (dist[v]) by comparing it with the sum of the
distance from the source node (dist[u]) and the edge weight (weight) N-1 times.
• 4: To identify the presence of negative edge cycles, with the help of following cases do one more round of edge
relaxation.
• We can say that a negative cycle exists if for any edge uv the sum of distance from the source node (dist[u]) and
the edge weight (weight) is less than the current distance to the largest node(dist[v])
• It indicates the absence of negative edge cycle if none of the edges satisfies case1.
• Example: Bellman ford detecting negative edge cycle in a graph.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Routing algorithms: shortest path algorithm
• Consider the Graph G:
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Routing algorithms: shortest path algorithm
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Distance vector routing,
Step-01:
• Each router prepares its routing table. By their local knowledge. each router knows about
• All the routers present in the network
• Distance to its neighboring routers
Step-02:
• Each router exchanges its distance vector with its neighboring routers.
• Each router prepares a new routing table using the distance vectors it has obtained from its neighbors.
• This step is repeated for (n-2) times if there are n routers in the network.
• After this, routing tables converge / become stable.
• Distance Vector Routing Example-
• Consider-
• There is a network consisting of 4 routers.
• The weights are mentioned on the edges.
• Weights could be distances or costs or delays.
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Distance vector routing
Step-01:
• Each router prepares its routing table using its local knowledge.
• Routing table prepared by each router is shown below-
At Router A-
At Router B- At Router C-
At Router D-
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Distance vector routing
Step-02:
• Each router exchanges its distance vector obtained in Step-
01 with its neighbors.
• After exchanging the distance vectors, each router prepares
a new routing table.
This is shown below-
At Router A-
Router A receives distance vectors from its neighbors B and D.
Router A prepares a new routing table as-
Department of Computer Science & Engineering, Amity School of Engineering and Technology, Amity University, Gwalior, Madhya Pradesh, India
Distance vector routing
• Explanation For Destination B
• Router A can reach the destination router B via its neighbor B or neighbor D.
• It chooses the path which gives the minimum cost.
• Cost of reaching router B from router A via neighbor B = Cost (A→B) + Cost (B→B)= 2 + 0 = 2
• Cost of reaching router B from router A via neighbor D = Cost (A→D) + Cost (D→B) = 1 + 7 = 8
• Since the cost is minimum via neighbor B, so router A chooses the path via B.
• It creates an entry (2, B) for destination B in its new routing table.
• Similarly, we calculate the shortest path distance to each destination router at every router.
• Thus, the new routing table at router A is-
Distance vector routing
• Router B-
• Router B receives distance vectors from its neighbors A, C and D.
• Router B prepares a new routing table as-