| 主機(jī)參考:VPS測評參考推薦/專注分享VPS服務(wù)器優(yōu)惠信息!若您是商家可以在本站進(jìn)行投稿,查看詳情!此外我們還提供軟文收錄、PayPal代付、廣告贊助等服務(wù),查看詳情! |
| 我們發(fā)布的部分優(yōu)惠活動文章可能存在時效性,購買時建議在本站搜索商家名稱可查看相關(guān)文章充分了解該商家!若非中文頁面可使用Edge瀏覽器同步翻譯!PayPal代付/收錄合作 |
利用Python腳本登錄交換機(jī)實(shí)現(xiàn)自動配置備份的方法有哪些?下面跟著小編一起來看看吧。
一、Python腳本
ssh = paramiko.SSHClient()ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())ssh.connect("10.x.x.x", 22,"用戶名","密碼",allow_agent=False,look_for_keys=False)
command = 'sh running-config r '
stdin, stdout, stderr = ssh.exec_command(command)#stdin, stdout, stderr = ssh.invoke_shell(command)a=[]result = stdout.readlines()
if not result:result = stderr.read()
backup=open("/root/worke/beifen/beifen.txt","w")
for line in result:print(line)backup.write(line)
backup.close()ssh.close()
看完上文,你對利用Python腳本登錄交換機(jī)實(shí)現(xiàn)自動配置備份的方法大概了解了嗎?如果想了解更多,歡迎關(guān)注主機(jī)參考行業(yè)資訊頻道哦
What are the methods to automatically configure backup by using Python script to log in switch? Let's follow Xiaobian to have a look.
1、 Python script
SSH = paramiko. Sshclient(), SSH. Set 58853; missing host key policy (paramiko. Autoaddpolicy()), SSH. Connect ("10. X.x.x", 22, "user name", "password", allow agent = false, look for keys = false)
command = 'sh running-config r '
stdin, stdout, stderr = ssh.exec_command(command)#stdin, stdout, stderr = ssh.invoke_shell(command)a=[]result = stdout.readlines()
if not result:result = stderr.read()
backup=open("/root/worke/beifen/beifen.txt","w")
for line in result:print(line)backup.write(line)
backup.close()ssh.close()
After reading the above, do you have a general idea of how to use Python script to log in to the switch to automatically configure the backup? If you want to learn more, please pay attention to the host reference industry information channel
--------------------------------------------------------------
主機(jī)參考,收集國內(nèi)外VPS,VPS測評,主機(jī)測評,云服務(wù)器,虛擬主機(jī),獨(dú)立服務(wù)器,國內(nèi)外服務(wù)器,高性價比建站主機(jī)相關(guān)優(yōu)惠信息@m.k2270.com
詳細(xì)介紹和測評國外VPS主機(jī),云服務(wù)器,國外服務(wù)器,國外主機(jī)的相關(guān)優(yōu)惠信息,商家背景,網(wǎng)絡(luò)帶寬等等,也是目前國內(nèi)最好的主機(jī)云服務(wù)器VPS參考測評資訊優(yōu)惠信息分享平臺
這幾篇文章你可能也喜歡:
- SpinServers,美國服務(wù)器首月特價$85/月,美國達(dá)拉斯機(jī)房,Gold 6122處理器32G內(nèi)存10Gbps帶寬
- CloudCone,新機(jī)房上線/新西蘭奧克蘭獨(dú)立服務(wù)器上線$80.81/月起,支持虛擬化/安全策略等,默認(rèn)1Gbps帶寬/10TB月流量
- 0?? -hengchuang Technology 618折扣:整個服務(wù)器上有25%的折扣,您將獲得高的防御IP,并且對老年用戶的更新將從開始。
- Raksmart:新年特別優(yōu)惠,美國服務(wù)器的每月付款起價為30美元,云主機(jī)起價為14.99美元/年
- ACEBGP:美國雙ISP殼體IP VPS高速AS9929網(wǎng)絡(luò)解鎖流和國際應(yīng)用
本文由主機(jī)參考刊發(fā),轉(zhuǎn)載請注明:利用Python腳本登錄交換機(jī)實(shí)現(xiàn)自動配置備份的方法 http://m.k2270.com/12360.html
主機(jī)參考

















評論前必須登錄!
注冊