Sunteți pe pagina 1din 30

Advanced Networks CC531

Week 08 Routing

Introduction Forwarding Routing Handling Routing Table Routing Table Entry Addition and Removal Routing Vector Protocols (RVP)

Introduction
IP routing and IP forwarding are two processes that are at the very foundation of the Internet.
Every system with TCP/IP protocol installed has at least one network interface called loopback. Besides, it can have one or more network interface cards installed. If a station received one link frame, carrying an IP datagram, how it will be processed?
3

1. 2.

The IP datagram is extracted from the link frame. The sender's link address can be used to refresh the ARP cache. The extracted IP datagram is inserted into an input queue and waits here for its processing.

3.

Processing of the header options is the first step within the processing. First, the options 'Loose source routing' and 'Strict source routing' are processed. If the IP datagram belongs (according to the content of the source routing options) to another receiver, it is passed on for forwarding.
Next, if the IP datagram belongs to this station, if not, it is also passed on for forwarding.

4.

5.

Now, if the datagram is an ICMP datagram. If so, it is processed and the answer, if any, is passed on for routing back (step number 7) At this point, all the duties of the IP layer are fulfilled, and the IP datagram is passed on to the higher TCP/UDP layers. They will extract either the TCP segment or the UDP datagram from IP datagram and process it. All the outgoing IP datagrams and IP datagrams that should be forwarded are processed in the routing system first. The goal of routing is to find out to which network interface the IP datagram should be given for forwarding. To be able to make such a decision the routing system has routing tables at its disposal.

6.

7.

8.

The routing system must know if the sent IP datagram is a broadcast addressed to this station; if so, then a copy must be also given to the loopback interface. 6

9. If the sent IP datagram is either a broadcast or a multicast, skip step 10. 10. Before the IP datagram is wrapped into a link frame, the station makes sure if the IP datagram is addressed to it, if so, it is passed on to the loopback interface. 11. If the IP datagram is either broadcast or multicast, direct mapping of the IP address to a link address is done. The IP datagram is put into a link frame and sent. 12. If it is a unicast, the IP datagram is wrapped into a link frame using the ARP protocol and sent.
7

Why do we need a loopback? Whenever an interface finds out that an IP datagram should be forwarded back to the input, it is instead forwarded to the program loop, which takes care of the operation.

127.0.0.1 What Are its Uses and Why is it Important? It is the loopback Internet protocol (IP) address also referred to as the localhost. The address is used to establish an IP connection to the same machine or computer being used by the end-user. The loopback construct gives a computer or device capable of networking the capability to validate or establish the IP stack on the machine.
9

Forwarding
Forwarding enables the use of a station as a router.
When a station finds out that an IP datagram is not addressed to it, it tries to forward it, i.e., send it in the same way as it sends its own IP datagrams.

10

Routing
A router uses a routing table (a parallel to a sorting table in a post office) to make its decision. For example, the routing table of the entire router is as follows:

11

Provided that the lines of the routing table are arranged in descending order, the sorting table can be processed from the top to the bottom The first column of the routing table states the IP address of the destination network. A network mask is taken from every line and the IP address of the IP datagram's destination is multiplied with it bit by bit

The result is compared with the first column.


If the result is not identical with the IP network address in the first column, the following line is processed. If the result is identical with the IP address in the first column, the next line is checked for another pathway to the destination address (then the metric would play a role).
12

For example, The router is deciding to which of its network interfaces the IP datagram with the IP address 10.5.2.1 is to be sent. Multiplying the target address 10.5.2.1 with the mask 255.255.255.0
we obtain the result 10.5.2.0, which is not identical with the network IP address in the first column (the address is 192.168.1.0) Because no match was found the next line is processed.
13

The same thing will happen to the next two lines

14

By multiplying bit by bit the target address 10.5.2.1 with the mask 255.255.0.0 we obtain the result 10.5.0.0
It is identical with the network IP address in the first column (the address is 10.5.0.0). The IP datagram will, therefore, be sent to Serial 1 and delivered to a router with the IP address 10.5.5.5. If it was an Ethernet interface instead of a seriallink, then the link address of a router with the IP address 10.5.5.5 would have to be found via ARP protocol.
15

Handling Routing Table


A routing table has to be filled up with individual entries.
The static entries stay in the routing table until they are removed or the system is switched off. The dynamic entries fed into routing tables by application protocols have their lifespan monitored and are removed after its expiration.
16

The netstat r command lists the contents of a routing table in ascending order, i.e., the routing table has to be processed from the bottom to the top.

17

Routing Table Entry Addition and Removal


The routing table entries are set:
During the configuration of a network interface, when defining the address and network mask of the interface. Statically (manually) using the route command. Dynamically from
redirect ICMP announcements. routing protocols.
18

The route command The syntax is explained as follows: -f: This clears the contents of a routing table first.

-p: This makes a route persistent even after rebooting the system when used with the ADD command. By default, routes are not preserved when the system is rebooted. If it is followed by the PRINT command, it lists the permanent entries.

19

command: This indicates a command for processing the routing table; it can have the following values:
PRINT: Lists the contents of the routing table. T ADD: Adds an entry to the routing table. DELETE: Deletes an entry from the routing table. CHANGE: Modifies an entry.

destination: This specifies the target network. netmask: This specifies the network mask. gateway: This specifies the next hop. METRIC: This specifies the metric. An example: route p add 10.0.0.32 mask 255.255.255.240 192.168.1.2

20

Routing Protocols Routing protocols are application protocols used not by users, but by routers to fill their routing tables automatically There are two independent divisions of routing protocols:
Link State Protocols(LSP) and Routing Vector Protocols(RVP) divide routing protocols from algorithm point of view. Interior Gateway Protocols(IGP) and Exterior Gateway Protocols(EGP) divide routing protocols from organizational point of view. IGP is suitable for routing inside an autonomous system and EGP for exchanging routing information between autonomous systems.

21

Routing Vector Protocols (RVP)


RVP is based on exchange of the contents of neighboring routers' routing tables. A vector is one entry in a routing table (vector size is a metric or cost). If we obtain the individual vectors from a neighbor's routing table, we can compile the vectors that are missing from the routing table and add them into it. However, we must not forget to increase the metric of such added entries.

The most often used routing protocols are RIP and RIP2. Their metric is the number of hops.

22

If all routers are turned on at the same moment.

Routers only have routes created according to their own configuration in their routing tables,

23

Neighboring routers mutually exchange their routing tables. If a router receives a routing table from its neighbor
it first adds 1 to the metrics of all routes. Then the router takes one item from the obtained routing table after another and tests if the same item is present in its own routing table.
If it does not find a match, the router adds this new item into its routing table. If the same route is found, the router compares metrics of the two matching ones. Then, it writes the route with the lower metric into its routing table. In our case, the networks with the metric 2 are inserted.

24

25

the neighboring routers exchange their routing tables again In our case the networks with the metric 3 are inserted.
26

27

Within the fourth step, the last one in our case, the networks with the metric 4 are inserted.
all our routers have already completed routing tables. Because the network topology can change, routers do not store the dynamically created routing information into their tables permanently, but only for a short time according to a concrete routing protocol).
28

This algorithm is called a vector-distance algorithm or a Bellman-Ford algorithm. Particular Implementations using this algorithm are called protocols of the Routing Vector Protocol(RVP) type.

29

References
Libor Dostalek, Alena Kabelova,Understanding TCP/IP a clear and comprehensive guide to TCP/IP protocols, Packet publishing 2006

30

S-ar putea să vă placă și