How to use my alias list

From: Michael Snyder (msnyder@revolutioncomputer.com)
Date: Sat Feb 07 2004 - 21:30:18 GMT-3


This is the third in my series of how to`s

I started out with 34`s aliases with my first lab attempt in 2001.
Needless to say, it was way too many. I think my mistake was I was
trying to do actions and subjects at the same time. So I rewrote it.
Have removed some only to re-add them at a later date. The list has
stabilized at 14 statements three years later. The whole goal was to
minimize typing, but a funny thing has happened. With the addition of
the include and exclude functionality in the new ios`s you can form new
commands with custom outputs. The alias sbs is a great example. I
wouldn't take the time to type it in during the lab, because it's too
complex and case sensitive but I would use it as a premade alias.

I have an ipexpert lab loading on my rack, so I'll just list each one
with a working example.

alias exec c config t
alias exec s show ip interface brief | e unass|Int
alias exec cb clear ip bgp *
alias exec ci clear ip route *
alias exec co clear ip ospf process
alias exec ce clear ip eigrp neighbors
alias exec sb show ip bgp
alias exec se show ip eigrp
alias exec si show ip route | e -|sub
alias exec so show ip ospf
alias exec sr show running-config | e alias
alias exec sbs show ip bgp neighbors | include (BGP neighbor)|(BGP
state)
alias exec st show run int
alias exec sp show ip protocol

------------------------------------------------------------------------
-------------------------------------------------

alias exec c config t

R2#c
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#

------------------------------------------------------------------------
-------------------------------------------------
A cleaned up connected ip display

alias exec s show ip interface brief | e unass|Int

R2#
R2#s
BRI0 172.16.25.2 YES manual up
up
Loopback0 192.168.2.2 YES manual up
up
Serial0.24 172.16.24.1 YES manual up
up
Serial0.56 172.16.56.2 YES manual up
up
Serial1 172.16.12.2 YES manual up
up

------------------------------------------------------------------------
-------------------------------------------------
The big clears, these are your friends.

alias exec cb clear ip bgp *
alias exec ci clear ip route *
alias exec co clear ip ospf process
alias exec ce clear ip eigrp neighbors

R2#ci
R2#
RT: add 172.16.25.0/24 via 0.0.0.0, connected metric [0/0]
RT: add 192.168.2.2/32 via 0.0.0.0, connected metric [0/0]
RT: network 172.16.0.0 is now variably masked
RT: add 172.16.24.0/30 via 0.0.0.0, connected metric [0/0]
RT: add 172.16.56.0/29 via 0.0.0.0, connected metric [0/0]
RT: add 172.16.12.0/24 via 0.0.0.0, connected metric [0/0]
R2#cb
R2#
%BGP-5-ADJCHANGE: neighbor 192.168.1.1 Down User reset
%BGP-5-ADJCHANGE: neighbor 192.168.4.4 Down User reset
%BGP-5-ADJCHANGE: neighbor 192.168.5.5 Down User reset

R2#co
Reset ALL OSPF processes? [no]: y
R2#
%OSPF-5-ADJCHG: Process 34, Nbr 192.168.6.6 on OSPF_VL2 from FULL to
DOWN, Neighbor Down: Interface down or detached
%OSPF-5-ADJCHG: Process 34, Nbr 192.168.5.5 on OSPF_VL0 from FULL to
DOWN, Neighbor Down: Interface down or detached
%OSPF-5-ADJCHG: Process 34, Nbr 192.168.6.6 on Serial0.56 from 2WAY to
DOWN, Neighbor Down: Interface down or detached
%OSPF-5-ADJCHG: Process 34, Nbr 192.168.5.5 on Serial0.56 from 2WAY to
DOWN, Neighbor Down: Interface down or detached

R2#ce
R2#
%DUAL-5-NBRCHANGE: IP-EIGRP 40: Neighbor 172.16.24.2 (Serial0.24) is
down: manually cleared
R2#

------------------------------------------------------------------------
-------------------------------------------------
The bgp table is where the action is.

alias exec sb show ip bgp

R4#sb
BGP table version is 2, local router ID is 192.168.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i -
internal
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network Next Hop Metric LocPrf Weight Path
*> 11.4.102.4/32 0.0.0.0 0 32768 i
R4#

------------------------------------------------------------------------
-------------------------------------------------
Handy eigrp, the `se to de` will show eigrp tags which aren't present on
this router.

alias exec se show ip eigrp

R4#se to de
IP-EIGRP Topology Table for AS(40)/ID(192.168.4.4)

Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - reply Status, s - sia Status

P 11.4.104.4/32, 1 successors, FD is 128256, serno 6
         via Connected, Loopback4
P 172.16.90.128/28, 1 successors, FD is 256512256, serno 20
         via 172.16.24.1 (256512256/256000256), Serial0
P 192.168.8.8/32, 1 successors, FD is 256512256, serno 33
         via 172.16.24.1 (256512256/256000256), Serial0
P 192.168.1.1/32, 1 successors, FD is 2560512256, serno 32
         via 172.16.24.1 (2560512256/2560000256), Serial0
P 192.168.2.2/32, 1 successors, FD is 256512256, serno 29
         via 172.16.24.1 (256512256/256000256), Serial0

R4#se n
IP-EIGRP neighbors for process 40
H Address Interface Hold Uptime SRTT RTO Q Seq
Type
                                        (sec) (ms) Cnt Num
0 172.16.24.1 Se0 176 2d03h 94 564 0 21
R4#

R4#se i
IP-EIGRP interfaces for process 40

                    Xmit Queue Mean Pacing Time Multicast
Pending
Interface Peers Un/Reliable SRTT Un/Reliable Flow Timer
Routes
Et0 0 0/0 0 0/10 0 0
Se0 1 0/0 94 0/39 431 0
Lo1 0 0/0 0 0/10 0 0
Lo2 0 0/0 0 0/10 0 0

------------------------------------------------------------------------
-------------------------------------------------
Handy ospf,

alias exec so show ip ospf

R2#so n

Neighbor ID Pri State Dead Time Address
Interface
192.168.6.6 0 FULL/DROTHER 00:00:06 172.16.56.6
Serial0.56
192.168.5.5 0 FULL/DROTHER 00:00:07 172.16.56.5
Serial0.56

R2#so d

            OSPF Router with ID (192.168.2.2) (Process ID 34)

                Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link
count
192.168.2.2 192.168.2.2 751 0x80000055 0x1780 2
192.168.5.5 192.168.5.5 1 (DNA) 0x80000067 0x3C61 2
192.168.6.6 192.168.6.6 1 (DNA) 0x80000067 0x98E 2
192.168.7.7 192.168.7.7 2 (DNA) 0x80000060 0xCA15 3

                Net Link States (Area 0)

R2#so v
Virtual Link OSPF_VL2 to router 192.168.6.6 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface Serial0.56, Cost of using 64
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:05
    Adjacency State FULL (Hello suppressed)
    Index 1/3, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
  Message digest authentication enabled
    Youngest key id is 1

------------------------------------------------------------------------
-------------------------------------------------

Normal show run, but removes the alias commands from the display. Saves
14 lines per use.

alias exec sr show running-config | e alias

R2#
R2#sr
Building configuration...

Current configuration : 4913 bytes
!
version 12.2
no service single-slot-reload-enable
no service timestamps debug uptime
no service timestamps log uptime
no service password-encryption
service linenumber
!
hostname R2

------------------------------------------------------------------------
-------------------------------------------------
Custom show ip route. Gets rid of the headers, and some of the classful
info.

alias exec si show ip route | e -|sub

R6#si

Gateway of last resort is not set

O E1 192.168.8.8 [110/1120] via 172.16.200.7, 00:36:35, Ethernet1
O E1 192.168.9.9 [110/1064] via 172.16.69.2, 00:36:35, Serial1
O 172.16.90.128/28 [110/70] via 172.16.69.2, 2d03h, Serial1
C 172.16.200.0/25 is directly connected, Ethernet1
C 172.16.56.0/29 is directly connected, Serial0
O E1 172.16.40.0/24 [110/1064] via 172.16.56.2, 00:36:35, Serial0
O E1 172.16.24.0/30 [110/1064] via 172.16.56.2, 00:36:35, Serial0
O 172.16.25.0/24 [110/1626] via 172.16.56.5, 1d21h, Serial0
                       [110/1626] via 172.16.56.2, 1d21h, Serial0
O E1 172.16.12.0/24 [110/98] via 172.16.56.2, 00:36:35, Serial0
O E1 172.16.10.0/24 [110/98] via 172.16.56.2, 00:36:35, Serial0
O 172.16.78.0/30 [110/184] via 172.16.200.7, 00:36:45, Ethernet1
C 172.16.69.0/30 is directly connected, Serial1
O E1 192.168.4.4 [110/1064] via 172.16.56.2, 00:36:35, Serial0
O IA 192.168.5.5 [110/121] via 172.16.200.5, 00:36:35, Ethernet1
C 192.168.6.6 is directly connected, Loopback0
O E1 11.4.104.4 [110/1064] via 172.16.56.2, 00:36:36, Serial0
O E1 11.4.102.4 [110/1064] via 172.16.56.2, 00:36:37, Serial0
O 192.168.7.7 [110/121] via 172.16.200.7, 00:36:47, Ethernet1
O E1 192.168.1.1 [110/98] via 172.16.56.2, 00:36:37, Serial0
O IA 192.168.2.2 [110/65] via 172.16.56.2, 00:36:37, Serial0
R6#

------------------------------------------------------------------------
-------------------------------------------------
My rack uses 2500 routers which are slow, just showing the needed
interface is a great time saver.

alias exec st show run int

R2#st s0.24
Building configuration...

Current configuration : 278 bytes
!
interface Serial0.24 multipoint
 ip address 172.16.24.1 255.255.255.252
 ip bandwidth-percent eigrp 40 20
 ip authentication mode eigrp 40 md5
 ip authentication key-chain eigrp 40 michael
 frame-relay map ip 172.16.24.1 104
 frame-relay map ip 172.16.24.2 104 broadcast
end

------------------------------------------------------------------------
-------------------------------------------------

I like this one. Most needed Neighbor info in one command.

alias exec sbs show ip bgp neighbors | include (BGP neighbor)|(BGP
state)

R6#sbs
BGP neighbor is 192.168.4.4, remote AS 24, external link
  BGP state = Established, up for 01:10:06
  External BGP neighbor may be up to 6 hops away.
BGP neighbor is 192.168.5.5, remote AS 567, internal link
  BGP state = Established, up for 01:10:29
BGP neighbor is 192.168.7.7, remote AS 567, internal link
  BGP state = Established, up for 00:43:07
BGP neighbor is 192.168.9.9, remote AS 9, external link
  BGP state = Established, up for 00:28:39
  External BGP neighbor may be up to 3 hops away.

------------------------------------------------------------------------
-------------------------------------------------
Normal show protocol command, seems to come up a lot.

alias exec sp show ip protocol

R5#sp
Routing Protocol is "ospf 34"
  Invalid after 0 seconds, hold down 0, flushed after 0
  Outgoing update filter list for all interfaces is
  Incoming update filter list for all interfaces is
  Routing for Networks:
    172.16.25.0/24
    172.16.56.0/29
    172.16.200.0/25
    192.168.5.5/32
  Routing Information Sources:
    Gateway Distance Last Update
    192.168.7.7 110 00:33:17
    192.168.9.9 110 00:33:17
    192.168.6.6 110 00:33:17
    192.168.2.2 110 00:33:17
  Distance: (default is 110)

------------------------------------------------------------------------
-------------------------------------------------

That`s about it.

The list is time tested and works well together.

Michael Snyder
Lead Network Engineer
CCSP/DP, MCSE
Revolution Computer Systems
(270) 443-7400



This archive was generated by hypermail 2.1.4 : Fri Mar 05 2004 - 07:13:47 GMT-3