Monday, November 29, 2010

How To Play Illegal Heroes 3 Online

TCL scripts for Cisco Router (GNS3 Simulated)

CREATE SCRIPT
In order to run a script, the guideline is: 1)Create the script using a text editor and save the script with a nem (i.e. showint)
COPY THE SCRIPT INTO THE ROUTER
2)Save the script into the flash of the router (create th script into a server and then copy the script from the server to the router)
EXECUTE THE SCRIPT

First Option -> s#tclsh showint

Second Option ->
s#tclsh //enters TCL configuration mode

s(tcl)#source showint


BASIC


-> exec and ios_config commands are used in Tcl scripts executed with tclsh command.
Simple TCL Ping Scritp
####################################################
Sample of script to run a ping command to different address, at the same time. To access the tcl commnad line in Cisco router, enter the "tclsh" command.
R0#tclsh
R0(tcl)#foreach address { < 0} {set x "It's negative"} else {set x "It's zero"} +>(tcl)#1.1.1.1 +>(tcl)#2.2.2.2
+>(tcl)#3.3.3.3 <=3} {incr n 1} {+> +>(tcl)#4.4.4.4 +>(tcl)#} { puts [ exec "ping $address" ] } ####################################################

Automatically create loopback interfaces

#################################################### The command should be:
Router#conf t
Router(config)#interface loopback 1
Router(config-if)#ip address 1.1.1.1 255.255.255.0 By using tcl script, we can have:
R#tclsh R(tcl)#foreach {number address} {
1 3.3.4.1 2 3.3.4.2 3 3.3.4.3
4 3.3.4.4
5 3.3.4.5
} { puts [ ios_config "interface Loopback$number" "ip address $address255.255.255.255" ] }
####################################################


Set Hostname ####################################################
Router(tcl)#puts [ios_config "hostname R1"]
####################################################

############################################### #####

Tcl scripts in the default devices


-Change the router's configuration -> Display ios_config
-interface for example:
Router (tcl) # exec "show interfaces"





Load a script from a server
Scenario is:





sets The following script, saved as showint.tcl locate in the tftp server on my computer.

I load the script on the router's flash






and then i used it:





Reference:
http://www.anyweb.co.nz/tutorial/tclintro




Use TCL procedures

1) save file. tcl stored on an FTP server. Here is the contents of the file

proc hello {} {puts "Hello World"}


2) I copy the file from the server to flash




3) At this point I draw steps in the router:
r (tcl) # hello Hello World





Site

0 comments:

Post a Comment