Is this your first time using a Cisco router? You've powered it up and have no idea what to do? There’s no GUI to guide you through the configuration of your router, and the help system is only as good as your best guess. What is the best route to take? You're looking at it! If you aren’t sure where to go from square one, you’re in luck. This handy little guide will walk you through the initial setup of a Cisco router, setting the clock, setting a host name, setting a default route, setting the IP address, and setting up telnet access.
Obviously, this is not meant to serve as a means to an end, but rather a means to a beginning. We'll get you in, get you around, and get you out.
Before we begin: A few basics
Before we begin editing and configuring some basic settings, let's take a look at how we move around the command line. Obviously, you’re going to rely on the keyboard for all of your actions. Therefore, you’ll want to begin thinking like what I like to call an average vi user. You’ll want to keep your fingers on the keyboard. To do this, you can use some simple key combinations (that are part of the default enhanced editing mode) to move around the command line. Some of the handiest combinations include:
- [Ctrl]B: Moves back one character at a time
- [Esc]B: Moves back one word at a time
- [Ctrl]A: Moves to the start of a line
- [Ctrl]F: Moves forward one character at a time
- [Esc]F: Moves forward one word at a time
- [Ctrl]E: Moves to the end of a line
- [Delete]: Erases the character to the left of the cursor
- [Backspace]: Erases the character to the left of the cursor
- [Ctrl]D: Deletes the character at the cursor
- [Ctrl]K: Deletes all characters from the cursor to the end of the line
- [Ctrl]U: Deletes all characters from the cursor to the beginning of the line
- [Ctrl]X: Deletes all characters from the cursor to the beginning of the line
- [Ctrl]W: Deletes the word to the left of the cursor
- [Esc]D: Deletes from the cursor to the end of a word
If you find that none of these commands work, enhanced editing may be turned off. To turn on enhanced editing, go to enhanced mode by typing enable and then type the command:
Press [Enter], and the key combinations shown above should work. If you'd like to turn off enhanced editing, you can do so with the following command (again in privileged mode):
terminal no editing
followed by pressing [Enter].
You will also want to know the difference between a standard prompt (user mode) and a privileged prompt (exec mode—also called the enable prompt). You can run some very limited commands from the standard prompt. You can’t do any configurations, but you can view many of the configurations. One of the first things you might want to do is familiarize yourself with the Cisco help system. By typing a question mark (?), you will get a listing of all available commands from your current prompt. The standard prompt looks like this:
The privileged mode (or enabled mode) allows you to do the configurations necessary for the Cisco router. For this mode, you will have to use the password you supplied (for enable secret) during the setup. To get to the enable mode, type enable (or just en) and press [Enter].
The privileged prompt looks like this:
In addition to the standard and privileged modes, you also have the configure mode, which is where configurations are done. To enter config mode, run the command (from privileged mode):
Your prompt will now look like this:
Setting up the router
When you get your router, you will probably first connect to it via console serial connection. This connection is made possible by an RJ-45-to-RJ-45 rollover cable (it's a light blue CAT5-ish cable), an RJ-45 to serial connector, and a PC equipped with HyperTerminal. To connect the rollover cable to the router, follow these steps:
- Locate the jack with the circled blue "console" label.
- Plug in the rollover cable.
- Attach the serial adapter to the other end of the cable.
- Plug the serial adapter into the designated PC.
Once all of the cables are connected, you need to set up HyperTerminal, which can be found (in Windows 2000) by selecting Programs | Accessories | Communication. When you first start HyperTerminal, you will have to configure it in order to connect to the router. To configure HyperTerminal, select File | Properties and you will see the Properties page shown in Figure A.
|In HyperTerminal, the Properties page allows you to choose the connection to configure.|
In our example, we are going to configure COM1, so we'll select COM1 from the Connect Using drop-down menu and then click Configure. The COM1 Properties page is shown in Figure B.
|The COM1 Properties page allows you to configure the Bits Per Second, Data Bits, Parity, Stop Bits, and Flow Control.|
In order to connect to your Cisco router, you will need to verify that the options are configured as they were in Figure A. Once you've verified the changes, click Connect, which is the left button shown in Figure C, and then press [Enter].
|The HyperTerminal button bar contains the Connect and Disconnect buttons.|
Now you will go through the initial router setup, which consists of answering a few simple questions. The first question you’ll be prompted to answer is Would You Like To Enter The Initial Configuration Dialogue? [Yes/No]? Type Yes, press [Enter], and you will proceed to the next question. The first four questions asked by the router setup are shown in Figure D.
|The initial setup of a Cisco router requires you to answer a few questions.|
Next, you’ll enter Basic Management setup, which is where you’ll configure your router’s host name, enable secret password (encrypted), enable password (plain text), and configure your virtual terminal password (for access via network connection). Some of these configurations are shown in Figure E.
|Three of the many password configurations are done within the Basic Management setup.|
Once you’re finished configuring passwords, you will be asked if you would like to configure Simple Network Management Protocol (SNMP), which is used to poll network devices to learn their status. After choosing whether to use SNMP, you will configure the interface that you will use to connect to the network. In our example, we chose FastEthernet0/0. (In Linux terms, this would be eth0.) After selecting the device, you are asked what connector you will be using. In our example, we connected the e0/0 device with a standard RJ-45 (and CAT5 patch cable), so we accepted the default choice, as shown in Figure F.
|After selecting the device, you’ll be prompted for the connector that you’ll use.|
After you have chosen the device, you’ll assign it an IP address, as shown in Figure G.
|Setting an IP address in a Cisco router is simple.|
After the IP address is provided, the router will run the no shut command, which will restart the interface. You’re now finished with the Basic Management configuration and are ready to save your system. Figure H shows the three options you will be offered after configuration is complete. The default is to save the configuration and exit. If you are satisfied with your configuration, accept the default and press [Enter]. If you want to change your configuration, you can go back to the setup or you can even be dropped to a command prompt (without saving your changes). If you drop to a command prompt, your configuration won’t be built. If the router is to stand on a production environment, you will certainly want to build and save the configuration.
|When you’re finished with the Basic Management configuration, you’ll want to save your system.|
After the router goes through configuration building, you will return to a command prompt. Figure I shows what the command prompt looks like in HyperTerminal (RouterA).
|This is the command prompt in HyperTerminal.|
Setting the clock
First, we’ll set the clocks on our Cisco routers. The clock is set by using the clock set command and must be done in privileged mode. So, from the privileged prompt, you will type:
clock set HH:MM:SS Day Month Year
For a more specific example, if we wanted to set the time/date to 15:00 4 August 2001, we would run the command:
clock set 15:00:00 4 August 2001
To display the correct time, day, month, and year, run the command:
Setting a host name
You can set a host name of a Cisco router by using the hostname command within the privileged mode. The hostname command is a global configuration command simply because a router can have only one host name. A Cisco router comes with a default host name router, but you will probably want to change it—especially if you have more than one router on your network.
To change to the host name, enter into privileged mode by typing enable and pressing [Enter]. Once you’re in privileged mode, you’ll have to enter into configuration mode by typing:
Once in configuration mode, you’re ready to set your host name. To set the host name of your router, run the following command (replacing RouterA with the desired name of your router):
Setting the IP address of a router
You can use the ip address command to establish the unique address on your router. This command is run from the configuration mode within the privileged mode.
With the host name set, you simply need to get into privileged mode (with the enable command) and then into configuration mode (with the config t command). Once in configuration mode, you need to tell the router that you are going to be configuring a specific interface. Let's say we are going to assign the IP address 172.22.1.1 (with a subnet mask of 255.255.255.0) to the e0/0 interface. In order to do this, we first have to run the command:
and we are ready to give it an IP address. Using the ip address command, set the address (and subnet mask) like so:
ip address 172.22.1.1 255.255.255.0
Now you can enable the interface with the no shut command.
Now that your IP address (and subnet mask) are set and your interface is enabled, you will want exit configuration mode by pressing [Ctrl]Z. Once you are out of the configuration mode, save your running configuration (to ensure you don’t lose your configurations when you reboot) by running this command:
copy run start
You can also use the write mem command, although Cisco prefers the copy run start command.
Setting a default route
Suppose you have two routers handling traffic to two separate networks. You want to build routing tables on both routers to see both networks.
Our first router will be the router we configured above. Our second router will have an IP address of 172.22.1.2 and the same subnet mask as the first router. In order to configure our routers, we must be in config (configuration) mode (which we get to from the privileged mode).
Once in config mode, you will use the ip route command to tell router A how to get to RouterB. On the RouterA terminal, you will run the commands (from within config mode):
ip route 0.0.0.0 0.0.0.0 172.22.1.2
Next, you'll use the ip classless command to ensure that the router won’t drop packets to an unknown network. Instead, the router will forward them to the default route. The ip classless command is:
The next step is to go to RouterB and run the following (from config mode):
ip route 0.0.0.0 0.0.0.0 172.22.1.1
Now you can run the show ip route command on either router and you should have an entry for the other router in the routing table.
Don't forget to run the copy run start command so your configuration changes will be saved.
Allowing telnet access
Of course, you won’t want to limit yourself to console access to your new router. By setting up telnet access, you can access the router from anywhere on your network—so long as telnet is allowed.
To begin setting up telnet access, go into privileged mode and then into config mode. Once you are in config mode, set the Virtual Terminal Lines (VTY) password by running the following commands (replacing PASSWORD with your desired password):
line vty 0 4
With the configuration finished, you can now telnet into the router from any machine with a telnet application and access to that particular network.
Of course, we haven’t solved your deepest networking issues in this Daily Drill Down. Because networking topology and design change so quickly, we often don't take the time to jump back to the basics. Knowing Cisco basics is fundamental to your understanding of the implementation of Cisco equipment within a network.
Of course, we're talking fundamentals here. If you're more inclined to Cisco rocket science, take a peek at Alexander Prohorenko's Daily Drill Downs ”Playing with Cisco access lists” and ”Installing new Cisco images.”
The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.