Saturday, June 28, 2008

- Command Shortcuts

Command Shortcuts

Take a look at this command. It backs up the current configuration and saves it so that the router will use it next time it boots up:

Router#copy running-config startup-config

That's a big hunk of typing. More typing means more time and more errors, so to save time, we can use
truncation. As long as the truncation provides enough information for the IOS to figure out what command you are trying to enter, you can reduce the amount of typing you have to do, saving yourself time:

Router#copy run start


Or even smaller

Router#cop ru st

That's a big savings in typing effort.

As you get used to working with the IOS, you will develop your own shortcuts.

The IOS will tell you when you make a mistake, too. There are three error messages:

Incomplete Command— The IOS needs more command keywords to complete the command. It advises you of the error, and retypes what you entered so that you can complete it. The error looks like this:

Router#copy running-config
% Incomplete Command
Router#copy running-config

Ambiguous Command— The IOS is not sure what command you mean because you truncated too much:

Router#co ru st
%Ambiguous command


Invalid Input— You made a typo or entered a command at the wrong prompt. Notice that the IOS will also show you exactly where the problem happens with a little pointer:

Router#cpy run start
^
%Invalid input detected at '^' marker



Context-Sensitive Help


The IOS has a complete listing of all the commands available. If you get stuck, you can use the question mark ? to access this help. You can use it in different ways:

On its own, to see a list of all the available command words at a particular prompt

Code View:

Router(config-if)#?
-Interface configuration commands:
-access-expression Build a bridge boolean access expression
-arp Set arp type (arpa, probe, snap) or timeout
-backup Modify dial-backup parameters
-bandwidth Set bandwidth informational parameter
-bridge-group Transparent bridging interface parameters
-carrier-delay Specify delay for interface transitions
-cdp CDP interface subcommands
-cmns OSI CMNS
-custom-queue-list Assign a custom queue list to an interface
-default Set a command to its defaults
-delay Specify interface throughput delay
-description Interface specific description
-exit Exit from interface configuration mode
-fair-queue Enable Fair Queuing on an Interface
-help Description of the interactive help system
-hold-queue Set hold queue depth
-ip Interface Internet Protocol config commands
-ipx Novell/IPX interface subcommands
-keepalive Enable keepalive
-llc2 LLC2 Interface Subcommands
-load-interval Specify interval for load calculation for an interface
—More—


After a command word, to see the next possible command words

Router# copy ?
running-config startup-config tftp:

flash:


Don't be afraid to use the help, especially when you are learning. The help commands also function (with limited capabilities) in the router simulator questions on the CCNA exam.

Basic Switch Configuration

A Cisco switch will function perfectly well right out of the box with no configuration required; however, it's a good idea to do a few basic configurations to personalize, secure, and optimize the device.

Setting the Hostname

The default hostname is "Switch," which not only lacks imagination, but also is confusing if you have a lot of them. Changing the hostname is simple:
Switch(config)#hostname My2960 My2960(config)#


Notice that the hostname instantly changed!

Setting a Management IP Address

If you want to Telnet to your switch to manage it remotely, have it participate in an SNMP system, or use the
integrated HTTP server for monitoring, your switch needs an IP address and gateway address. This IP address is applied to the VLAN1 interface and the default gateway is a global command on a switch—unlike a router, a switch has no physical ports that can be assigned IP addresses, so the virtual interface of VLAN1 (the management VLAN) gets the addresses:

My2960(config)#interface vlan1
My2960(config-if)#ip address 192.168.1.2 255.255.255.0 My2960(config-if)#exit
My2960(config)#ip default-gateway 192.168.1.1



Note

A default gateway is an IP address of a router that can connect you to another network. A switch needs a default gateway if it is going to communicate with any device on any IP network other than the one its VLAN1 IP address is in. This is most commonly needed for remote management of the switch using Telnet or SSH, for the switch to participate in SNMP, or any other IP operation that crosses to another network or subnet.



Setting Speed and Duplex on Ethernet Ports

Although the Ethernet interfaces will auto-detect the duplex and speed setting on a 2960, it is usually a good
idea to hard-code them when you are sure of what you are connecting to (such as a server, a switch, or router):

My2960(config)#interface f0/24
My2960(config-if)#speed 100
My2960(config-if)#duplex full


Basic Router Configuration

Routers need a little more configuration than switches to function properly; every interface that you want to use needs an IP address and mask, as well as to be enabled. You will probably need to add static routes or perhaps run a dynamic routing protocol. You need to configure your serial port for connectivity as well.

Serial Port Configuration

As we mentioned before, a Cisco serial port can run several different Layer2 encapsulations—meaning, it can




connect to different types of networks. You must be sure that the encapsulation type matches that of the device you are connecting to. In CCNA, we are interested only in three serial encapsulations: HDLC, PPP, and Frame Relay. The command to change the encapsulation is executed at the interface configuration prompt:

Router(config)#interface serial 0
Router(config-if)#encapsulation [hdlc frame-relay ppp]


You might also need to set up the serial speed by configuring a clock rate. Usually this is supplied by the service provider's device (the DCE—Data Communication Equipment), but in training labs we will hook a router directly to another router with a special back-to-back cable. In this situation, one of the devices must emulate the DCE, and the DCE sets the clock. Only one device needs the clock rate set.

You can also configure a bandwidth statement on the interface. This one is a little tricky; it looks like we are
setting the bandwidth (as in bits per second) of the interface, but we really aren't—the clock rate sets the
physical data rate. What we are doing with the bandwidth command is reporting to the routing protocols about the capacity of the interface (more on this in Chapter 9). It might have an actual clock rate of 64000 (64K), but we could lie and set the bandwidth to 56K for the purposes of routing information:

Router(config-if)#clock rate 64000
Router(config-if)#bandwidth 56




Note

Be aware of the syntax for clock rate and bandwidth: Clock rate is in bps, and bandwidth is in kbps. I remember it this way: clock rate is a longer command and needs a longer number (64000), and bandwidth, truncated as band so it's short, needs a shorter number (64).



Enabling Interfaces

By default, every interface on a router (whether it is brand new or has had its configuration erased) is in a
shutdown state. This is also known as administratively down; although the interface might have been perfectly configured with an IP and mask, encapsulation, and whatever else is needed, the interface is effectively off—even Layer 1 is down. A shutdown interface doesn't send or receive any data at all, and it causes the other end of a serial link to think it is dead altogether. So when you first configure a new router or one that has had its configuration erased, remember to issue the no shutdown command at each interface, or none of the interfaces will work!

Router(config-if)#no shutdown



Exam Alert

Understand that all interfaces are shut down by default until the 'no shut' command is issued.




On a router, every interface is a gateway to another network. For this reason, we do not need to supply a
default gateway. However, every interface you intend to use will need an IP address and mask. The commands

to set an IP are exactly the same as on a switch. Don't forget the no shutdown (no shut for short):

Router(config)#interface s0
Router(config-if)#ip address 10.0.0.1 255.0.0.0 Router(config-if)#no shut
Router(config-if)#interface e0
Router(config-if)#ip address 172.16.0.1 255.255.0.0 Router(config-if)#no shut



No comments: