While configuring interfaces of a switch are covered in Chapter 6, configuring the interfaces of a router is one of the basic things that you should know before forging further ahead. This is because unless the router is connected to the network, there isn’t much it can do. Configuring the interfaces is easy and usually consists of only two steps. But before proceeding, you need to understand the interfaces and their numbering.

You will remember from earlier in the chapter that the number and type of interfaces are shown during the boot up.  While there are many different types of interfaces that can be present in a router, the three types that you will encounter in the CCNA exam are Ethernet, FastEthernet and Serial. Some of these interfaces are built into the device while some are added as modules in available slots. The built-in devices are said to be in slot zero; while module go into slot numbers starting from 1. Depending on the router the interfaces can be numbered simply as type number or type slot/number or in some high-end routers as type router/slot/number. Router, slot and number are numerical and start from 0. Some examples are:

Ethernet0 (this is the first built-in Ethernet interface)
Fastethernet0/0 (this is the first built-in FastEthernet interface)
Serial1/1 (this is the second serial interface of the first module)
Serial0/2/5 (this is the 6th serial interface of the 2 module of the first router)

Knowing the correct interface numbering is important because you need to know which interface to configure. Consider a situation where the Ethernet cable is plugged into the second interface of the second module while you configure the first interface of the first module! The question mark on the CLI can be of help in figuring out the numbering format when using the interface command in the global config mode. Take look at how the question mark helps in figuring out the format:

myRouter(config)#interface ?
Async              Async interface
BVI                Bridge-Group Virtual Interface
CDMA-Ix            CDMA Ix interface
CTunnel            CTunnel interface
Dialer             Dialer interface
FastEthernet       FastEthernet IEEE 802.3
Group-Async        Async Group interface
Lex                Lex interface
Loopback           Loopback interface
MFR                Multilink Frame Relay bundle interface
Multilink          Multilink-group interface
Null               Null interface
Tunnel             Tunnel interface
Vif                PGM Multicast Host interface
Virtual-PPP        Virtual PPP interface
Virtual-Template   Virtual Template interface
Virtual-TokenRing  Virtual TokenRing
range              interface range command

In the above output, the help output shows the different kinds of interfaces that can be configured.

myRouter(config)#interface FastEthernet ?
<0-0>  FastEthernet interface number

In the above output, notice that only a single slot number, zero, is available


myRouter(config)#interface FastEthernet 0?
/

myRouter(config)#interface FastEthernet 0/?
<0-1>  FastEthernet interface number

The above output shows that there are two FastEthernet Interfaces that can be configured, zero and one.


myRouter(config)#interface FastEthernet 0/0 ?
<cr>

myRouter(config)#interface FastEthernet 0/0
myRouter(config-if)#

In the final output, the first built-in FastEthernet interface was selected. Once in the interface configuration mode (prompt changes to config-if), you can configure various parameters of the interface such as IP address, speed, duplex and in case of Serial Interfaces, protocols. For now, you will learn to configure an IP address and to enable the interface.

To configure an IP address, use the ip address command in the interface configuration mode. The command expects the IP address followed by a subnet mask as an argument as shown in the example below:

myRouter(config-if)#ip address 192.168.1.1 255.255.255.0

By default, all interfaces are in an administratively down status. What this means is, that all interfaces have the command shutdown applied to them by default and will not connect to the network unless they are brought up using the no shutdown command as shown below:

myRouter(config-if)#no shutdown

After this command is given, the router will bring up the interface and assume the IP Address you configured and will effectively be connected to the network on that interface. You can quickly verify connectivity at this stage using the ping and traceroute command from the privileged exec mode as shown below:


myRouter#ping 192.168.1.10

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

myRouter#traceroute 192.168.40.1

Type escape sequence to abort.
Tracing the route to 192.168.1.10

1 192.168.1.10 8 msec 4 msec 0 msec

While you already know about the ping command, the traceroute command might be new to you. The traceroute command uses the TTL field in the IP header to discover layer 3 devices between your device and a given host in the internetwork. Here the ping output shows that 192.168.1.10 is reachable from the router and traceroute command shows that it is the next hop device. Both of these outputs confirm that the router now has network connectivity and is able to function properly at all layers.

While FastEthernet interfaces usually required just the IP address and subnet mask, the serial interface might require some more configurations. However, that is discussed in detail in Chapter 11.

Certain poor network designs may require you to have a second IP address on an interface. While this is very inefficient, if you do run into a need to configure this, you will need to use the secondary keyword at the end of the ip address command. If you do not use the secondary keyword, the new one will replace the configured IP address on the interface. An example of adding a secondary IP address is shown below:

 myRouter(config-if)#ip address 192.168.10.40 255.255.255.0 secondary

The secondary IP address can belong to the same subnet as the primary address or a different one.

Another optional command that you can use in interface configuration mode is the description command. This command will add a description text for the interface in the configuration. While this is not necessary for operation of the interface, it can be useful to have a short description containing the purpose of the interface. Some routers and most switches can have a lot of interfaces and it can be very difficult to decipher what the interface connects to. So it is recommended that you make a habit of adding description to all interfaces as shown below:

Router(config-if)#description Connects to the main network