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

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
Skip transcript

Transcript

Now we can start configuring the devices. We can see both networks connected to Branch A’s router will be configured with IPv4 addresses, and the two networks connected to Branch B’s router will be configured with IPv6 addresses.

Let’s start by configuring the IP addresses on Branch A’s router. To do this we need to click the router and select the CLI tab. Here if we are asked if we want to go through the first-time set-up wizard we will answer ‘no’.

If we press Return we will be in user exec mode. We can type enable to enter privilege exec mode indicated by the hash symbol. Now we can get into global configuration by typing configure terminal, or conf tfor short.

The first thing I will do is configure the hostname to reduce confusion later. We can do this by typing hostname Branch-A. We can see that the router prompt changes to ‘Branch-A’. Now we need to configure the interfaces of the router with IP addresses and then turn them on.

From global configuration, the command interface gigabit 0/0 will take us into the sub-configuration mode for that interface. Within this mode, we can set an IP address for the interface by typing ip address 172.20.16.1. We also need to specify the subnet mask, in this case a /23 subnet mask, the decimal equivalent of which is 255.255.254.0. The interfaces on routers by default are turned off, because they need to be configured first, so we need to turn this interface on. The command is no shutdown. Generally the opposite of any command in Cisco is preceded with no. As we type no shutwe will receive a notification message stating that the interface has come up. This means the interface is now functional.

As you become familiar with using the command-line interface you will learn a number of shortcuts to make your use of time more efficient. A number of shortcuts I use in this session include: tab to complete a command, up and down arrows to scroll through the history of commands, Ctrl+A to skip to the front of a command and Ctrl+E to skip to the end of a command. For example, instead of retyping all of those commands again to configure G0/1, we can use the up arrow and just edit the commands instead. Now we can configure gigabit Ethernet 0/1. If we use the up arrow we can get the IP address and just edit it to save some time and then move on to gigabit 0/2. Up arrow again; change the IP address and subnet mask. I forgot to turn gigabit Ethernet 0/1 on so we can just go back into 0/1 and issue no shutand then go back to 0/2 and do no shutagain. Now all the interfaces are configured for Branch-A.

We can check Branch-A’s IP configuration by using the showcommand show ip interface brief. This will show us the IP addresses and the state of the interface. We can see that all the interfaces that have been configured have the right IP addresses and the status is up, up, meaning the interface is configured correctly.

We can now move on to Branch-B. We answer no, type enable, configure terminal. We can set the hostname to host Branch-B. Go into interface G0/0. This is where the configuration changes slightly. To configure an IPv6 address, you must use ipv6 address and then the address followed by the subnet mask in CIDR notation. Note there is no space between the IP address and the subnet mask.

Now we can continue the configuration as before. First no shut to turn that interface on. Interface G0/1. IPv6 address 2001:DB8:FADE:100::1/64 no shut. Interface gigabit Ethernet 0/2. Set the IPv6 address. Oh, I made a typo. Not to worry: we can just remove the IP address and add the correct one. To do this use the up arrow, then to get to the start of the line you can use Ctrl+A. Then we can insert no and hit Return. This will remove the incorrect IP address. And now we can add the correct IP address 2001:DB8:FFFF:FFFF::2/64 no shut.

That completes Branch-B’s IP addressing.

We can check Branch-B’s IP configuration with show ip interface brief. You can see that there are no IPv4 addresses listed and they are all unassigned. That is because Branch-B is only using IPv6. The showcommand to see the IPv6 address configuration is show ipv6 show interface briefwhere we can see the address is configured and the status of the interface. We can see that all three interfaces have the correct IPs and are up, up meaning they are working.

End 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
Skip transcript

Transcript

Now we can quickly configure the Central router. Open the command line. Answer no to the auto-configuration wizard. Type enable. Type configure terminal. Set the hostname to ‘Central’. Enter interface gigabit ethernet 0/0. Set an IPv4 address of 172.20.31.253 with a subnet mask of 255.255.255.252. Turn the interface on with no shut. Go to interface G0/1. Add its IPv6 address 2001:DB8:FFFF:FFFF::1/64. Turn the interface on with no shut.

Go to gigabit Ethernet 0/2 and this is where the configuration changes. On the Central router we have to configure both IPv4 and IPv6 addresses on the same interface to allow connection to the DNS server. So first we can set the IPv4 address, IP address 172.20.32.1 255.255.255.0 and then we can set the IPv6 address 2001:DB8:FADE:1000::1/64. And then turn the interface on. That completes the IP addressing of the Central router.

We can check the IP configuration of the Central router with show ip interface brief. As you can see, G0/0 and 0/2 both have IP addresses and they are up. We also need to check the IPv6 configuration show ipv6 interface brief. You can see that G0/1 and 2 are both configured and up.

End 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
Skip transcript

Transcript

Now we can configure the IP addresses on the PCs.

Click the PC, select the ‘Desktop’ tab, and then select the ‘IP Configuration’ option. Within this window we can configure both IPv4 and 6 addresses. We are configuring PC-A1 so the IP address is 172.20.16.10 and the subnet mask is 255.255.254.0. The default gateway is the IP address of the local router, 172.20.16.1 and for testing later I will set a DNS server address of 172.20.32.10.

I will now move to PC-B1 to demonstrate configuring a IPv6 address on a PC. It is very similar. Go to the ‘IP Configuration’ of the PC, but in the lower section of the window you add the IPv6 details instead. So for PC-B1 the IPv6 address is 2001:DB8:FADE:FF::10 with a mask of /64. The IPv6 gateway will be 2001:DB8:FADE:FF::1 and the DNS server will be 2001:DB8:FADE:1000:10.

These two configurations will need to be repeated on PC-A2 and PC-B2 with the appropriate addresses to complete the IP configuration of all the devices. In the background, the DNS server has been configured with its IPv4 and IPv6 address and an A record has been created for contoso.com for testing purposes in a later section.

End 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.

OPNL_1

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, find out more about the types of qualifications we offer, including our entry level Access courses and Certificates.

Not ready for University study then browse over 900 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 prospectus