Web Science/Part1: Foundations of the web/Internet Protocol/IP forwarding algorithm

From Wikiversity
Jump to navigation Jump to search

IP forwarding algorithm

Learning goals

  1. review the definition and concept of an IP network
  2. understand that IP routing works on the level of IP networks
  3. understand the concept of subnetting
  4. review network classes and understand classless inter domain routing.



Internet Protocol Forwarding Algorithm

Let’s assume that you are connected to the Internet. You have a computer with IP Address and this computer is in the (you can identify this from the 1-st number of IP Address as it’s an A-class). There is special computer in this network – the router with IP Address This computer has 3 other network interfaces or network cards:
- (part of
- (part of
- (part of
We are interested in the – network. Because this network has another router – But as the first router it has other network devices which are connected to other networks. The network of particular interest is – network which is a C-class network. In this network is a destination computer you want to send data later –
Let’s see how we can forward data from to
What you need for this is IP routing and routing tables.
Wherever the package arrives at the router, the router needs to decide whether this package needs to stay at this network and be delivered to some host there or it has to be passed to the next network. In order to make this decision router maintains the routing table.
Let’s look at It also has a routing table because each device on the Internet has to have a routing table:

Destination network next hop interface eth0 eth0

The first entry says that the destination network is and the entry for the next hop is device’s IP address and interface is Ethernet eth0 that is a network card for this device. The other entry has the destination network that means that this is the default rout and the destination for the next hop will be It means that whatever package is sent that is not for network and what the computer will do is it will assemble an Ethernet frame that goes to These computers are in the same network so it’s obligatory to know the MAC Address of that computer ( But there is another protocol – the Address resolution protocol that resolves this problem. But then computer can assemble an Ethernet frame and use the MAC Address of and put it in the IP-package for other network that is supposed to be sent. All this will happen as the Internet protocol package inside the Ethernet package.
Lets’ have a look at another routing table. We have a and it has several network interfaces.

Destination network next hop interface eth0 eth1 eth2 eth3 eth3 eth3

Here we have the entrance for the next hop to each network and the interface to send out data (for the first 4 entries). But what we also have is the address of some other networks. So if we have a package and it comes from the anywhere to the – network, the routing table will say that the next stop will be IP Address. We can see that computer can maintain the table for almost all networks that exist that’s why we need hierarchical classfull network addresses and can make routing decisions to forward packages.
Let’s see an example.’s routing table:

Destination network next hop interface eth0 eth0

You have to send your package to So you do ARP request (Address Resolution Protocol) and the computer answers with it’s MAC Address. We assemble Ethernet frame and send it to that computer ( Inside this frame you put an IP package and there is the source IP Address and the destination IP Address inside and of course the data. The computer starts to read the IP header and sees that this package is supposed to be send to

Destination network next hop interface eth0 eth1 eth2 eth3 eth3 eth3

The computer looks inside his routing table and sees the entrance for So it forwards package to the next stop - The new Ethernet frame is assembled. The IP package doesn’t change but you exchange the Ethernet header. Again you forward package to the next computer.
The next computer device receives the package and the network device with the – network. So it already knows where to forward the package. It does the ARP request and the computer-destination can finally read the data.
--Jane Kruch (discusscontribs) 21:51, 2 November 2013 (UTC)


1 Read the following article on Classless Inter-Domain Routing. Which are valid entries in a routing table?

with CIDR without CIDR

2 CIDR is backward compatible

it depends on the size of the routing table
Only for entries in the routing table that go through class A and B networks

3 A network device from a class A network receives an IP package with the destination IP address in a class B network. Which of the following is true?

The package will be send back to the source since no routing from class A to class B networks is possible
The package will be dropped since no routing from class A to class B networks is possible
If a route to the network of the destination adress exists the package will be routed.
If no route to the destination network exists the package will be send to the default route.
If the package cannot be routed there will be a forwarding error message send to the source.

4 An IP package is sent from host A to Z. It is being routed via B, C and D. Now network D cannot forward the package. Which of the following is true?

There will be an error send back to A. The route will be exactly via C and B.
There will be an error send back to A. The route is not quite clear.
A will certainly receive an error message that the package could not be forwarded.