1. Link State Routing is a different DVR as in link-state routing each node has information about the entire topology of its domain.
2. It means each node knows how other nodes are connected, what is the cost metric and so on.
3. You can understand it like, everyone in the city has the same map but to reach the same destinations they take a different route.
4.  Dijkstra Alorotham is used to make the routing table.
5. Flooding is used here to send information.

Because of flooding:

The shortest path is guaranteed.

Flooding of LSPs After a node has prepared an LSP, it must be disseminated to all other nodes, not only to its neighbors. The process is called flooding and based on the following:

1. The creating node sends a copy of the LSP out of each interface.

2. A node that receives an LSP(link-state packet) compares it with the copy it may already have. If the newly arrived LSP is older than the one it has (found by checking the sequence number), it discards the LSP. If it is newer, the node does the following:

• a. It discards the old LSP and keeps the new one.
• b. It sends a copy of it out of each interface except the one from which the packet arrived. This guarantees that flooding stops somewhere in the domain (where a node has only one interface).

Difference between DVR and LSR

 Distance Vector Routing Link State Routing 1. Local knowledge 1.Global knowledge. 2. Bandwidth requirement is less 2. High Bandwidth is required. 3. Bellman  ford 3.Dijkstra Algorithm. 4. Traffic is less 4. Because of flooding traffic is high. 5.Converges slowly 5. Converges fast 6. RIP is protocol 6. Open Shortest Path First(OSPF) is protocol 7. Count to infinity problem is heer 7. No count to Infinity. 8. Persistence loops. 8.Transient loops. 9. Converges slow. 9. Converges fast.

##### Problem with Distance Vector Routing(DVR)

In real life blindly listening to your neighbor sometimes creates problems. You don't know there, who is telling truth or false. Same things happen here in DVR,

Count to Infinity Problem:

for simplicity, we are taking only three nodes.

A knows how to reach X so it will update its entry for X in its routing table but B does not know. so with the help of A, it will update it's the entry for X , that's why at third column of B we have mentioned A because A is helping B to reach X,

After some time link between A and X is broken, So path from A to X is not known and hence A will update ∞ .

If A sends its updated value to B then there will be no problem but what if B sends its Distance vector to B. Then A will think that B knows some way to reach X so it will replace ∞ with 16 and third column entry will be B because B is helping A.

But this is wrong because there is no path exists between A and X but they are hypothetically creating paths. Based on the triggered update strategy, A sends its new update to B. Now B thinks that something has been changed around A and updates its routing table. The cost of reaching X increases gradually until it reaches infinity. At this moment, both A and B know that X cannot be reached.

Solutions to this problem :

1. Redefining Infinity:

Define infinity value to some lesser value like 100 but if you define infinity to n then at most n-1 hops can be present.

2. Split Horizon:

Don't take help from that person to whom you are helping. If A hadn't take help from B there will be no issue there.

In our scenerio, B knows that the only way to reach X is through A so B shouldn't send it helps to A. now if A didn't get help from B it, entry regarding X will remain ∞ and in second round A sends ∞ to B and B will update ∞ .

RIP implements DVR and in RIP infinity is defined to 16. So at most 15 hopes can be present.

##### Distance Vector Routing

Distance Vector Routing(DVR):-

1. In DVR, each node has information about itself and its neighbor nodes and it does what it neighbor says. Although it does know how many total nodes are present in the network.
2. Neighbor means nodes which are directly connected through it.
3. With the help of information provided by neighbors, it updates routing entry for other nodes.
4. Each node created its own routing table and entries are the shortest distance from one node to another and the node that helps to reach the destination node.
5. In distance vector routing, each node shares its routing table with its
immediate neighbors periodically and when there is a change.
6. The Routing Information Protocol (RIP) implements Distance Vector Routing.

Implementing DVR:-

1. The whole idea of DVR is sharing the information to all neighbors and do what your neighbors say.
2. Each node shares its distance vector to its neighbor. A distance vector is two column entry.
3. let us say there is a node X which don't know about some node Z and entry corresponding to Z in X's routing table will be ∞  but neighbors of  X which are let's say P, Q, R knows about Z So X will fill entry for Z with the following method:

represent  path

represent edge

Problems With DVR:

1. Persistent looping Problem

2. Count to infinity problem.

##### Routing Algorithm

Routing:

How a router sends a packet?

How a router knows which is the best path.

• Routing is all about making routing table.
• Routing helps in making switching better.

Forwarding refers to the way a packet is delivered to the next station. Routing refers to the way routing tables are created to help in forwarding.

There are two types of routing table:

1. Static Routing table
2. Dynamic routing table

1. Static :

It is entered manually by the network administrator. Static means any change in the route is not updated automatically. Only the administration has the right to mention the table.

This strategy is useful in small internet where changes are very less frequent.

2. Dynamic:-

In this strategy, the table is updated dynamically with the help of a very dynamic routing protocol like  RIP or OSPF.

Now we will discuss types of routing protocols.

Interior gateway Protocol is also called as Intradomain Protocols.

Exterior Gateway Protocol is also called as Interdomain Protocols.

##### Virtual Circuiting

Virtual Circuiting:-

1. It is implemented in the data link layer.
2. Basically, it is a combination of Circuit Switching and Datagram Model.
3. It is connection-oriented.
4. You can understand it as climbing the mountain, the first person is holding the rope and others are following it. It means the first packet is going to reserve all the necessary resources and others packet will use these resources.
5. Here, out of order packets is not possible. Inorder is maintained.

Two types of address are involved here:

##### Packet Switching and Datagram .
1. In packet switching, there is no reservation of resources like bandwidth for packets. Resources are allocated on demand. Allocation of resources is based on first come first serve basis.
2. Because of no reservation policy, some time datagrams of same packets may arrive at a different time at the destination.
3. It is a store and forward network. Here, no setup time is involved.

Total time = X(transmission time + propagation delay)

X= number of switches or routers. At network layers, switches are generally referred as routers.

1. Datagram Network:

• Datagrams of same packets are treated as independent packets.
• Data gram switching is normally done at the network layer.
• Datagram networks are connectionless network.
• Each datagram moves independently. It means they can take different paths and can arrive at the destination at a different time.
• Each datagram contains a header.
• The destination address in datagram remains the same during the entire journey of the datagram.

Efficiency:-

The efficiency of the datagram is better than circuit switching. If a source sends some packets and there is some delay of a few minutes, other sources can use that resource to sends packets.

Also, the resources are allocated when a packet is needed to send. So waiting time for other senders is reduced.

Delays:

Delays in the datagram are higher than circuit switching as a packet may experience some wait during forwarding at switches.

• less reliable.
• Out of order is possible.

##### Circuit Switching

Some key points about circuit switching:

1. It is implemented in the physical layer.
2. Before actual communications starts, all the resources are reserved.
3. There is no addressing involved during data trasfer.

The circuit-switched network requires three phases:

Connection setup, data transfer, and connection teardown.

1. Connection Setup:-

Before the two parties or multiple parties can communicate, a dedicated circuit (the combination of channels in links) needs to be established. It also involves the involvement of switches through which data is transferred.

It also involves an acknowledgment from the receiver saying that it is ready to accept data.

2. Data transfer phase:-

When the connection is set up two parties can transfer data.

3. Tear down Phase:-

When any of the party wants to stop communication, it can send a request to release the held resources.

Efficiency:-

Since resources are held until the data transfer is completed, this reduces the efficiency of the network. During this duration, the resources are unavailable for other devices.

Latency Involved:-

Total time can be calculated as

TT=  setup time + data transfer time + tear down time

data transfer time = transmission time +  N *(propagation time or delay)

here N= no of hops or switches involved.

2. No Reordering is done. Oredering is definite.

##### Switching Introduction

In a network, we know that multiple devices are present.  Switching is a way through which we can connect these devices and make one to one communication possible.

Switches are the devices that are capable of establishing temporary connections between two devices.

There are three types of Switching:-

1.  Circuit Switching
2.  Packet switching
3.  Message switching

Packets switching is further classified as Datagram switching and virtual switching