Wednesday 14 December 2016

CCIE RS Revision Series - Regexp Review & how to grep Cisco


I learn regular expressions, I forget regular expressions. I learn regular expressions, I forget regular expressions. Sound familiar?

Some of this stuff sticks for a while, but the devil is in the details & if like me you rarely use them in your day to day, well the information just evaporates out of your ears.

Typically if you are a non Linux/Unix fellow, then your regexp usage would come from BGP. If you are not a regular user of BGP then how else can one make use of these tools?

There is another way you can get more out of regular expressions & use them in your day to day therefore helping you to commit this info to long term memory. What i am talking about is the grep functionality of Cisco IOS (tested in IOS & XE).


R10#conf t
R10(config)#shell processing full

This allows us to call on the grep functionality to search within output, lets use this to look for an IP address within our configuration:

R10#show run | grep [0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*
 ip address 150.1.10.10 255.255.255.255
 ip address 172.16.5.6 255.255.255.0
 ip igmp join-group 225.1.2.3
 ip address 155.1.10.10 255.255.255.0

From this we can see the grep functionality has worked, lets breakdown what exactly we did to glean this information:
  1. First off we have set a criteria of a range from 0-9 within the square brackets [0-9], here we are saying any value from 0-9. 
  2. Next up is the *, this special character matches zero or more occurrences of the preceding character. Therefore we would match nothing ' ', one single character '1' or '3' & also multiple numerical characters '123' or '222'.
  3. The next character's, the double \\ tells grep that the dot '.' that follows the \\ is to interpreted as a literal dot, not a special character (the dot would otherwise mean  match any single character including a blank space)
The above pattern is repeated 4 times, to look for four sets of numerical values that are separated by a dot. Which is what makes up an IPv4 address.

Lets quickly talk about why we need the double backslash before we move on, first lets look at what the CLI interprets these as by way of echo:


R10#echo \

R10#echo \\
\
R10#echo '\'
\
R10#echo '\\'
\\
R10#echo \.
.
R10#echo \\.
\.

As you can see if we exclude single quotations ' ' then the \ has special meaning to the parser & is not displayed. What is interesting & I don't yet know the answer is, why do i need a double \\ to make the dot appear in its true form, when the echo above shows that only a single slash is needed to parse the following data correctly. I would expect my IPv4 regexp to interpret the second slash as literal as per the final echo output. 

What I understand is that the \ is also a shell quoting character & hard to use as an escape character, thereby double \\ may be needed for grep but not for the echo command.

To avoid the double \\, you can just put your expression inside of single quotes ' ' & use a single slash \

R10#show run | grep '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'
ip domain name 1a.23.45.6
 ip address 150.1.10.10 255.255.255.255
 ip address 192.168.0.1 255.255.255.0
 ip address 172.16.5.6 255.255.255.0
 ip igmp join-group 225.1.2.3
 ip address 155.1.10.10 255.255.255.0
 ip address 155.1.108.10 255.255.255.0

You may noticed I have added a domain name that looks somewhat like an IP address. However we do not want to match on this, but the reason we are is due to the * in the search, whereby the * matches zero or more occurrences of the preceding character. In this case the domain name is matched by the zero value, as the character before the first dot '.' can be numerical or nothing (zero).

To fix this we substitute the * with a +, where the + sign indicates that we much match one or more of the preceding values. Meaning there must be a numerical value before the dot '.'.

R10#show run | grep '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
 ip address 150.1.10.10 255.255.255.255
 ip address 192.168.0.1 255.255.255.0
 ip address 172.16.5.6 255.255.255.0
 ip igmp join-group 225.1.2.3
 ip address 155.1.10.10 255.255.255.0
 ip address 155.1.108.10 255.255.255.0

However if we now modify the domain name to 'bib127.0.0.1', we should match it again as the character preceding the first dot '.' is numerical.

R10#show run | grep '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
ip domain name bib127.0.0.1
 ip address 150.1.10.10 255.255.255.255
 ip address 192.168.0.1 255.255.255.0
 ip address 172.16.5.6 255.255.255.0
 ip igmp join-group 225.1.2.3
 ip address 155.1.10.10 255.255.255.0
 ip address 155.1.108.10 255.255.255.0

We know that in our example there is a leading white space, therefore we can add this into out filter to remove the unwanted results, here are both methods:

R10#show run | grep ' [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
R10#show run | grep \ [0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+
 ip address 150.1.10.10 255.255.255.255
 ip address 192.168.0.1 255.255.255.0
 ip address 172.16.5.6 255.255.255.0
 ip igmp join-group 225.1.2.3
 ip address 155.1.10.10 255.255.255.0
 ip address 155.1.108.10 255.255.255.0

We do have the _ underscore to match on white space, but testing has shown this not to work with grep, however it does work with regexp for searching the BGP tables.

As you can see the grep feature can be used as part of your day to day, try swapping out the 'include' & 'section' searches & use grep instead, your future self will thank you for it!

Now finally by way of example, here are some regexp's I have taken from my notes and the results they would yield:


  • ^100:1_ Match 100:1 at the start of the line
  • 200:3$ Match 200:3 at the end of the line
  • 300:[5-9]_ Match a range from 300:5 to 300:9 the _ signifies the end so only 1 digit allowed after the :
  • 400:1.*_ Matches 400:1XXXX where X is anything as the . means any character & the * means the previous match the previous charterer 0 or more times.
  • 400:1.+_ is as previous, but wont match 400:1 as the + means 1 or more times, so a second character is needed.
  • 500:([0-9]2)+_ inside the ( ) is treated as one expression where the + means this expression must be there 1 or more times, so 500:X2 & 500:X2X2X2 all match.
  • 600:1_ | 600:2_ is using a | alternate, which looks for either of the patterns
  • 600:(12)|(22) uses the | OR to look for 600:12 or 600:22
Further reading :


-SB

Saturday 10 December 2016

CCIE RS Revision Series - Diagnostics Sample Question 1

Diagnostics Sample Question:

Your job is to diagnose & locate the source of the problem, please post your comments below & I will follow this up with a post detailing the solution in due course.

:::

The following is the topology for BlogTown's new network that has just been installed. It is made up of three multilayer switches. The core switch 'Switch 2'  provides layer three access to various services, such as the Internet & internal servers. 

The two clients that connected to Switch 1 & Switch 3 are both in the same VLAN & subnet '192.168.1.0/24'



Reported issue:
The users of the clients have complained that they cannot communicate directly with one another.

Troubleshooting already completed:
Ping tests were run from both client PC's to test reachability. Following this a second ping test was run to see if either client could reach the Internet facing port Eth1/1 on Switch 2, results can be seen below in the log file 'Initial Pings".

Further Information Requested:
To help isolate the fault the following items were asked for & can be seen below:

-"show run" from all three switches
-"show vtp status" from all three switches
-"show vlan" from switches 1 & 3
-"show spanning-tree" from switch 1
-"show log" from switch 2

Initial Pings:
CLIENT1#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/5/5 ms
CLIENT1#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
CLIENT1#ping 192.168.255.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.255.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms

CLIENT2#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/5 ms
CLIENT2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
CLIENT2#ping 192.168.255.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.255.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms


Show Command outputs
!!!!Switch 1
SW1#show run
Building configuration...

Current configuration : 1469 bytes
!
! Last configuration change at 04:01:14 CST Sat Nov 5 2016
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
service compress-config
!
hostname SW1
!
boot-start-marker
boot-end-marker
!
!
enable password cisco
!
no aaa new-model
clock timezone CST -6 0
!
!
!
!
!
!
!
!
no ip domain-lookup
ip cef
ipv6 multicast rpf use-bgp
no ipv6 cef
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
 switchport mode dynamic desirable
 shutdown
!
interface Ethernet0/1
 switchport mode dynamic desirable
 shutdown
!
interface Ethernet0/2
 switchport access vlan 1008
 switchport mode access
!
interface Ethernet0/3
 switchport mode dynamic desirable
 shutdown
!
interface Ethernet1/0
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Ethernet1/1
 switchport mode dynamic desirable
 shutdown
!
interface Ethernet1/2
 switchport mode dynamic desirable
 shutdown
!
interface Ethernet1/3
 switchport mode dynamic desirable
 shutdown
!
interface Vlan1
 ip address 192.168.0.1 255.255.255.0
 ip ospf 1 area 0
!
interface Vlan1008
 ip address 192.168.1.11 255.255.255.0
 ip ospf 1 area 0
!
router ospf 1
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
line con 0
 logging synchronous
line aux 0
line vty 0 4
 password cisco
 login
!
!
end


SW1#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 3
VTP Domain Name                 : CISCO
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc00.6500

Feature VLAN:
--------------
VTP Operating Mode                : Primary Server
Number of existing VLANs          : 9
Number of existing extended VLANs : 1
Maximum VLANs supported locally   : 4096
Configuration Revision            : 4
Primary ID                        : aabb.cc00.6500
Primary Description               : SW1
MD5 digest                        : 0xE5 0x6D 0x8F 0x0B 0x12 0x2E 0xF7 0xF1
                                    0x48 0xE9 0xF6 0x57 0x27 0x93 0x1E 0xB4


Feature MST:
--------------
VTP Operating Mode                : Transparent


Feature UNKNOWN:
--------------
VTP Operating Mode                : Transparent



SW1#show vlan
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/0, Et0/1, Et0/3, Et1/1
                                                Et1/2, Et1/3
2    VLAN0002                         active
5    VLAN0005                         active
55   VLAN0055                         active
66   VLAN0066                         active
1002 fddi-default                     act/unsup
1003 trcrf-default                    act/unsup
1004 fddinet-default                  act/unsup
1005 trbrf-default                    act/unsup
1008 VLAN1008                         active    Et0/2

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
2    enet  100002     1500  -      -      -        -    -        0      0
5    enet  100005     1500  -      -      -        -    -        0      0
55   enet  100055     1500  -      -      -        -    -        0      0
66   enet  100066     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1003 trcrf 101003     4472  1005   3276   -        -    srb      0      0
1004 fdnet 101004     1500  -      -      -        ieee -        0      0
1005 trbrf 101005     4472  -      -      15       ibm  -        0      0
1008 enet  101008     1500  -      -      -        -    -        0      0


VLAN AREHops STEHops Backup CRF
---- ------- ------- ----------
1003 7       7       off

Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------



SW1#show spanning-tree
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     aabb.cc00.6500
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32769  (priority 32768 sys-id-ext 1)
             Address     aabb.cc00.6500
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et1/0               Desg FWD 100       128.5    Shr



VLAN0002
  Spanning tree enabled protocol ieee
  Root ID    Priority    32770
             Address     aabb.cc00.6500
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32770  (priority 32768 sys-id-ext 2)
             Address     aabb.cc00.6500
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et1/0               Desg FWD 100       128.5    Shr



VLAN0005
  Spanning tree enabled protocol ieee
  Root ID    Priority    32773
             Address     aabb.cc00.6500
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32773  (priority 32768 sys-id-ext 5)
             Address     aabb.cc00.6500
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et1/0               Desg FWD 100       128.5    Shr



VLAN0055
  Spanning tree enabled protocol ieee
  Root ID    Priority    32823
             Address     aabb.cc00.6500
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32823  (priority 32768 sys-id-ext 55)
             Address     aabb.cc00.6500
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et1/0               Desg FWD 100       128.5    Shr



VLAN0066
  Spanning tree enabled protocol ieee
  Root ID    Priority    32834
             Address     aabb.cc00.6500
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32834  (priority 32768 sys-id-ext 66)
             Address     aabb.cc00.6500
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et1/0               Desg FWD 100       128.5    Shr



VLAN1008
  Spanning tree enabled protocol ieee
  Root ID    Priority    33776
             Address     aabb.cc00.6500
             This bridge is the root
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    33776  (priority 32768 sys-id-ext 1008)
             Address     aabb.cc00.6500
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Et0/2               Desg FWD 100       128.3    Shr
Et1/0               Desg FWD 100       128.5    Shr



!!!!Switch 2
SW2#show run
Building configuration...

Current configuration : 1515 bytes
!
! Last configuration change at 04:03:56 CST Sat Nov 5 2016
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
service compress-config
!
hostname SW2
!
boot-start-marker
boot-end-marker
!
!
enable password cisco
!
no aaa new-model
clock timezone CST -6 0
!
!
!
!
!
!
!
!
no ip domain-lookup
ip cef
ipv6 multicast rpf use-bgp
no ipv6 cef
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
 no switchport
 ip address 192.168.23.2 255.255.255.0
 duplex auto
!
interface Ethernet0/1
 no switchport
 ip address 192.168.24.2 255.255.255.0
 duplex auto
!
interface Ethernet0/2
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Ethernet0/3
 shutdown
!
interface Ethernet1/0
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Ethernet1/1
 no switchport
 ip address 192.168.255.2 255.255.255.0
 duplex auto
!
interface Ethernet1/2
 no switchport
 ip address 192.168.25.2 255.255.255.0
 duplex auto
!
interface Ethernet1/3
 no switchport
 ip address 192.168.26.2 255.255.255.0
 duplex auto
!
interface Vlan1
 ip address 192.168.0.2 255.255.255.0
 ip ospf 1 area 0
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
line con 0
 logging synchronous
line aux 0
line vty 0 4
 password cisco
 login
!
!
end


SW2#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 3
VTP Domain Name                 : CISCO
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc00.6600

Feature VLAN:
--------------
VTP Operating Mode                : Client
Number of existing VLANs          : 9
Number of existing extended VLANs : 0
Maximum VLANs supported locally   : 4096
Configuration Revision            : 4
Primary ID                        : aabb.cc00.6500
Primary Description               : SW1
MD5 digest                        : 0xE5 0x6D 0x8F 0x0B 0x12 0x2E 0xF7 0xF1
                                    0x48 0xE9 0xF6 0x57 0x27 0x93 0x1E 0xB4


Feature MST:
--------------
VTP Operating Mode                : Transparent


Feature UNKNOWN:
--------------
VTP Operating Mode                : Transparent


SW2#show log
*Nov  5 09:56:59.789: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
*Nov  5 09:57:52.203: %LINK-3-UPDOWN: Interface Vlan1, changed state to up
*Nov  5 09:57:53.210: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
*Nov  5 09:58:14.336: ICMP: echo reply sent, src 192.168.0.2, dst 192.168.0.1, topology BASE, dscp 0 topoid 0
*Nov  5 09:58:14.336: ICMP: echo reply sent, src 192.168.0.2, dst 192.168.0.1, topology BASE, dscp 0 topoid 0
*Nov  5 09:58:14.337: ICMP: echo reply sent, src 192.168.0.2, dst 192.168.0.1, topology BASE, dscp 0 topoid 0
*Nov  5 09:58:14.337: ICMP: echo reply sent, src 192.168.0.2, dst 192.168.0.1, topology BASE, dscp 0 topoid 0
*Nov  5 09:58:14.337: ICMP: echo reply sent, src 192.168.0.2, dst 192.168.0.1, topology BASE, dscp 0 topoid 0
*Nov  5 09:58:36.026: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.0.1 on Vlan1 from LOADING to FULL, Loading Done
*Nov  5 09:58:39.008: %OSPF-5-ADJCHG: Process 1, Nbr 10.11.0.103 on Vlan1 from LOADING to FULL, Loading Done
*Nov  5 10:01:08.538: %LINK-5-CHANGED: Interface Loopback0, changed state to administratively down
*Nov  5 10:01:09.544: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to down
*Nov  5 10:01:25.687: %SYS-5-CONFIG_I: Configured from console by console
*Nov  5 10:02:03.321: ICMP: echo reply sent, src 192.168.23.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:02:05.321: ICMP: echo reply sent, src 192.168.23.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:03:12.127: ICMP: echo reply sent, src 192.168.23.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:03:12.128: ICMP: echo reply sent, src 192.168.23.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:03:12.128: ICMP: echo reply sent, src 192.168.23.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:03:12.128: ICMP: echo reply sent, src 192.168.23.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:03:12.128: ICMP: echo reply sent, src 192.168.23.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:03:56.453: %SYS-5-CONFIG_I: Configured from console by console
*Nov  5 10:05:37.356: ICMP: echo reply sent, src 192.168.26.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:05:39.359: ICMP: echo reply sent, src 192.168.26.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:06:03.944: ICMP: echo reply sent, src 192.168.26.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:06:05.947: ICMP: echo reply sent, src 192.168.26.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:25:34.323: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:25:34.324: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:25:34.324: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:25:34.324: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:25:34.324: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.1, topology BASE, dscp 0 topoid 0
*Nov  5 10:26:30.455: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:26:30.455: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:26:30.455: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:26:30.455: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:26:30.455: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:39:24.829: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:39:31.234: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:39:34.116: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:39:40.977: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:39:43.416: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:39:50.317: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:39:52.829: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:00.058: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:02.544: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:07.017: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:07.022: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:07.027: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:07.032: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:07.036: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:09.162: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1: 192.168.0.1 address 192.168.0.1 is dead
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1: 192.168.0.1 address 192.168.0.1 is dead, state DOWN
*Nov  5 10:40:11.680: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.0.1 on Vlan1 from FULL to DOWN, Neighbor Down: Dead timer expired
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1: Neighbor change event
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1: DR/BDR election
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1: Elect BDR 10.11.0.103
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1: Elect DR 10.11.0.103
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1: DR: 10.11.0.103 (Id)
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1:    BDR: 10.11.0.103 (Id)
*Nov  5 10:40:11.680: OSPF-1 ADJ   Vl1: Remember old DR 192.168.0.1 (id)
*Nov  5 10:40:12.126: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: Neighbor change event
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: DR/BDR election
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: Elect BDR 10.11.0.102
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: Elect DR 10.11.0.103
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: Elect BDR 10.11.0.102
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: Elect DR 10.11.0.103
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: DR: 10.11.0.103 (Id)
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1:    BDR: 10.11.0.102 (Id)
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: Neighbor change event
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: DR/BDR election
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: Elect BDR 10.11.0.102
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: Elect DR 10.11.0.103
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1: DR: 10.11.0.103 (Id)
*Nov  5 10:40:17.911: OSPF-1 ADJ   Vl1:    BDR: 10.11.0.102 (Id)
*Nov  5 10:40:18.672: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:21.668: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:24.550: %PM-4-EXT_VLAN_INUSE: VLAN 1008 currently in use by Ethernet1/2
*Nov  5 10:40:24.550: %SW_VLAN-4-VLAN_CREATE_FAIL: Failed to create VLANs 1008: VLAN(s) not available in Port Manager
*Nov  5 10:40:28.125: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:31.354: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Rcv DBD from 192.168.0.1 seq 0x1FF1 opt 0x52 flag 0x7 len 32  mtu 1500 state INIT
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: 2 Way Communication to 192.168.0.1, state 2WAY
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Neighbor change event
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: DR/BDR election
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Elect BDR 10.11.0.102
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Elect DR 10.11.0.103
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: DR: 10.11.0.103 (Id)
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1:    BDR: 10.11.0.102 (Id)
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Nbr 192.168.0.1: Prepare dbase exchange
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Send DBD to 192.168.0.1 seq 0x334 opt 0x52 flag 0x7 len 32
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: NBR Negotiation Done. We are the SLAVE
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Nbr 192.168.0.1: Summary list built, size 5
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Send DBD to 192.168.0.1 seq 0x1FF1 opt 0x52 flag 0x2 len 132
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Rcv DBD from 192.168.0.1 seq 0x1FF2 opt 0x52 flag 0x1 len 92  mtu 1500 state EXCHANGE
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Exchange Done with 192.168.0.1
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Send LS REQ to 192.168.0.1 length 36 LSA count 1
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Send DBD to 192.168.0.1 seq 0x1FF2 opt 0x52 flag 0x0 len 32
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Rcv LS UPD from 192.168.0.1 length 76 LSA count 1
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Synchronized with 192.168.0.1, state FULL
*Nov  5 10:40:36.754: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.0.1 on Vlan1 from LOADING to FULL, Loading Done
*Nov  5 10:40:36.754: OSPF-1 ADJ   Vl1: Rcv LS REQ from 192.168.0.1 length 72 LSA count 4
*Nov  5 10:40:37.243: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:37.244: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:37.244: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:37.244: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:37.244: ICMP: echo reply sent, src 192.168.255.2, dst 192.168.1.2, topology BASE, dscp 0 topoid 0
*Nov  5 10:40:37.394: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:40.621: OSPF-1 ADJ   Et0/0: Rcv pkt from 192.168.24.2, area 0.0.0.0 : src not on the same network
*Nov  5 10:40:41.452: OSPF-1 ADJ   Vl1: Neighbor change event
*Nov  5 10:40:41.452: OSPF-1 ADJ   Vl1: DR/BDR election
*Nov  5 10:40:41.452: OSPF-1 ADJ   Vl1: Elect BDR 10.11.0.102
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1: Elect DR 10.11.0.103
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1: DR: 10.11.0.103 (Id)
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1:    BDR: 10.11.0.102 (Id)
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1: Neighbor change event
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1: DR/BDR election
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1: Elect BDR 10.11.0.102
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1: Elect DR 10.11.0.103
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1: DR: 10.11.0.103 (Id)
*Nov  5 10:40:41.453: OSPF-1 ADJ   Vl1:    BDR: 10.11.0.102 (Id)
*Nov  5 10:40:47.172: OSPF-1 ADJ   Et0/1: Rcv pkt from 192.168.23.2, area 0.0.0.0 : src not on the same network



!!!!Switch 3
SW3#show run
Building configuration...

Current configuration : 1272 bytes
!
! Last configuration change at 04:29:39 CST Sat Nov 5 2016
!
version 15.2
no service timestamps debug uptime
no service timestamps log uptime
no service password-encryption
service compress-config
!
hostname SW3
!
boot-start-marker
boot-end-marker
!
!
enable password cisco
!
no aaa new-model
clock timezone CST -6 0
!
!
!
!
!
!
!
!
no ip domain-lookup
ip cef
ipv6 multicast rpf use-bgp
no ipv6 cef
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Ethernet0/0
 shutdown
!
interface Ethernet0/1
 shutdown
!
interface Ethernet0/2
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface Ethernet0/3
 shutdown
!
interface Ethernet1/0
 shutdown
!
interface Ethernet1/1
 switchport access vlan 1008
 switchport mode access
!
interface Ethernet1/2
 shutdown
!
interface Ethernet1/3
 shutdown
!
interface Vlan1
 ip address 192.168.0.3 255.255.255.0
 ip ospf 1 area 0
!
interface Vlan1008
 ip address 192.168.1.33 255.255.255.0
 ip ospf 1 area 0
!
router ospf 1
!
ip forward-protocol nd
!
no ip http server
no ip http secure-server
!
!
!
!
!
!
control-plane
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
line aux 0
line vty 0 4
 password cisco
 no login
!
!
end


SW3#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 3
VTP Domain Name                 : CISCO
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc00.6700

Feature VLAN:
--------------
VTP Operating Mode                : Client
Number of existing VLANs          : 9
Number of existing extended VLANs : 1
Maximum VLANs supported locally   : 4096
Configuration Revision            : 4
Primary ID                        : aabb.cc00.6500
Primary Description               : SW1
MD5 digest                        : 0xE5 0x6D 0x8F 0x0B 0x12 0x2E 0xF7 0xF1
                                    0x48 0xE9 0xF6 0x57 0x27 0x93 0x1E 0xB4


Feature MST:
--------------
VTP Operating Mode                : Transparent


Feature UNKNOWN:
--------------
VTP Operating Mode                : Transparent


SW3#show vlan
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/0, Et0/1, Et0/3, Et1/0
                                                Et1/2, Et1/3
2    VLAN0002                         active
5    VLAN0005                         active
55   VLAN0055                         active
66   VLAN0066                         active
1002 fddi-default                     act/unsup
1003 trcrf-default                    act/unsup
1004 fddinet-default                  act/unsup
1005 trbrf-default                    act/unsup
1008 VLAN1008                         active    Et1/1

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
2    enet  100002     1500  -      -      -        -    -        0      0
5    enet  100005     1500  -      -      -        -    -        0      0
55   enet  100055     1500  -      -      -        -    -        0      0
66   enet  100066     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1003 trcrf 101003     4472  1005   3276   -        -    srb      0      0
1004 fdnet 101004     1500  -      -      -        ieee -        0      0
1005 trbrf 101005     4472  -      -      15       ibm  -        0      0
1008 enet  101008     1500  -      -      -        -    -        0      0


VLAN AREHops STEHops Backup CRF
---- ------- ------- ----------
1003 7       7       off

Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------



Again, your job is to diagnose & locate the source of the problem, please post your comments below & I will follow this up with a post detailing the solution in due course.

Friday 9 December 2016

CCIE RS Revision Series - 802.1D review questions around port allocations.

Some questions to tickle you on STP, the answers are at the bottom, let me know how you get on!

Given the topology below that is running 802.1D with all settings as default, please tell me:

1) What switch will be the Spanning-tree root bridge
a) Why will this be the root bridge?
2) What will be the BridgeID of all the BPDU's generated for VLAN 100?
a) What makes up this BridgeID value?
3)What ports on SW2 will be in the forwarding state?
a) What will the forwarding port roles be?
4) What port on SW4 will be the root port?
a) Why?
5) On Switch 4, which ports will be designated ports?
a) Why?
6) What ports will be blocked in the topology?
a) Why?







1)     What switch will be the Spanning-tree root bridge (SW2)
a.      Why will this be the root bridge? (It has the lowest MAC address, when all priories tie, this is the tiebreaker)
2)      What will be the BridgeID of all the BPDU's generated for VLAN 100? (32868)
a.      TWhat makes up this BridgeID value? (The BridgeID is the Priority+VLANID, where the default priority is 32768)
3)      What ports on SW2 will be in the forwarding state? (All of them)
a.      What will the forwarding port roles be? (all root bridge downstream ports are designated forwarding ports)
4)      What port on SW4 will be the root port? (Port 1)
a.      Why? (Root port is the one with the lowest cost to reach the root bridge, is there is a tie then it’s the lowest received BPDU, if there is still a tie then it’s the lowest received port priority, if there is still a tie it’s the lowest local port ID (where port 1 = 1, 2  = 2, and so on). Therefore the tie breaker here is the local port ID)
5)      On Switch 4, which ports will be designated ports? (0, 3 & 4)
a.      Why? (Designated Ports are calculated after Root Ports, of the two sides of the link they are calculated from the viewpoint of being on the link itself. Lets look at the SW1-Sw4 link. Here it’s a cost of 10 to reach the root via Sw1 or Sw4, therefore we look at the tiebreaker methods described in Q4a, the first item looks at the lowest BPDU where in this case SW4 has a lower one based on the MAC. Therefore SW4’s Port 0 is the DP & SW1’s Port 1 is the Alt blocked port)
6)      What ports will be blocked in the topology? (SW1’s port 1, SW4’s Port 2 & SW3’s ports 1 & 2)
a.      Why? (All opposite sides to Designated ports that are not Root facing Ports are set to Alternate Blocked ports, this is to stop loops)

Monday 9 February 2015

Using TCL to load new configs via ftp for ccie lab



Hi all,

Ok I regularly change my configs in my Lab, the only variable that changes is part of the filepath & each router uses its own hostname, eg:

For dmvpn lab
configure replace ftp://192.168.1.251//labs/dmvpn/r1.txt
configure replace ftp://192.168.1.251//labs/dmvpn/r2.txt
configure replace ftp://192.168.1.251//labs/dmvpn/r3.txt

For MPLS lab
configure replace ftp://192.168.1.251//labs/mpls/r1.txt
configure replace ftp://192.168.1.251//labs/mpls/r2.txt
configure replace ftp://192.168.1.251//labs/mpls/r3.txt




Currently is am pasting the string as follows in each device
“configure replace ftp://192.168.1.251//labs/mpls/r”
And then on each of the 20 devices I put the final bit [1.txt|2.txt|3.txt] etc & confirm this on all (the command requires confirmation via “yes”)


Yes this works, but I really am sick of going to every box to do this several times a day, so I have looked to try to make use of TCL to save time:



For my setup I have 20 CSR1000V & 1 windows VM running ftp, wireshark etc.

Base config
My base config on all boxes consists of an IP address, hostname & FTP credentials. After each lab I reset to this via:
configure replace flash:baseconfig.cfg
yes

Load lab
For my scrip lab scrips, all I now need to do is send the following syntax to all devices:
tclsh flash:labconfig.tcl  MPLS.MP.BGP/

yes


TCL Script
So the script on each box is as follows (change the hostname variable on each device).

tclsh
puts [open flash:/labconfig.tcl w] {
 set labname [lindex $argv 0]
 set hostname "r9.txt"
 typeahead "configure replace ftp://192.168.1.251//advanced.technology.labs/${labname}${hostname}"
}
tclquit

Outcome
Now when you run 'tclsh flash:labconfig.tcl  MPLS.MP.BGP/' the CLI will return the output of 'configure replace ftp://192.168.1.251// labs/dmvpn/r9.txt' which allows us as uses to just sent one single command set to every box to load a new lab.

 Granted, there probably is a better way to do this. But with the resources to hand this is all i manged to conjure up. Ultimately it works & hopefully will help another out there in the world!