Showing posts with label TCL Scripts. Show all posts
Showing posts with label TCL Scripts. Show all posts

Tuesday, July 29, 2008

Switch Macros

Take a look at this examples of Switch Macros  available at the Switching Video-on-Demand from IPExpert, just a few, but, the possibilities for it are huge!

First one... Create a Macro to configure our "Access-Ports", this will include the VLAN, Portfast, BPDUGuard and Storm-Control... Seens simple... but how the assign the correct VLAN to each port?! Using variables!  Take a look:

macro name Port
switchport mode access
switchport access vlan $V
spanning-tree portfast
spanning-tree bpduguard enable
storm-control $T level $L
@

Now,  apply this to port FastEthernet 0/10 for example, and assign it to VLAN 10, Storm-Control Type Broadcast and Level 20:

int fa0/10
macro trace Port $V 10 $T broadcast $L 20

See?! Easy! One line, instead of 5!

In the show run, the field macro description Port | Port will show us how many times this macro "Port" (the one we created earlier) was applied to this interface (in this specific case, 2 times!).

Macro Example

Another example, a macro to create some VLANs:

macro name MakeVlan
vlan 101
name My101
vlan 102
name My102
vlan103
name My103
exit
@

Just be careful, after the last VLAN (in our case vlan103) we need to type exit, if you don´t, this VLAN will not be created!

We can double check if everything is ok with the command: sh vlan brief

Another tip in this Video is if you get asked to assign a data VLAN, Voice VLAN and Portsecure allowing 2 Mac-Addresses in this port using just one command line (I talked briefly about it yesterday), how to do it?!

Seens a bit strange, but possible, first, check the Macros "pre-defined" in your switch using the command: show parser macro , your output will look much similar to this one:

Show Parser Macro Example

Now that we found our macro, apply it to the desired interface:

int f0/16
macro apply cisco-phone $access_vlan 10 $voice_vlan 20

And finally, take a look at the configuration:

Macro Apply

You may ask yourself, how the proctor is going to grade that?! How he´s going to know that I actually used a Macro, or even better, how he´s going to know that I didn´t created a Macro to do it, and just deleted from the Switch after that?!

Well... the answer is simple... first, take a look at the line: macro description cisco-phone this description is telling us that this specific macro (cisco-phone in this case) was applied to this interface. Also, the macro configured the VLANs (Data and Voice) and Portsecure as asked, but it also configured some extra stuff (QoS, Portfast, etc), and that tells the Proctor that you actually used this macro! So, be cool, just understand exactly what the question is asking, and you´ll be fine!

To apply a macro we can use the commands:

  • macro apply <macro-name>
  • macro trace <macro-name> -> if you want to see it going through the commands.
  • macro global apply <macro-name>
  • macro global trace <macro-name> -> if you want to see it going through the commands.

Thursday, July 24, 2008

TCL Script

This Video is included in IPExpert CCIE R&S BLS as one of the last things... but I couldn´t just hold to check it, and see if there´s any tips, advices, or anything else that could help in the exam! And what do I have discovered?! Yes, there is a few things I didn´t knew! COOL!

First thing... in order to mount your TCL Script you´ll need to get all IP Addresses from your devices, but, there´s this easy way showed in the Video-on-Demand, just follow those steps:

First, log into each device, and type the command:

sh ip int brief | ex una

Second, and most important (that´s the part I didn´t knew!), in SecureCRT, if you hold the ALT key, and use your mouse to mark the text to be copied, you can select just what you want, in this case, just the IP Addresses from the command output! Take a look at this screenshot:

image

So easy! I used to copy the full line, cut off what I didn´t want, and use the IP Address! Now you just have to past it into the Notepad:

image

You´ll need to log in each device, and build a list of ALL IP Addresses in order to create your TCL Script, that shouldn´t take more than 05, maybe 10min, and in the end you´ll have everything at your disposal! :)

Another good advice in there regards WHEN to do TCL ping testing. We all know that we need to check connectivity several times a day, but, most important after the:

  1. IGP section;
  2. Redistribution section;
  3. BGP section;
  4. Security section;
  5. Last thing of the day (if you got time to fix any issues that may find).

And any other time you think you need to check it!

Always keep your diagram updated, with all information you judge as usefull, so if you have any failures you should be able to quickly identify why and determine if this makes any difference! In case of any doubts, proctor is always there for us!

Also, if you have any "Backbone" IP Addresses that should be reachable, add it to your TCL Script manually, and that´s it!

To exit the TCL Shell just type: tclquit

Remember, 3550 switches doesn´t support TCL, we can create some Global Macros to achieve the same results.