Exercise 3

Learning about computers on remote networks

To send packets from your computer on your local LAN (network 1) to computers that belong to other IP networks not directly connected to your LAN (e.g. a computer located on network 3 in the figure above) requires the use of an intermediate system (i.e. an IP router). Each network normally has a local (default) router which will be connected to the local LAN and also to another (remote) LAN.

The remote LAN will, in turn, be connected via other routers to more distant LANs. The use of many routers connected in series, one after another, allows you to send packets to any other IP network in the Internet Wide Area Network (WAN).

This exercise examines how an IP network sends IP packets to a remote network using the local router. It will start by ususing the right router in the figure (the default router for the computer's IP network).

Examine the computers attached to your local IP network using arp


arp -a

If the IP addresses are shown as names (e.g. fred.abdn.ac.uk), rather than numeric IP addresses (in dotted decimal notation) you should use the Domain Name Service (DNS) to find (resolve) the numeric address of a few of the names. The dns service may be accessed via a client program called nslookup by typing:

nslookup name

An alternative command that also allows you access the dns service, and get the same information is "dig".

Do you notice something in common about the network part of all the listed IP addresses?

All the IP addresses that were listed, should have the same IP network number as your own computer (i.e. start with the same first set of bits). This is how IP knows that the packets are to be sent directly to a computer connected to the LAN. It is also the way that IP determines that an IP packet is not destined for the local LAN, and thus requires a router to forward the packet to another LAN.

Using the local router

To proceed further, we will need to use your default router. This is the router for your computer's IP network (sometimes books refer to this confusingly as the gateway router). It is the router to which all non-local IP packets will be sent - and the path by which your computer communicates with all computers that are not directly connected to your local LAN.

We will also use a remote end system, that you know is not local to your site (e.g. choose your favourite web site, the microsoft web site, or something that you know is in another country). In this exercise, you will send packets directly to the ICMP echo server running on your chosen end system.

Verify that your computer is connected to the campus network.

Try to contact the ICMP server on the computer at your chosen web site (e.g. yahoo.com).


ping www.yahoo.com

Did you get a reply? You should have, this verifies that the site router is operating. We may now proceed. Now use the arp program to examine the contents of the arp cache for your own computer:


arp -a

One of the computers listed in the arp cache must be the default IP router. But how does your computer know which IP address corresponds to the default router for your IP network?

The answer is the person who set-up your computer has already configured this (or your computer discovered this, e.g. using DHCP).

You can find the address of the default router by typing netstat -rn (the options "r" indicates that the routing table should be printed and the option "n" indicates ip addresses should be printed in numeric (i.e., dotted decimal notation)).


netstat -rn

This lists the routing table in your computer. (Other information such as the MTU size of each interface may also be shown). Among other addresses there should be an entry here for the loop back interface that was used in exercise 1. There should also be an entry marked as "default", "default gateway", or sometimes just labelled "", this is the default router IP address. Note the address down (you will need it in a moment).

Which router is specified as the local (default) router?

Use ping (see exercise 1) to verify that the default router is working.

How does your computer know when to route the packet to the local router and when to use arp to find the hardware address of a computer connected to the local network?

Look at the figure above which shows a single IP network ( and two computers in this network.In this case the networks has a subnet netmask set to 0xffffff00 (or in dotted decimal notation). Note that the network part of the address is the same in both cases. Compare this to the figure below. In this second case, the two computers have addresses that differ in their network part. When a computer with an IP address of tries to communicate with one using the IP addresss, it can see that the network parts of the address are different. It therefore knows that the computer with address is not directly connected to the local IP network (

Each time an IP packet is sent, the sending computer must decide whether the destination is directly reachable using the local IP network (LAN) or whether the packet should be sent via the default router.) After making this decision, the computer sets the appropriate MAC destination address to ensure the packet is either directly delivered, or that it is sent to the default router. via an IP router. In this case the two networks are subnets of the network and the subnet netmask

Exercise 4 will now use this default router to contact some computers connected to remote parts of the Internet.




Gorry Fairhurst, - School of Engineering, University of Aberdeen, Scotland, UK.

email: G.Fairhurst(at)eng.abdn.ac.uk - Date: 10/11/1995 Revised: 7/10/2003