Created
December 23, 2015 15:19
-
-
Save shutingrz/81fcc11251a93564a3ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'expect4r' | |
#gem install expect4r | |
@tftps = "" #tftpserver ipaddress or hostname | |
def bak_config(host,username,password, filename) | |
ios = Expect4r::Ios.new_telnet( | |
host: host, | |
user:username, | |
pwd: password, | |
enable_password: password | |
) | |
ios.login | |
ios.to_exec | |
puts ios.putline("copy startup-config tftp:\r" + @tftps + "\r" + filename , no_trim:true) | |
end | |
#bak_config("target_host","username","password","filename") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment