MUDULI ACADEMY ROUTING ALGORITHM: The main function of network layer is to route the packets from the source machine to the destination machine. When the source and destination machines are not in the same network, routing is necessary. The major area of network layer design includes the algorithms which choose the shortest routes among all the available routes. So this algorithm is responsible for deciding the output line over which packet is to be sent. Optimality principle: Optimality principle states that the capability of routing algorithm to select the best route. Types of routing algorithm: Routing algorithm is divided into 2 types. These are 1. Non-Adaptive algorithm or static routing algorithm(dijkstra algo, bellman-ford algo) 2. Adaptive algorithm or dynamic routing algorithm(flood based, flow based, distance vector, link state routing, hierarchical routing) Adaptive algorithm: For these algorithms, the routing decision can be changed if there are any changes in topology or traffic. This is called as dynamic routing. Non adaptive algorithm: For this type of algorithm the routing decision is not based on the measurement or estimation of current traffic. So the route is selected depending on the router. This is called as static routing. Static routing algorithm: Dijkstra routing algorithm Bellman-ford routing algorithm MUDULI ACADEMY Dynamic routing algorithm: FLOODING: In this algorithm every incoming packets is sent out on every outgoing line except the one it arrived on. Flooding generates vast numbers of duplicate packets to prevent such types of circumstances we can use a hop counter in each packets. The hop counter contained in the header of each packet which is decremented at each hop with the packet being discarded when the counter reaches zero. The hop counter should be initialized to the length of the path form source to destination. If the sender doesn’t know how long the path is, the counter can be initialilzed to the worst case. FLOW BASED ROUTING: In flow based routing the path is to be selected based on the traffic, is called as flow based routing. Example: B A C E G F D H Here there is always a huge traffic from A TO B. then the traffic from A TO C should not be routed through B. instead route is through AGEFC even through it is a longer path than ABC. DISTANCE VECTOR ROUTING: Distance vector routing algorithm is also known as bellman-ford or ford Fulkerson algorithm In this algorithm, each router maintains a table called routing table/ vector. It gives best known distance to each destination. Periodically each router sends a vector to its neighboring routers as this vector contains estimated distances so it is called as distance vector. On receipt of such vector from its neighbors every router revises its estimates and updates its local routing table. MUDULI ACADEMY ( ( Distance vector routing table ) Initialization of distance vector routing table ) ( ) updating in distance vector routing table MUDULI ACADEMY LINK STATE ROUTING: In link state routing algorithm each router follows some algorithm i.e First discover its neighbor and their network address by sending special packets called hello packet. Estimate delay or cost or any other metric for reaching its neighbor by sending another special packet called echo packets. Distributing/send this packet to all other routers. Compute the shortest path to other routers. Destination A B C D E Link-cost 0 7 15 12 5 Next-hop A B B E B Hop count 1 1 2 2 1 HIERARCHICAL ROUTING: In this type of routing the total number of routers are divided into different regions . so it reduces the size of the router table. For any large network the hierarchy are Level1 ---------- regions Level2 ----------- clusters---it is a group of regions Level3 ------------ zones---zone is a group of clusters Level4 ------------ groups---group contains many zones. MUDULI ACADEMY Full routing table for 1A Hops 1B 1C 1B 1B 1B 1B 1C 1C Line 1 1 2 3 3 4 3 2 Hierarchical routing table for 1A Hops 1B 1C 1B 1C Line 1 1 2 2 MUDULI ACADEMY UNICAST ROUTING protocol: In unicast routing there is one source and one destination UNICAST ROUTING PROTOCOL: ROUTING PROTOCOL INTERIER PROTOCOL RIP OSPF EXTERIER PROTOCOL BGP INTERIER ROUTING: The routing inside an autonomous system is called an interior routing. Exterior routing: Routing between autonomous system is called as exterior routing. RIP: it is an interior routing protocol and is based on distnce vector routing. This protocol used inside an autonomous system. In this protocol the routing table is to be updated by an algorithm called bellman-ford algorithm. MUDULI ACADEMY OSPF: It is a interior routing protocol. To handle routing efficiency and in a timely manner OSPF divides an autonomous system into areas. An area is collection of networks,host and routers which are present with in an autonomous system. at the boarder of an area a special routers called area boarder routers which summarize the information about the area and send it to other area. among the area inside an autonomous system is a special area called the backbone.all the area inside on autonomous system must be connected to the backbone. so backbone are serves as primary area and other area acts as secondary area. The routers inside the backbone are called backbone routers. TYPES OF LINK: 1) Point –to-point link: In point to point connection two routers are connected directly.no other routers interfere in between them. MUDULI ACADEMY 2) Transient : It is a network where several routers are attached . 3) Stub link: It is a network where only one router is connected /attached. 4) Virtual link: When the path is broken between two router then administration create a path/link between that two router, is called as virtual link. BGP(Border gateway protocol): Border gateway provides an inter domain routing protocol using path vector routing. Exchange of routing information between two routers in BGP takes place in a session. A session is a connection that is established between two BGP routers. BROADCAST ROUTING: In this routing the host has to send packets to many or all other hosts. Sending packets to all destinations simultaneously is called as broadcasting.