Discovering computer networks: hands on in the Open Networking Lab
Discovering computer networks: hands on in the Open Networking Lab

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

Free course

Discovering computer networks: hands on in the Open Networking Lab

12.2 How are routing decisions made?

In this section you will have a look at how a router makes its routing decisions, using the same demonstration network made in Packet Tracer as you used in the previous section, and running in simulation mode to show you what the packets are doing at each stage.

Watch the video below, which is about 4 minutes long.

How are routing decisions made?

Download this video clip.Video player: 68_how_are_routing_descisions_made.mp4
Skip transcript


In order to demonstrate how the router makes its routing decision, we will use the same demonstration network we have used in the previous demonstrations.

This time we will use a ping from PC0 to PC1. We will ignore what happens in the internet router at first, and just look at the decisions made by Router0. As the ICMP packet comes in from the internet router it will have the destination IP address of in its Internet layer header. The destination IP address in the packet is The routing table contains entries for the connected networks of, and also the network in which the packet came in from. Note that each connected network shows up twice, one with the code of C which is the network it is on, and one with the code of L – which is the exact IP address of the router’s port. Note also that there is an entry marked S* at the end of the list. We will come back to this in a moment.

Now, back to the routing decision. The router will look at the destination address of the packet, in this case, and compare this address with the addresses in the routing table. The router will try and match the address with the entries in the routing table. If it finds multiple matches it will choose the best match – the one with the most bits matched will be selected. In this case there is a match with the network, which is on GigabitEthernet0/0. The packet will now be sent out of this interface and on to the switch, which will then send it on to PC1. PC1 will then respond with an echo-reply, which will have the source address of itself, and the destination of, which was the source of the echo request in the first place. When Router0 receives this packet it will look for in its routing table. As you can see, there is no entry for any network in this routing table. If the router does not find any match, it should drop the packet completely. This would cause the ping to fail and is not a very desirable outcome. We could either fix this by putting static routes into the routing table for all networks we wish to reach, or we can put a default route into it. This default route would then direct any traffic for networks not in the routing table to a valid destination. This default route has already been put into the routing table and is the entry with the code of S* we mentioned earlier in this presentation. This S* entry will also be listed above the routing table as the gateway of last resort when you do a show ip route.

So, back to our ping packet. There is no match for in the routing table so the router will use the default route, which will send the packet out of GigabitEthernet0/2, which points towards the internet router. The ping will now continue on its journey to PC0. Now let’s have a quick look at the command prompt output which has happened while we were watching our ping packets going from the source to the destination and back. The first three ping packets have in fact failed, and the fourth one has succeeded. You should be able to guess why this happened. Think further back in this session to the ARP problem. The reason for the first failures is because the ARP process needed time to obtain all the MAC addresses for each section of the network – so PC0 needs to find the internet router’s MAC address, the internet router needs to find R0’s mac address, R0 needs to find PC1’s MAC address. This all takes time and means that some pings may be dropped. Remember we told you that these MAC addresses are cached for a period of time. This can be proved when you execute the ping again soon after. This time all four pings pass.

End transcript
Interactive feature not available in single page view (see it in standard view).

Activity 2 Test yourself

5 minutes

1. What component of the router’s system does the router use to decide which port to send the data packet out from?


(a) ARP table


(b) MAC address table


(c) Routing table


(d) Default gateway

The correct answer is c.

2. What does a router do with any packet it cannot find a destination network for in its routing table?


(a) Sends it out of all ports.


(b) Creates a new route.


(c) Returns the packet to the sender.


(d) Drops the packet.

The correct answer is d.


Correct. Routers should drop a packet if there is no matching destination network – unless there is a default static route set up.

3. Why do the first few ping packets fail when you ping an IP address you haven’t pinged recently?


(a) The layer 2 address (MAC address) is not present in the ARP table and must be looked up by the ARP process; this takes time, so the first few packets will fail.


(b) The router doesn’t know where to send the packet and takes too long to decide.


(c) The destination device is busy at the time.


(d) The router was switched off at the time.

The correct answer is a.

Activity 3 Try it out

10 minutes

1. Open PT Anywhere [Tip: hold Ctrl and click a link to open it in a new tab. (Hide tip)] in a new tab or window so you can read these instructions. A ‘spare’ PC is provided at the bottom for use in step 4 of this activity.

Investigate the network and enter the configuration settings into a copy of the table.

DeviceInterfaceIP addressSubnet maskDefault gateway

2. Check to see if there is a gateway of last resort set on each router. If there is, make a note of each one. (Hint: use the command show ip route.)

3. Ping PC1 from PC0. What happened?

4. Connect an additional PC (PC2) to the switch on the network and configure it with an appropriate IP address, subnet mask and default gateway. (Use the spare PC provided at the bottom for this.)

5. Ping PC0 from PC2. What happened?


1. On both routers the command show ip interface brief should have given you the IP address of each configured interface. (It will also have given you the status of the configured interfaces which should have been ‘up’). To check the IP addresses and default gateway for each of the PCs you can use the command ipconfig. This is what your table should have looked like.

DeviceInterfaceIP addressSubnet maskDefault gateway

2. To show the gateway of last resort of each router, you need to use the command show ip route. You should have discovered that for both routers, the gateway of last resort was g0/0.

3. When pinging PC1 from PC0 you may have found that the first two or three pings timed out. As you learned in this session, this is because the ARP process needs time to ascertain all MAC addresses for each section of the network.

4. A suitable IP address for PC2 would have been anything in the range to, but a logical choice would be

5. When pinging PC0 from PC2 you may again have found that the first two or three pings timed out for the reason given above.

Activity 4 Think about

2 minutes

As you learned in the video ‘How are routing decisions made?’, configuring a static route by setting a router’s gateway of last resort is one way of ensuring that a packet doesn’t get dropped when its destination address isn’t in a router’s routing table. This is how the network in Activity 3 was configured, with each router using the other one as its gateway of last resort. This isn’t an ideal solution though. Can you see why?


It is possible that a packet could arrive at the router with an IP address that neither router knew anything about. In this event, the packet could end up going backwards and forwards between the routers until it is eventually discarded as it reaches its maximum number of hops specified in its ‘time to live’.


Take your learning further

Making the decision to study can be a big step, which is why you'll want a trusted University. The Open University has 50 years’ experience delivering flexible learning and 170,000 students are studying with us right now. Take a look at all Open University courses.

If you are new to University-level study, we offer two introductory routes to our qualifications. You could either choose to start with an Access module, or a module which allows you to count your previous learning towards an Open University qualification. Read our guide on Where to take your learning next for more information.

Not ready for formal University study? Then browse over 1000 free courses on OpenLearn and sign up to our newsletter to hear about new free courses as they are released.

Every year, thousands of students decide to study with The Open University. With over 120 qualifications, we’ve got the right course for you.

Request an Open University prospectus371