Ethernet Switches & Routers

Reply
Occasional Contributor
Posts: 8
Registered: ‎09-09-2003

Does anyone have an example of a configupload script using ssh without expect?

Does anyone have an example of a configupload script using ssh without expect?

I need to modify my old script that used telnet to use ssh. I would prefer not to have to install expect. Any ideas or examples would be appreciated. Thank you.

Occasional Contributor
Posts: 14
Registered: ‎07-20-2010

Re: Does anyone have an example of a configupload script using ssh without expect?

You can SCP the file to flash, running config, append to running config, etc.  Check it:

Taken from a NetIron manual I had on me:

C:\> scp c:\<src-file> terry@192.168.1.50:flash:<dst-file>
To copy and append a configuration file (c:\cfg\brocadehp.cfg) to the running configuration file on
an NetIron at 192.168.1.50 and log in as user terry, enter the following command on the SCP-enabled client.
C:\> scp c:\cfg\brocadehp.cfg terry@192.168.1.50:runConfig
If you are copying the configuration file from the NetIron to a PC or another machine (outbound), the command saves the running configuration file to the PC. If you are copying a configuration file from a PC to the NetIron, (inbound) the command appends the source file to the running configuration file on the NetIron.
If password authentication is enabled for SSH, the user is prompted for user terry’s password before the file transfer takes place.
To copy and overwrite the current running configuration file, enter the following command.
C:\> scp c:\cfg\brocadehp.cfg terry@192.168.1.50:runConfig-overwrite
If you are copying a configuration file from a PC to the NetIron, (inbound) the command replaces the source file on the NetIron.
To copy the configuration file to the startup configuration file.
C:\> scp c:\cfg\brocadehp.cfg terry@192.168.1.50:startConfig
To copy the configuration file to a file called config1.cfg on the PCMCIA flash card in slot 1 on a management module.
C:\> scp c:\cfg\brocade.cfg terry@192.168.1.50:slot1:/config1.cfg
To copy the configuration file to a file called config1.cfg on the PCMCIA flash card in slot 2 on a management module.
C:\> scp c:\cfg\brocade.cfg terry@192.168.1.50:slot2:/config1.cfg
To copy the running configuration file on an NetIron to a file called c:\cfg\fdryhprun.cfg on the SCP-enabled client.
C:\> scp terry@192.168.1.50:runConfig c:\cfg\fdryhprun.cfg
To copy the startup configuration file on an NetIron to a file called c:\cfg\fdryhpstart.cfg on the SCP-enabled client.
C:\> scp terry@192.168.1.50:startConfig c:\cfg\fdryhpstart.cfg
To copy the software image (for example, xmr03300b228.bin) to the primary flash.
C:\> scp c:\xmr03300b228.bin local@192.168.1.50:flashSmiley Tonguerimary
To copy the software image (for example, xmr03300b228.bin) to the secondary flash.
C:\> scp c:\xmr03300b228.bin local@192.168.1.50:flash:secondary
Super Contributor
Posts: 635
Registered: ‎04-12-2010

Re: Does anyone have an example of a configupload script using ssh without expect?

Hi,

I like to use Perl for such a task. Take a linux box and install Perl including the Perl net::ssh package. Then you can run a task to collect all your configs from all your boxes in a regular way by using the cron deamon.

If you are not a "linux guru" try to install on a Windows box Cygwin and install Perl and all needed packages within the Cygwin environment.

This works fine too.

Avoid using Perl native on Windows. I the past it was difficult to install a running ssh session within ActiveState Perl. Windows doesn't support out of the box openssh. I does not know if the ActiceState Perl support for SSH is better now. I havn't checked it since one year.

Andreas

Super Contributor
Posts: 425
Registered: ‎03-03-2010

Re: Does anyone have an example of a configupload script using ssh without expect?

an FTP server is necessary for this. it is very easy to take the configupload, do u want to run the script for more than one SW

Occasional Contributor
Posts: 8
Registered: ‎09-09-2003

Re: Does anyone have an example of a configupload script using ssh without expect?

I want to run this from an AIX server to backup config changes as we make them. Currently have 18 Brocade switches & Directors in multiple locations.

I have a script that uses Telnet running on a HPUX server but we are migrating to the AIX server and I want to use ssh instead of telnet.

Thank you for your response.

Tony Rivera

Occasional Contributor
Posts: 14
Registered: ‎07-20-2010

Re: Does anyone have an example of a configupload script using ssh without expect?

Are the config changes performed by script as well or manually?  If it's a manual change and the changes validated manually, then it seems like you can add a step to where you send the config via tftp from the switches to your server.  Or still use SCP for upload to the switch or down to the server.  That's my $0.02.

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.