Configuring a Cisco Router
When the hardware installation is complete and the Cisco router has the initial configuration, you can begin configuring the router for a specific internetwork. You must be familiar with the Cisco IOS command-line interface (CLI), its modes, and its operation before configuring more advanced features such as IP routing. The following sections describe how to implement a basic configuration for a Cisco router.
Cisco Router Configuration Modes
From privileged EXEC mode, you can enter global configuration mode, providing access to the specific router configuration modes. Figure 4-26 illustrates the different configuration modes and shows how to navigate them.
Figure 4-26 Navigating Configuration Modes
The first step in configuring a Cisco router is to use the setup utility. Setup allows you to create a basic initial configuration. For more complex and specific configurations, you can use the CLI to enter terminal configuration mode.
From the privileged EXEC mode, you can enter the global configuration mode with the configure terminal command. From the global configuration mode, you can access the specific configuration modes, which include the following:
- Interface: Supports commands that configure operations on a per-interface basis
- Subinterface: Supports commands that configure multiple virtual interfaces on a single physical interface
- Controller: Supports commands that configure controllers (for example, E1 and T1 controllers)
- Line: Supports commands that configure the operation of a terminal line; for example, the console or the vty ports
- Router: Supports commands that configure an IP routing protocol
If you enter the exit command, the router will back out one level, eventually logging out. In general, you can enter the exit command from one of the specific configuration modes to return to global configuration mode. Press Ctrl-Z to leave the configuration mode completely and return the router to the privileged EXEC mode. In terminal configuration mode, an incremental compiler is invoked. Each configuration command entered is parsed as soon as the Enter key is pressed.
If there are no syntax errors, the command is executed and stored in the running configuration, and it is effective immediately.
Commands that affect the entire router are called global commands. The hostname and enable password commands are examples of global commands.
Commands that point to or indicate a process or interface that will be configured are called major commands. When entered, major commands cause the CLI to enter a specific configuration mode. Major commands have no effect unless a subcommand that supplies the configuration entry is immediately entered. For example, the major command interface serial 0 has no effect unless it is followed by a subcommand that tells what is to be done to that interface.
The following are examples of some major commands and subcommands that go with them:
Router(config)# interface serial 0 (major command) Router(config-if)# shutdown (subcommand) Router(config-if)# line console 0 (major command) Router(config-line)# password cisco (subcommand) Router(config-line)# router rip (major command) Router(config-router)# network 1 0. 0. 0. 0 (subcommand)
Notice that entering a major command switches from one configuration mode to another. It is not necessary to return to the global configuration mode first before entering another configuration mode.
After you enter the commands to configure the router, you must save the running configuration to NVRAM with the copy running-config startup-config command. If the configuration is not saved to NVRAM and the router is reloaded, the configuration will be lost and the router will revert to the last configuration saved in NVRAM. Example 4-10 shows saving the configuration file to startup.
Example 4-10 Saving Configuration File
Router# Router# copy running- config startup- config Destination filename [startup-config]? Building configuration… Router#
Example 4-10 Saving Configuration File
Router# Router# copy running- config startup- config Destination filename [startup-config]? Building configuration… Router#
Configuring a Cisco Router from the CLI
The configuration mode of the CLI is used to configure the router name, password, and other console commands.
One of the first tasks in configuring a router is to name it. Naming the router helps you to better manage the network by enabling you to uniquely identify each router within the network. The name of the router is considered to be the host name and is the name displayed at the system prompt. If no name is configured, the default router name is Router. The router name is assigned in global configuration mode. In Example 4-11, the router name is set to RouterA.
Example 4-11 Assigning the Router Name
Router(config)# hostname RouterA RouterA(config)# RouterA(config)# banner motd # You have entered a secured system Authorized access only! #
You can configure a message-of-the-day (MOTD) banner to be displayed on all connected terminals. This banner is displayed at login and is useful for conveying messages, such as impending system shutdowns that might affect network users. When you enter the banner motd command, follow the command with one or more blank spaces and a delimiting character of any choice. In the example, the delimiting character is a pound sign (#). After entering the banner text, terminate the message with the same delimiting character.
You can also add a description to an interface to help remember specific information about that interface, such as the network serviced by that interface. This description is meant solely as a comment to help identify how the interface is being used. The description will appear in the output when the configuration information that exists in router memory is displayed, as well as in a show interfaces command display.
Other useful console-line commands include the exec-timeout command. In the following example, the exec-timeout command sets the timeout for the console EXEC session to 20 minutes and 30 seconds, which changes the session from the default timeout of 10 minutes. The logging synchronous console-line command is useful when console messages are being displayed while you are attempting to input EXEC or configuration commands. Instead of the console messages being interspersed with the input, the input is redisplayed on a single line at the end of each console message that “interrupts” the input. This makes reading the input and the messages much easier. Example 4-12 shows how to configure these console settings.
Example 4-12 Configuring Console Settings
RouterA(config)# line console 0 RouterA(config-line)# exec- timeout 20 30 RouterA(config-line)# logging synchronous
CAUTION Setting the exec-timeout settings too high can be a security risk.
Configuring Cisco Router Interfaces
The main function of a router is to forward packets from one network device to another. To do that, you must define the characteristics of the interfaces through which the packets are received and sent.
The router interface characteristics include, but are not limited to, the IP address of the interface, the data-link encapsulation method, media type, bandwidth, and clock rate. You can enable many features on a per-interface basis. Interface configuration-mode commands modify the operation of Ethernet, serial, and many other interface types. When you enter the interface command, you must define the interface type and number. The number is assigned to each interface based on the physical location of the interface hardware in the router and is used to identify each interface.
This identification is critical when there are multiple interfaces of the same type in a single router. Examples of an interface type and number are as follows:
Router(config)# interface serial 0 Router(config)# interface fa 0/0
An interface in a Cisco 2800 and 3800 Series Integrated Services Router, or other modular router, is specified by the physical slot in the router and port number on the module in that slot, as follows:
Router(config)# interface fa 1 /0
To quit the interface configuration mode, enter the exit command at the Router (config-if) # prompt.
To add a description to an interface configuration, use the description command in interface configuration mode. To remove the description, use the no description command.
The description will show up when using the show interface command.
You might want to disable an interface to perform hardware maintenance on a specific interface or segment of a network. You might also want to disable an interface if a problem exists on a specific segment of the network and you must isolate that segment from the rest of the network.
The shutdown subcommand administratively turns off an interface. To reinstate the interface, use the no shutdown subcommand. Example 4-13 shows the commands and output for these commands.
Example 4-13 Disabling and Enabling Serial Interfaces
RouterX# configure terminal RouterX(config)# interface serial 0 RouterX(config-if)# shutdown %LINK-5-CHANGED: Interface Serial0, changed state to administratively down %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down RouterX# configure terminal RouterX(config)# interface serial 0 RouterX(config-if)# no shutdown %LINK-3-UPDOWN: Interface Serial0, changed state to up %LINEPROTO-5-UPDOWN: Line Protocol on Interface Serial0, changed state to up
When an interface is first configured, unless in setup mode, you must administratively enable the interface before it can be used to transmit and receive packets. Use the no shutdown subcommand to allow the Cisco IOS Software to use the interface.
Configuring the Cisco Router IP Address
Each interface on a Cisco router must have its own IP address to uniquely identify it on the network. Figure 4-27 illustrates unique IP addresses for each network attached to the router.
Figure 4-27 Interface Addresses
To configure an interface on a Cisco router, follow these steps:
Step 1 Enter global configuration mode using the configure terminal command:
Router# configure terminal
Step 2 Identify the specific interface that requires an IP address by using the interface type slot/port command:
Router(config)# interface fa 0/0
Step 3 Set the IP address and subnet mask for the interface by using the ip address ip-address mask command:
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Step 4 Enable the interface to change the state from administratively down to up by using the no shutdown command:
Router(config-if)# no shutdown
Step 5 Exit configuration mode for the interface by using the exit command:
Router(config-if)# exit
Verifying the Interface Configuration
When you have completed the router interface configuration, you can verify the configuration by using the show interfaces command.
The show interfaces command displays the status and statistics of all network interfaces on the router. Alternatively, the status for a specific interface can be displayed by using the show interfaces type slot command. Example 4-14 shows common output for the show interfaces command.
Example 4-14 show interfaces Command Output
RouterA# show interfaces Ethernet0 is up, line protocol is up Hardware is Lance, address is 00e0.1e5d.ae2f (bia 00e0.1e5d.ae2f) Internet address is 10.1.1.11/24 MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, rely 255/255, load 1/255 Encapsulation ARPA, loopback not set, keepalive set (10 sec) ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:07, output 00:00:08, output hang never Last clearing of “show interface” counters never Queueing strategy: fifo Output queue 0/40, 0 drops; input queue 0/75, 0 drops 5 minute input rate 0 bits/sec, 0 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 81833 packets input, 27556491 bytes, 0 no buffer Received 42308 broadcasts, 0 runts, 0 giants, 0 throttles 1 input errors, 0 CRC, 0 frame, 0 overrun, 1 ignored, 0 abort 0 input packets with dribble condition detected 55794 packets output, 3929696 bytes, 0 underruns 0 output errors, 0 collisions, 1 interface resets 0 babbles, 0 late collision, 4 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out
Output fields for an Ethernet interface and their meanings are shown in Table 4-6.
Table 4-6 show interfaces Output Field Descriptions
One of the most important elements of the show interfaces command output is the display of the line and data-link protocol status. For other types of interfaces, the meanings of the status line can be slightly different. Figure 4-28 highlights the key output for this command.
Figure 4-28 Interface State
The first parameter refers to the hardware layer and essentially reflects whether the interface is receiving the carrier detect signal from the other end (the data communications equipment [DCE]). The second parameter refers to the data link layer and reflects whether the data link layer protocol keepalives are being received.
Based on the output of the show interfaces command, possible problems can be fixed as follows:
- If the interface is up and the line protocol is down, a problem exists. Some possible causes include the following:
- No keepalives
- Mismatch in encapsulation type
- If both the line protocol and the interface are down, a cable might never have been attached when the router was powered up, or some other interface problem must exist.
For example, in a back-to-back connection, the other end of the connection might be administratively down. - If the interface is administratively down, it has been manually disabled (the shutdown command has been issued) in the active configuration.
After configuring a serial interface, use the show interface serial command to verify the changes.