drjens
Goto Top

Per Putty auf mehrere Cisco IOS-Geräte verbinden und Befehl ausführen

Hallo zusammen,

ich hoffe meine Überschrift ist eindeutig face-smile

Kurz knapp mein Vorhaben:

- Ich möchte mich via Putty mit mehrere Cisco Access Points verbinden.
- Anschließend soll ein Befehl ausgeführt werden. Der Befehl ist auf allen Access Points der selbe.
- Die Geräte haben jeweils eine feste IP und ein Passwort.

"D:\Downloads\putty.exe -load [hostip/hostname]-pw [password]"
- Der Befehl ist in einer .bat gespeichert, wenn ich ihn aber aufrufe, öffnet sich nur Putty und es wird keine Session geöffnet.


Wie bekomme ich das nun gescheit hin?

Gruß,
drjens

Content-Key: 226846

Url: https://administrator.de/contentid/226846

Ausgedruckt am: 29.03.2024 um 11:03 Uhr

Mitglied: colinardo
Lösung colinardo 16.01.2014 aktualisiert um 13:11:23 Uhr
Goto Top
Hallo drjens, Willkommen im Forum!
schau dir mal das Tool plink an das das Putty-Äquivalent vom selben Hersteller für die Kommandozeile ist. Damit kannst du auch Putty-Sessions laden. Du packst deine Remote-Befehle in eine Textdatei und machst in deiner Batch dann solch eine Zeile
plink -l USERNAME -pw PASSWORT -batch -m deineRemoteBefehle.txt deinserver.com

PuTTY Link: command-line connection utility
Release 0.63
Usage: plink [options] [user@]host [command]
       ("host" can also be a PuTTY saved session name)
Options:
  -V        print version information and exit
  -pgpfp    print PGP key fingerprints and exit
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -ssh -telnet -rlogin -raw -serial
            force use of a particular protocol
  -P port   connect to specified port
  -l user   connect with specified username
  -batch    disable all interactive prompts
The following options only apply to SSH connections:
  -pw passw login with specified password
  -D [listen-IP:]listen-port
            Dynamic SOCKS-based port forwarding
  -L [listen-IP:]listen-port:host:port
            Forward local port to remote address
  -R [listen-IP:]listen-port:host:port
            Forward remote port to local address
  -X -x     enable / disable X11 forwarding
  -A -a     enable / disable agent forwarding
  -t -T     enable / disable pty allocation
  -1 -2     force use of particular protocol version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key    private key file for authentication
  -noagent  disable use of Pageant
  -agent    enable use of Pageant
  -m file   read remote command(s) from file
  -s        remote command is an SSH subsystem (SSH-2 only)
  -N        don't start a shell/command (SSH-2 only)
  -nc host:port
            open tunnel in place of session (SSH-2 only)
  -sercfg configuration-string (e.g. 19200,8,n,1,X)
            Specify the serial configuration (serial only)
Grüße Uwe
Mitglied: drjens
drjens 16.01.2014 um 13:12:15 Uhr
Goto Top
Hallo Uwe,

danke für deinen Beitrag.

Leider funktioniert das nicht. Laut plink Doku ist -pw auch nur per SSH möglich. Ich muss mich aber per telnet mit den Access Points verbinden.

Gruß
drjens
Mitglied: colinardo
colinardo 16.01.2014 aktualisiert um 13:38:59 Uhr
Goto Top
Zitat von @drjens:
Leider funktioniert das nicht. Laut plink Doku ist -pw auch nur per SSH möglich. Ich muss mich aber per telnet mit den Access Points verbinden.
das hättest du erwähnen müssen, das du telnet meinst...
Siehe das hier für dein Vorhaben:
http://code.google.com/p/telmatic-win-au3/
Mitglied: aqui
aqui 16.01.2014 aktualisiert um 13:45:32 Uhr
Goto Top
Alternativ kannst du TeraTerm benutzen:
http://ttssh2.sourceforge.jp
Dort ist ein Scripting mit an Bord.
Alternativ auch ZOC http://www.emtec.com/zoc/ das aber nicht kostenlos ist.
Im Internet gibt es aber zuhauf fertige Scripting Lösungen unter Linux/Winblows für diese Aufgaben.

Letztlich stellt sich die Frage warum du nicht ganz einfach crypto key generate rsa auf den APs ausführst, denn kommst du mit SSH genau so easy drauf wie mit Telnet nur schnüffelsicher denn du überträgst das Passwort in Klartext.
Mit dem einfachen Kommando vorab im AP klappt es dann auch mit plink problemlos !