CN Week 11
CN Week 11
A Router works at the network layer in the OSI model and internet layer in TCP/IP model.
A router is a networking device that forwards the packet based on the information available in the packet
header and forwarding table.
The routing algorithms are used for routing the packets. The routing algorithm is nothing but a software
responsible for deciding the optimal path through which packet can be transmitted.
The routing protocols use the metric to determine the best path for the packet delivery. The metric is the
standard of measurement such as hop count, bandwidth, delay, current load on the path, etc. used by the
routing algorithm to determine the optimal path to the destination.
The routing algorithm initializes and maintains the routing table for the process of path determination.
Routing metrics and costs are used for determining the best route to the destination. The factors used by the
protocols to determine the shortest path, these factors are known as a metric.
Routing Metrics
qHop count: Hop count is defined as a metric that specifies the number of passes through internetworking
devices such as a router, a packet must travel in a route to move from source to the destination.
qDelay: It is a time taken by the router to process, queue and transmit a datagram to an interface. The protocols
use this metric to determine the delay values for all the links along the path end-to-end. The path having the lowest
delay value will be considered as the best path.
qBandwidth: The capacity of the link is known as a bandwidth of the link. The bandwidth is measured in terms of
bits per second. The link that has a higher transfer rate like gigabit is preferred over the link that has the lower
capacity like 56 kb.
qLoad: Load refers to the degree to which the network resource such as a router or network link is busy. A Load can
be calculated in a variety of ways such as CPU utilization, packets processed per second.
qReliability: Reliability is a metric factor may be composed of a fixed value. It depends on the network links, and
its value is measured dynamically. Some networks go down more often than others. After network failure, some
network links repaired more easily than other network links.
Static Routing
v Static Routing is also known as Nonadaptive Routing.
v It is a technique in which the administrator manually adds the routes in a routing table.
v A Router can send the packets for the destination along the route defined by the administrator.
v In this technique, routing decisions are not made based on the condition or topology of the networks
BENEFITS: Disadvantages:
Ø No Overhead: It has ho overhead on the CPU usage
of the router. Therefore, the cheaper router can be For a large network, it becomes a very
used to obtain static routing. difficult task to add each route manually to
Ø Bandwidth: It has not bandwidth usage between the routing table.
the routers.
Ø Security: It provides security as the system The system administrator should have a good
administrator is allowed only to have control over knowledge of a topology as he has to add
the routing to a particular network. each route manually.
Dynamic Routing
v It is also known as Adaptive Routing.
v It is a technique in which a router adds a new route in the routing table for each packet in response to the changes
in the condition or topology of the network.
v Dynamic protocols are used to discover the new routes to reach the destination.
v In Dynamic Routing, RIP and OSPF are the protocols used to discover the new routes.
v If any route goes down, then the automatic adjustment will be made to reach the destination.
BENEFITS:
Disadvantages:
Ø It is easier to configure.
Ø It is more effective in selecting the best route in It is more expensive in terms of CPU and
response to the changes in the condition or topology bandwidth usage.
q A router transmits its distance vector to each of its neighbors in a routing packet.
q Each router receives and saves the most recently received distance vector from each of its neighbors.
q A router recalculates its distance vector when:
It receives a distance vector from a neighbor containing different information than before.
It discovers that a link to a neighbor has gone down.
In this algorithm, each router evaluates the distance between itself and every achievable
destination. This is accomplished by assessing the distance between a router and all of its immediate router neighbours
and adding each neighbouring routers computations for the distance between that neighbour and its close neighbours.
Step 1:
The following are the final routing table for all the
routers A, B, and C with lower cost distance vector
routing protocols.
Important Notes-
In Distance Vector Routing, only distance vectors are exchanged.
“Next hop”values are not exchanged as it results in exchanging the large amount of data which consumes more bandwidth.
While preparing a new routing table- a router takes into consideration only the distance vectors it has obtained from its neighboring
routers. It does not take into consideration its old routing table.
The algorithm is called so because- It involves exchanging of distance vectors between the routers.
Distance vector is nothing but an array of distances.
Routing tables are prepared total (n-1) times if there are n routers in the given network.
This is because shortest path between any 2 nodes contains at most n-1 edges if there are n nodes in the graph.
In link-state routing, each router attempt to construct its own internal map of the network topology. At the initial stage
of start-up, when a router becomes active, it sends the messages into the network and collects the information from
the routers to which it is directly connected.
It also provides information about whether the link to reach the router is active or not. This information is used by
other routers to build a map of network topology. Then the router uses the map to choose the best path.
The link state routing protocols respond swiftly to the network changes. It sends triggered updates when a network
change occurs and sends periodic updates at long time intervals such as 30 minutes.
If the link alters state, the device detected the alteration generates and propagate an update message regarding that
link to all routers. Then each router takes a copy of the update message and update its routing table and forwards the
message to all neighbouring router.
This flooding of the update message is needed to ensure that all routers update their database before creating an
update routing table that reflects the new technology. OSPF protocol is the example link state routing.
Key Differences Between Distance Vector Routing and Link State Routing:
q Bellman-Ford algorithm is used for performing distance vector routing whereas Dijsktra is used for performing the link state routing.
q In distance vector routing the routers receive the topological information from the neighbour point of view. On the contrary, in link
state routing the router receive complete information on the network topology.
q Distance vector routing calculates the best route based on the distance (fewest number of hops). As against, Link state routing
calculates the best route on the basis of least cost.
q Link state routing updates only the link state while Distance vector routing updates full routing table.
q The frequency of update in both routing technique is different distance vector update periodically whereas link state update
frequency employs triggered updates.
q The utilization of CPU and memory in distance vector routing is lower than the link state routing.
q The distance vector routing is simple to implement and manage. In contrast, the link state routing is complex and requires trained
network administrator.
q The convergence time in distance vector routing is slow, and it usually suffers from count to infinity problem. Conversely, the
convergence time in link state routing is fast, and it is more reliable.
q Distance vector doesn’t have hierarchical structure while in link state routing the nodes can have a hierarchical structure.
ICMP Protocol
v The ICMP stands for Internet Control Message Protocol. It is a network layer protocol. It is used for error handling in
the network layer, and it is primarily used on network devices such as routers.
v As different types of errors can exist in the network layer, so ICMP can be used to report these errors and to debug
those errors.
Error-reporting messages
The error-reporting message means that the router
encounters a problem when it processes an IP
packet then it reports a message.
Query messages
The query messages are those messages that help
the host to get the specific information of another
host.
Destination unreachable: The destination unreachable error occurs when the packet does
not reach the destination. Suppose the sender sends the message, but the message does
not reach the destination, then the intermediate router reports to the sender that the
destination is unreachable.
Source quench: ICMP provides feedback, i.e., source quench. Suppose the sender
resends the packet at a higher rate, and the router is not able to handle the high data
rate. To overcome such a situation, the router sends a source quench message to tell the
sender to send the packet at a lower rate.
Time exceeded: When the sender sends the packet, then it moves in a routing loop. The
time exceeded is based on the time-to-live value. When the packet traverses through the
router, then each router decreases the value of TTL by one. Whenever a router decreases
a datagram with a time-to-live value to zero, then the router discards a datagram and
sends the time exceeded message to the original source.
Parameter problems: The router and the destination host can send a parameter problem
message. This message conveys that some parameters are not properly set.
Redirection: When the packet is sent, then the routing table is gradually augmented and
updated. The tool used to achieve this is the redirection message. For example, A wants
to send the packet to B, and there are two routers exist between A and B. First, A sends
the data to the router 1. The router 1 sends the IP packet to router 2 and redirection
message to A so that A can update its routing table.
NAT
(Network Address
Translation)
Ø NAT stands for network address translation. It’s a way to map multiple local private addresses to a public one before
transferring the information. Organizations that want multiple devices to employ a single IP address use NAT, as do
most home routers.
However, the internet has exploded, and while not all 7 billion
people on the planet access the internet regularly, those that do
often have multiple connected devices: phones, personal desktop,
work laptop, tablet, TV, even refrigerators.
v So our mission is to get the destination MAC address which helps in communicating with other devices. This is where
ARP comes into the picture, its functionality is to translate IP address to physical addresses.
v Address Resolution Protocol (ARP) is a communication protocol used to find the MAC (Media Access Control) address of
a device from its IP address. This protocol is used when a device wants to communicate with another device on a Local
Area Network or Ethernet.
STEP 1: When a host tries to interact with another host, an ARP request is
initiated. If the IP address is for the local network, the source host checks its ARP
cache to find out the hardware address of the destination computer.
STEP 3: All hosts receive the broadcast and check their own IP address. If no
match is discovered, the request is ignored.
STEP 4: The destination host that finds the matching IP address sends an ARP
reply to the source host along with its hardware address, thus establishing the
communication. The ARP cache is then updated with the hardware address of
the destination host.
Dynamic Host
Configuration Protocol
DHCP does the following:
Dynamic Host Configuration Protocol (DHCP) is a
network management protocol used to dynamically
q DHCP manages the provision of all the nodes or
assign an IP address to nay device, or node, on a
devices added or dropped from the network.
network so they can communicate using IP (Internet
Protocol). DHCP automates and centrally manages
q DHCP maintains the unique IP address of the
these configurations. There is no need to manually
host using a DHCP server.
assign IP addresses to new devices. Therefore, there
is no requirement for any user configuration to
q It sends a request to the DHCP server whenever
connect to a DHCP based network.
a client/node/device, which is configured to
work with DHCP, connects to a network. The
DHCP can be implemented on local networks as well
server acknowledges by providing an IP address
as large enterprise networks. DHCP is the default
to the client/node/device.
protocol used by the most routers and networking
equipment. DHCP is also called RFC (Request for
q DHCP is also used to configure the proper
comments) 2131.
subnet mask, default gateway and DNS server
information on the node or device.
How DHCP works: The DHCP lease process works
as follows:
DHCP runs at the application layer of the
TCP/IP protocol stack to dynamically assign
IP addresses to DHCP clients/nodes and to v First of all, a client (network device) must be connected
allocate TCP/IP configuration information to the internet.
to the DHCP clients. Information includes v DHCP clients request an IP address. Typically, client
subnet mask information, default gateway, broadcasts a query for this information.
IP addresses and domain name system v DHCP server responds to the client request by providing
addresses. IP server address and other configuration information.
This configuration information also includes time period,
DHCP is based on client-server protocol in called a lease, for which the allocation is valid.
which servers manage a pool of unique IP v When refreshing an assignment, a DHCP clients request
addresses, as well as information about the same parameters, but the DHCP server may assign a
client configuration parameters, and assign new IP address. This is based on the policies set by the
addresses out of those address pools. administrator.
Components of DHCP:
DHCP Server: DHCP server is a networked device running the DCHP service that holds IP addresses and related
configuration information. This is typically a server or a router but could be anything that acts as a host, such as an SD-
WAN appliance.
DHCP client: DHCP client is the endpoint that receives configuration information from a DHCP server. This can be any
device like computer, laptop, IoT endpoint or anything else that requires connectivity to the network. Most of the devices
are configured to receive DHCP information by default.
IP address pool: IP address pool is the range of addresses that are available to DHCP clients. IP addresses are typically
handed out sequentially from lowest to the highest.
Subnet: Subnet is the partitioned segments of the IP networks. Subnet is used to keep networks manageable.
Lease: Lease is the length of time for which a DHCP client holds the IP address information. When a lease expires, the
client has to renew it.
DHCP relay: A host or router that listens for client messages being broadcast on that network and then forwards them to
a configured server. The server then sends responses back to the relay agent that passes them along to the client. DHCP
relay can be used to centralize DHCP servers instead of having a server on each subnet.
Benefits of DHCP
Ø Dynamic host configuration: DHCP automates the host configuration process and
eliminates the need to manually configure individual host. When TCP/IP (Transmission
control protocol/Internet protocol) is first deployed or when IP infrastructure changes are
required.
Ø Seamless IP host configuration: The use of DHCP ensures that DHCP clients get
accurate and timely IP configuration IP configuration parameter such as IP address, subnet
mask, default gateway, IP address of DND server and so on without user intervention.
Ø Flexibility and scalability: Using DHCP gives the administrator increased flexibility,
allowing the administrator to move easily change IP configuration when the infrastructure
changes.
Hamming
Distance
Hamming distance is a metric for comparing two
binary data strings.
To design a code that can detect d single bit errors, the minimum Hamming distance for
the set of codewords must be d + 1.