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:
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:
In the above output, the help output shows the different kinds of interfaces that can be configured.
In the above output, notice that only a single slot number, zero, is available
The above output shows that there are two FastEthernet Interfaces that can be configured, zero and one.
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:
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:
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:
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:
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: