miércoles, 29 de octubre de 2014
miércoles, 23 de julio de 2014
VBSCRIPT: COPIA DE CONFIGURACIONES A UN TFTP
VBSCRIPT: COPIA DE
CONFIGURACIONES A UN TFTP
Automatización
para copiar el archivo de configuración de varios switch dell ,en este caso a
un servidor tftp utilizando un script
.vbs y el Secure crt.
Como
material de referencia tome información de los siguientes enlaces:
http://foro.elhacker.net/scripting/tutorial_vbscript-t229032.0.html
http://loquehayenmedio.blogspot.com/search/label/VBScript
Para la ejecución dl script inicio sesión
en un router utilizando el secureCRT y busco el scritp previa mente guardado.
Acá dejo el
archivo el cual se edita en un archivo de texto y se guarda con la extensión
.vbs :
Básicamente explico las variables
para poder ejecutar el script, en lo enlaces anteriores esta la información de
las características de programación.
*************************************************************************
#$language =
"VBScript"
#$interface =
"1.0"
Sub Main
Const
username = "USUARIO" ' Usuario que utilizara para conectarse al
switch
Const password = "CONTRASEÑA" ' Contraseña válida
para el USUARIO
Const passenable = "CONT-ENABLE" ' Contraseña
enable de ser requerido
const yes =
"y"
Const
DEVICE_FILE_PATH = "E:\IP.TXT" 'Archivo con direccionamiento IP
Const
DEVICE_FILE_PATH2 = "E:\CONFIGURACION.TXT" 'Archivo nombres para guardar las
configuraciones.
Dim fso
Set
fso = CreateObject("Scripting.FileSystemObject") 'Creacion de objeto para el archivo IP.
Dim fso2
Set
fso2 = CreateObject("Scripting.FileSystemObject") 'Creacion de objeto
para el archivo CONFIGURACION
Dim
fil
Set
fil = fso.OpenTextFile(DEVICE_FILE_PATH) 'Variable
Dim
fil2
Set
fil2 = fso.OpenTextFile(DEVICE_FILE_PATH2)
Dim
ip ' variable para llamar la ip del switch
Dim ip2 'variable para llamar el nombre del archivo (como
va a quedare guardado en el tftp)
Dim line
Dim line2
Dim
cnxnString
While Not fil.AtEndOfStream
line
= fil.ReadLine ' forma como se leera el archivo
line2 = fil2.readline
ip = Split(line, ";")(0) 'sintaxis para llamar la ip
ip2 = Split(line2,
";")(0) 'sintaxis para llamar el nombre del archivo
cnxnString = "TELNET " & ip &
"23"
crt.Screen.Send "telnet " & ip & chr(13) 'formato para ejecutar las sentencias cli
crt.Screen.WaitForString "User:"
crt.Screen.Send username
crt.Screen.Send vbCr
crt.Screen.WaitForString
"Password:"
crt.Screen.Send password
crt.Screen.Send vbCr
crt.Screen.WaitForString
">"
crt.Screen.Send
vbCr
crt.Screen.Send
" enable" & chr(13)
crt.Screen.Send passenable
crt.Screen.Send
vbCr
crt.Screen.Send
"copy running-config startup-config" & chr(13) ´comando a enviar
crt.Screen.WaitForString
"(y/n)" 'lo que esperamos que salga
crt.Screen.Send yes 'la respuesta que damos
crt.Screen.Send vbCr 'espera para enviar el siguiente comando
crt.Screen.Send "copy
running-config backup-config" & chr(13)
crt.Screen.WaitForString "(y/n)"
crt.Screen.Send
yes
crt.Screen.Send
vbCr
crt.Screen.Send
"copy running-config tftp://192.168.5.55/" & ip2 & chr(13)
crt.Screen.WaitForString
"(y/n)"
crt.Screen.Send
yes
crt.Screen.Send
vbCr
crt.Screen.Send
"q" & chr(13)
crt.Screen.Send
vbCr
crt.Screen.WaitForString
"closed by foreign host]"
Wend
fil.Close
End Sub
*****************************************************************************
IP.TXT
192.168.1.1;
192.168.2.1;
192.168.3.1;
****************************************************************************
CONFIGURACION.TXT
SWITCH1;
SWITCH2;
SWITCH3;
*****************************************************************************
jueves, 17 de julio de 2014
Configuración de SSH en switch del 6248
Configuración de SSH en switch del 6248
!System
Description "PowerConnect 6248, 3.3.11.2, VxWorks 6.5"
Para
habilitar el servicio SSH en los switch 6248 debemos generar las llaves sobre
RSA y DSA, si es necesario que las dos estén activadas
de los contrario no nos deja establecer la conexión.
Como lo
vamos hacer, primero intentaremos
activar el servicio
console(config)#ip ssh server
SSH could not be enabled.
Como se observa no deja activar el servicio, para lograr lo generamos las llaves asi:
console(config)#crypto key generate ?
dsa Generate DSA key pairs.
rsa Generate RSA key pairs.
console(config)#crypto
key generate rsa
RSA key generation started, this may take a few
minutes........
RSA key generation complete.
console(config)#crypto key generate dsa
DSA key generation started, this may take a few
minutes..........................................
DSA key generation complete.
Una vez generadas las llaves ya podemos activar el servicio y ssh
console(config)#ip
ssh protocol 2
console(config)#ip
ssh server
Ya conectados validamos si esta activo el servicio
Connection Host Address Port
----------
------------------------ ------------------------ -----------
0 10.1.1.2 10.15.15.25 Telnet
1
10.1.1.2 10.15.15.25 SSH
Para terminar y como seria obvio deshabilitamos el servicio telnet
console(config)#ip telnet server disableconsole(config)#*** CONNECTION CLOSED BY ADMIN ***Sorry, new remote sessions are disallowed by
current switch configuration.
Para verificar si las llaves estan generadas utilizamos el siguiente comando:
console#show crypto key mypubkey
RSA key data:
ssh-rsa AAAAB3NzaC1yc2EAAA
DSA key data:
ssh-dss AAAAB3NzaC1kc3MAAmiércoles, 16 de julio de 2014
Configuracion SNMP, V3, sin Autenticacion en Switch DELL
Siendo casi una copia de Cisco la configuracion del SNMP v3 en un switch Dell quda de la sigueinte manera
snmp-server view LECTURA internet included
snmp-server view LECTURA internet included
snmp-server group LECTOR v3 noauth read LECTURA
snmp-server user LEE LECTOR
snmp-server community test ro
y en mi snmpc asi:
Suscribirse a:
Entradas
(
Atom
)




