Skip to main content

About this free course

Download this course

Share this free course

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.

16.2 Adding hostnames and IP addresses

In this part we will configure hostnames and IP addresses on the routers to allow devices on the same LAN to communicate with each other. It is good practice to assign an identifiable hostname to a router to make it easier to check you are connected to the correct one when you are using the CLI.

Watch the video below, which is about 6 minutes long. In this video, the interfaces of router Branch-A and router Branch-B are configured and each router is assigned a hostname. The video shows some useful shortcuts when working in Packet Tracer, but unfortunately these do not work in PT Anywhere.

Configuring hostnames and addresses

Download this video clip.Video player: 84_configuring_hostnames_and_addresses.mp4
Copy this transcript to the clipboard
Print this transcript
Show transcript|Hide transcript
 
Interactive feature not available in single page view (see it in standard view).

When watching this video you may have wondered why a pair of IPv6 addresses were shown for each of the Branch-B router interfaces after the command show ip interface brief was issued. You probably recognised the second addresses in the pair as the ones configured for each router interface. The first address is an automatically assigned link-local address for the network segment. Link-local addresses were mentioned in Session 2. Such addresses are not intended for normal networking.

Activity 2 Test yourself

2 minutes

  • Why do you need to issue the no shutdown command on a router interface ?

  • Because, by default, interfaces on routers are switched off, whereas on switches they are on by default

  • The IPv6 address of G0/0 Branch-B router is given as 2001:DB8:FADE:FF::1. Explain the meaning of the double colon in this address.

  • An IPv6 address is usually written as eight blocks of four hexadecimal numbers, separated by a colon. A double colon indicates that one or more blocks in this position is the hexadecimal number 0000. In the example given, only five number blocks are shown; therefore there must be three 0000 blocks at the double colon.

Activity 3 Try it out

10 minutes

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. In this network only Branch-A’s router has been configured.

1. Check whether the configuration of Branch-A router’s interfaces agrees with the IP addresses given in the table below and make any corrections necessary.

DeviceInterfaceIP addressSubnet mask
Router Branch-AG0/0172.20.16.1255.255.2554.0
G0/1172.20.18.1255.255.255.0
G0/2172.20.31.254255.255.255.252

2. Configure Router Branch-B with the IPv6 addresses given below. Don’t forget to configure the router’s hostname as well.

DeviceInterfaceIPv6 addressSubnet mask
Router Branch-BG0/02001:DB8:FADE:FF::1/64
G0/12001:DB8:FADE:100::1/64
G0/22001:DB8:FFFF:FFFF::2/64

3. Check to confirm that Branch-B’s router has been correctly configured.

Answer

  1. To check Branch-A router’s interface configuration, you could use the show ip interface brief command, which can be used either in user exec mode or privilege exec mode. This would reveal an incorrect IP address for G0/0. You should have removed the incorrect IP address and then configured the interface with the correct IP address. Of course, you would also need to add the no shut command. Checking that the subnet masks are correct would require the use of the show ip interface command, which can also be used either in user exec mode or privilege exec mode. The show ip interface command gives the subnet mask in slash notation (or CIDR notation).

  2. Because the Branch-B router uses IPv6 addresses, you need the command ipv6 address at the config-if prompt, followed by the appropriate IPv6 address and the subnet mask in CIDR notation. To configure the host name you would use

    Router(config)# host Branch-B

  3. This time, because the Branch-B router uses IPv6, the appropriate command to check the configuration of the interfaces is show ipv6 interface brief, or show ipv6 interface.

Now watch the video below, which is about 2.5 minutes long. It shows the Central router being configured with both IPv4 and IPv6 addresses.

Configuring the Central router

Download this video clip.Video player: 85_configuring_the_central_router.mp4
Copy this transcript to the clipboard
Print this transcript
Show transcript|Hide transcript
 
Interactive feature not available in single page view (see it in standard view).

Activity 4 Think about

3 minutes

The result of issuing the command show ip interface brief for a router that uses both IPv4 and IPv6 addresses is shown below.

Router#sh ip in br

Interface IP-Address OK? Method Status Protocol

GigabitEthernet0/0 168.30.10.1 Yes manual up up

GigabitEthernet0/1 unassigned YES unset up up

GigabitEthernet0/2 168.30.20.1 Yes manual up up

Vlan1 unassigned Yes unset administratively down down

Select the correct statement(s) from the list below.

a. 

No IP address has been assigned to interface G0/1.


b. 

Interfaces G0/0 and G0/2 only use IPv4 addresses.


c. 

Interface G0/1 is the only interface that could use an IPv6 address.


d. 

It is possible that all three interfaces have an IPv6 address assigned to them.


The correct answer is d.

d. 

Correct. An interface can have both an IPv4 and an IPv6 address assigned to it.


Activity 5 Try it out

5 minutes

Open PT Anywhere in a new tab or window so you can read these instructions. In this network both Router Branch-A and Router Branch-B have been configured.

1. Configure the Central router with the IPv4 and IPv6 addresses given below. Don’t forget to configure the router’s hostname as well.

DeviceInterfaceIPv4 addressSubnet mask
Router CentralG0/0172.20.31.253255.255.255.252
G0/1172.20.32.1255.255/255/0
DeviceInterfaceIPv6 addressSubnet mask
Router CentralG0/12001:DB8:FADE:1000::1/64
G0/22001:DB8:FFFF:FFFF::1/64

2. Use the correct commands to check that the router’s interfaces have been correctly configured.

Answer

  1. At the (config-if)# command the correct command to configure IPv4 addresses is ip address followed by the appropriate IPv4 address and subnet mask. At the (config-if)# command the correct command to configure IPv6 addresses is ipv6 address followed by the appropriate IPv6 address and subnet mask in CIDR notation.
  2. The commands to check the correct interface configuration are show ip interface brief and show ipv6 interface brief. You need to be in either user exec or privilege exec mode to enter these commands. The results should look something like the following (although your link-local addresses, which are the ones beginning with FE80, might be different):

Central#show ip int br

Interface IP-Address OK? Method Status Protocol

GigabitEthernet0/0 172.20.31.253 YES manual up up

GigabitEthernet0/1 unassigned YES unset down down

GigabitEthernet0/2 172.20.32.1 YES manual up up

Vlanl unassigned YES unset administratively down down

Central#show ipv6 int br

GigabitEthernet0/0 [up/up]

GigabitEthernet0/1 [up/up]

FE80::2D0:58FF:FEE6:DD02

2001:DB8:FFFF:FFFF::1

GigabitEthernet0/2 [up/up]

FE80::2D0:58FF:FEE6:DD03

2001:DB8:FADE:1000::1

Vlanl [administratively down/down]

Central#

Now watch the video below, which is about 2 minutes long. It shows the PCs being configured with their IP addresses

Configuring the PCs

Download this video clip.Video player: 86_configuring_the_pcs.mp4
Copy this transcript to the clipboard
Print this transcript
Show transcript|Hide transcript
 
Interactive feature not available in single page view (see it in standard view).

Note that at the end of the above video the speaker says ‘… and an A record has been created for contoso.com for testing purposes’. An A record on a domain name server (DNS) links a domain name such as open.ac.uk to an IP address. When you type the URL into a browser, an A record at the DNS enables your computer to be informed of the IP address of the web page you wish to consult.

Activity 6 Think about

2 minutes

The video showed that when an IPv6 address is configured, the subnet mask has to given in CIDR – for example as /64. Why is this more sensible than using dotted decimal form for the subnet mask?

Answer

The slash notation is much simpler than the dotted decimal, and therefore less likely to be a source of error when it is keyed into the settings or written down. With IPv4, the dotted decimal notation is not too complicated, but in IPv6 it is horrendous. This is because IPv6 address consists of 128 bits arranged in eight groups of four hexadecimal digits. Each group of four hexadecimal digits represents 128 bits ÷ 8 = 32 bits. That is as many bits as an entire IPv4 address has. So, if the first 32 bits of an IPv6 subnet mask were all 1s, to show that this part of the address was in the network part of the address, the dotted decimal number in the subnet mask would be 4,294,967,295; and that would just be one-eighth of the subnet mask!

It would be less complicated to represent the subnet mask as a series of hexadecimal numbers, like the address itself. In that case, if the first 32 bits of an IPv6 subnet mask were all 1s then they would be represented as FFFF, which is not so bad, but it is still only one-eighth of the complete mask. The slash notation is much simpler.