Friday, November 26, 2010

Disabling Cisco Discovery Protocol (CDP) on Cisco Router

Disable per interface:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #cdp run
Router(config) #interface FastEthernet0/0
Router(config-if) #no cdp enable
Router(config-if) #end
Router#

Disable globally:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #no cdp run
Router(config) #end
Router#

Using Cisco Discovery Protocol (CDP) on Cisco Router

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #cdp run <-- enables CDP, enabled by default
Router(config) #interface Serial0/0
Router(config-if) #cdp enable
Router(config-if) #exit
Router(config) #interface FastEthernet0/0
Router(config-if) #no cdp enable
Router(config-if) #exit
Router(config) #interface FastEthernet1/0
Router(config-if) #cdp enable
Router(config-if) #end
Router#

Router#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater
Device ID Local Intrfce Holdtme Capability Platform Port ID
Router2 Ser 0/0 179 R 2621 Ser 0/1
Switch1 Fas 1/0 152 T S WS-C2924 2/2
Router#


Router#show cdp neighbors detail
------------------------
Device ID: Router2
Entry address(es) :
IP address: 10.10.10.3
Platform: cisco 2621, Capabilities: Router
Interface: Serial0/0, Port ID (outgoing port) : Serial0/1
Holdtime : 136 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-IK9O3S-M) , Version 12. 2(13) , RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2002 by cisco Systems, Inc.
Compiled Tue 19-Nov-02 22: 27 by pwade
advertisement version: 2

Device ID: Switch1
Entry address(es) :
IP address: 192.168.1.4
Platform: WS-C2924, Capabilities: Trans-Bridge Switch
Interface: FastEthernet1/0, Port ID (outgoing port) : FastEthernet0/12
Holdtime : 116 sec

Version :
Cisco Internetwork Operating System Software
IOS (tm) C2900XL Software (C2900XL-C3H2S-M) , Version 12. 0(5) WC3b, RELEASE SOFTWARE
(fc1)
Copyright (c) 1986-2002 by cisco Systems, Inc.
Compiled Fri 15-Feb-02 10: 14 by antonino
advertisement version: 2
Duplex: full
Router#


Router#show cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Sending CDPv2 advertisements is enabled
Router#


Router(config) #cdp timer 30 <-- CDP advertisement sent every 30 secs
Router(config) #cdp holdtime 240 <-- how long router waits to hear from neighbor before flushing entry

Auto Tuning Buffers on Cisco Router

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#buffers tune automatic
Router(config) #end
Router#

Router# show buffers tune
Tuning happened for the pool Small
Tuning happened at 22: 43: 19
Oldvalues
permanent: 50 minfree: 20 maxfree: 150
Newvalues
permanent: 62 minfree: 15 maxfree: 78
Tuning happened for the pool Middle
Tuning happened at 22: 43: 19
Oldvalues
permanent: 25 minfree: 10 maxfree: 150
Newvalues
permanent: 36 minfree: 9 maxfree: 45
Router#

Tuesday, November 23, 2010

Building a T1/E1 Loopback Connector

Use a single RJ45 connector and two 4-in (10-cm) wires. Connect wire 1 from pin 1 to pin 4, and connect wire 2 from pin 2 to pin 5 of the RJ45 connector.

Tuning Cisco Router Buffers

Tuning buffers is usually not necessary and doing so incorrectly can cause serious performance problems.

Use the show buffers command to tell if your buffers need adjusting.

Public Buffers:

Router>show buffers

Small buffers, 104 bytes (total 50, permanent 50) :
50 in free list (20 min, 150 max allowed)
265016 hits, 0 misses, 0 trims, 0 created
0 failures (0 no memory) <-- Look for failures

If you see failures you might need to alter your buffer parameters. Failures indicate the number of times the router has attempted to allocate a buffer and failed, causing it to drop the packet. The no memory counts the number of times a failure occurred because no memory was available which usually is resolved by adding more memory to the router.

Tune public buffer pools example:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #buffers big initial 100
Router(config) #buffers big max-free 200
Router(config) #buffers big min-free 50
Router(config) #buffers big permanent 50
Router(config) #end
Router#

Interface Buffers:

Router>show buffers

Ethernet0 buffers, 1524 bytes (total 32, permanent 32) :
8 in free list (0 min, 32 max allowed)
24 hits, 0 fallbacks
8 max cache size, 8 in cache
30963 hits in cache, 0 misses in cache
As long as misses and fallbacks low, no need to adjust interface buffers.

Tune interface buffer pools example:

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #buffers Ethernet0 initial 200
Router(config) #buffers Ethernet0 max-free 300
Router(config) #buffers Ethernet0 min-free 50
Router(config) #buffers Ethernet0 permanent 50
Router(config) #end
Router#

Manage Cisco Router's ARP Cache

Default ARP timeout is 4 hours

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #interface Ethernet0
Router(config-if) #arp timeout 600 (600 seconds)
Router(config-if) #end
Router#

Router#show interface Ethernet0
Ethernet0 is up, line protocol is up
Hardware is Lance, address is 0000. 0c92. bc6a (bia 0000. 0c92. bc6a)
Internet address is 192.168.1.3/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 00:10:00

Router#show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.2 8 0001. 9670. b780 ARPA Ethernet0
Internet 192.168.1.3 - 0000. 0c92. bc6a ARPA Ethernet0
Internet 192.168.1.4 9 0010. 4b09. 5700 ARPA Ethernet0
Internet 192.168.1.5 2 0010. 4b09. 5715 ARPA Ethernet0
Router#

Age gets reset to 0 when router sees traffic from device

Clear entire ARP cache

Router#clear arp
Router#

Monday, November 22, 2010

Creating Command Aliases on Cisco Router

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #alias exec rt show ip route
Router(config) #alias exec on show ip ospf neighbor
Router(config) #end
Router#

Router#show aliases
Exec mode aliases:
h help
lo logout
p ping
r resume
s show
u undebug
un undebug
w where
rt show ip route
on show ip ospf neighbor
Router#

Configuration Archiving on Cisco Routers

Create directory in flash to store arhived configs

Router#cd slot0:
Router#mkdir configs
Create directory filename [ configs] ?
Created dir slot0: /configs
Router#

Configure archiving. Configuration stored in archive every time you do a write memory or copy running-config startup-config.

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #archive
Router(config-archive) #path slot0: /configs/$h ($h uses hostname, $t uses date/time stamp)
Router(config-archive) #write-memory
Router(config-archive) #time-period 1440 (automatic scheduled archive every 1,440 minutes)
Router(config-archive) #end
Router#

View archives

Router#show archive
There are currently 5 archive configurations saved.
The next archive file will be named slot0: /configs/Router1-5
Archive # Name
0
1 slot0: /configs/Router1-1
2 slot0: /configs/Router1-2
3 slot0: /configs/Router1-3
4 slot0: /configs/Router1-4 <- Most Recent
5
6
7
8
9
10
11
12
13
14
Router#

Change number of archive files stored

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #archive
Router(config-archive) #maximum 10
Router(config-archive) #end
Router#

Show differences between current running config and an archived config

Router#show archive config differences slot0: /configs/Router1-1
Contextual Config Diffs:
+ip cef
-no ip cef
Router#

Rollback to previous configuration archive file

Router#archive config (store current running config)
Router#configure replace slot0: /configs/Router1-1
This will apply all necessary additions and deletions
to replace the current running configuration with the
contents of the specified configuration file, which is
assumed to be a complete configuration, not a partial
configuration. Enter Y if you are sure you want to proceed. ? [ no] : y
Total number of passes: 1
Rollback Done
Router#


Copying files on a Cisco Router via FTP

This example enters the FTP username and password into the routers config.

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #ip ftp username ernie
Router(config) #ip ftp password erniepassword
Router(config) #end
Router#copy ftp: running-config
Address or name of remote host [192.168.1.1] ? 192.168.1.1
Source filename [ ] ? test
Destination filename [ running-config] ?
Accessing ftp://192.168.1.1/test. . .
Loading /test
[ OK - 24/4096 bytes]
24 bytes copied in 0. 276 secs (87 bytes/sec)
Router#

This example uses the username and password entered into the command line which overrides any username/password configured in the router's config.

Router#copy ftp: //ernie:erniepassword@192.168.1.1/c3845-advipservicesk9-mz.124-3i.bin slot1:
Destination filename [c3845-advipservicesk9-mz.124-3i.bin] ?
Accessing ftp: //ijbrown: ianpassword@192.168.1.1/c3845-advipservicesk9-mz.124-3i.bin. . .
Loading pub/c3845-advipservicesk9-mz.124-3i.bin ! ! ! !
Erase slot1: before copying? [ confirm]
Erasing the slot1 filesystem will remove all files! Continue? [ confirm]
Erasing device. . . eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee . . . erased
Erase of slot1: complete
Loading pub/c3845-advipservicesk9-mz.124-3i.bin
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
[ OK - 11819052/4096 bytes]
Verifying checksum. . . OK (0x3256)
11812352 bytes copied in 266. 956 secs (44573 bytes/sec)
Router#

Configure Cisco Router as a TFTP Server

Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config) #tftp-server flash: c3845-advipservicesk9-mz.124-3i.bin
Router(config) #end
Router#

Can only serve files for download.

For security reasons it is recommended that you only enable this when you need it then disable it when you are done.

Clear Cisco Router Configuration Back to Factory Defaults

Router#erase startup-config
Erasing the nvram filesystem will remove all files! Continue? [confirm]
[ OK]
Erase of nvram: complete
Router#reload
Proceed with reload? [confirm]

Configuring a Cisco Router via TFTP

You can use the copy tftp command to configure the router via the Trivial File
Transfer Protocol (TFTP).

This is useful when you need to configure a large number of devices. The router copies the entire file via TFTP before it enters the commands into the running config.

Router#copy tftp://192.168.1.1/NEWCONFIG running-config
Destination filename [ running-config] ?
Accessing tftp://192.168.1.1/NEWCONFIG. . .
Loading NEWCONFIG from 192.168.1.1 (via FastEthernet0/0) : !
[ OK - 24 bytes]

24 bytes copied in 0. 192 secs (125 bytes/sec)
Router#