Accessing a Cisco Router10/11/2001
In today's article, I'd like to take a look at accessing a Cisco router from a FreeBSD box using a rollover cable.
Normally, the only time you need to access a Cisco router is to view or
change its configurations and you use the
telnet utility to do so.
However, when you first purchase a router, or if you accidently erase
your configurations, you can't telnet into it as the interfaces will be
down and they won't have any IP addresses set to telnet into. If this is
the case, you'll need to access the router via its console interface from
a serial interface on your computer.
In Microsoft land, the
hyperterminal utility is usually used to do this.
While you don't get
hyperterminal on your FreeBSD computer, there are
two built-in utilities and several programs in the ports collection that provide this functionality. I'd like to demonstrate the use of
tip. I'll also build and demonstrate
seyon in this article.
If you're setting up a Cisco router for the first time, find the long, flat, light blue rollover cable that came with the router. This cable is easy to recognize if you compare both ends of the cable. You'll also see why it's called a rollover cable as the pinouts are opposite to each other; in effect, the cable was rolled over when the second connection was crimped on.
Plug one end of the rollover cable into the connection at the back of the
router that is marked "console" in the same light blue color as the
cable. Don't plug the other end of the cable into your FreeBSD computer
yet, as you need to use one of the serial adapters that came with the
router. You should have a 9-pin and a 25-pin adapter. Take a look at the
back of your FreeBSD computer to see which serial port you have available
to use. On my system,
com1 was taken by my mouse, but
com2 was free.
Accordingly, I plugged the rollover cable into the 25-pin adapter, then I
connected it to
com2 on my computer. Once everything was connected,
I turned my FreeBSD computer back on and turned on the power switch at the
back of the Cisco router.
The last thing we need to sort out before starting is the FreeBSD device
names for the com ports on your computer. Com ports are
# starts at 0. If you used
com1, you're using
cuaa0; since I'm using
com2, I'll be using
cuaa1 in this article. Also, because we will be
directly accessing serial devices, all of the utilities mentioned require
you to be the superuser to use them.
Let's start with the utilities that come with FreeBSD --
tip. To use
cu, simply specify your com port using the
-l or line switch and a
speed of 9600 baud using the speed switch
-s like so:
su Password: cu -l /dev/cuaa1 -s 9600 Connected.
I'll now press enter and I've entered the setup utility on the Cisco
router. Note that I'll be prompted to set IP addresses on the interfaces,
the enable password, and the
telnet (virtual terminal) password. These are
the minimum configurations that will be required to be able to access a Cisco
router without the rollover cable. You'll note that in Cisco, most questions
have an answer in "
" meaning you can just press Enter if you're satisfied with
that answer. If you aren't, type in your desired response. The setup
process should look like this:
First, would you like to see the current interface summary? [yes]:
Any interface listed with OK? value "NO" does not have a valid configuration
Interface IP-Address OK? Method Status Protocol
Ethernet0 unassigned NO unset up down
Serial0 unassigned NO unset down down
Configuring global parameters:
Enter host name [Router]:
The enable secret is a one-way cryptographic secret used
instead of the enable password when it exists.
Enter enable secret:
The enable password is used when there is no enable secret
and when using older software and some boot images.
Enter enable password:
Enter virtual terminal password:
Configure SNMP Network Management? [yes]: no
Configure IPX? [no]:
Configure IP? [yes]:
Configure IGRP routing? [yes]: no
Configure RIP routing? [no]:
Configuring interface parameters:
Configuring interface Ethernet0:
Is this interface in use? [yes]:
Configure IP on this interface? [yes]:
IP address for this interface: 10.0.0.100
Number of bits in subnet field :
Class A network is 10.0.0.0, 0 subnet bits; mask is /8
Configuring interface Serial0:
Is this interface in use? [yes] no
The following configuration command script was created:
Use this configuration? [yes/no]: yes
Use the enable mode 'configure' command to modify this configuration.
Press RETURN to get started!
My configurations are now finished and I'm presented with the user mode prompt. If you're familiar with your Cisco IOS commands, you can proceed to use them as usual.
When you wish to disconnect from the Cisco router by closing the
then press the Enter key. You should receive a "Disconnected." message and get your FreeBSD prompt back.