今天拿华三的MER系统路由器来和大家一起学习,因为有时候我们处于运维方便或安全方便的需要,需要进入路由或可管理交换机设备的命令行下,去配置或快速方便的查看一些信息,今天给大家聊一聊,如何在命令行下配置FTP,然后通过FTP去备份路由或交换机的配置文件
准备工作:
1,一台MER3220路由器,具体硬件配置参数如下:
<H3C>display versionH3C Comware Software, Version 7.1.064, Release 6728P25Copyright (c) 2004-2022 New H3C Technologies Co., Ltd. All rights reserved. H3C MER3220 uptime is 0 weeks, 0 days, 17 hours, 8 minutes Last reboot reason : User reboot Boot image: flash:/mer3200-cmw710-boot-r6728p25.bin Boot image version: 7.1.064P80, Release 6728P25 Compiled Nov 23 2022 15:00:00 System image: flash:/mer3200-cmw710-system-r6728p25.bin System image version: 7.1.064, Release 6728P25 Compiled Nov 23 2022 15:00:00 Feature image(s) list: flash:/mer3200-cmw710-wifidog-r6728p25.bin, version: 7.1.064 Compiled Nov 23 2022 15:00:00 flash:/mer3200-cmw710-wwd-r6728p25.bin, version: 7.1.064 Compiled Nov 23 2022 15:00:00 flash:/mer3200-cmw710-security-r6728p25.bin, version: 7.1.064 Compiled Nov 23 2022 15:00:00 flash:/mer3200-cmw710-voice-r6728p25.bin, version: 7.1.064 Compiled Nov 23 2022 15:00:00 flash:/mer3200-cmw710-data-r6728p25.bin, version: 7.1.064 Compiled Nov 23 2022 15:00:00
配置阶段:
配置前请确保Device和PC之间路由可达,具体配置步骤略
IRF(FTP server)上的配置
# 在交换机上添加一个本地用户例如:root,并设置其认证密码为root12345,访问时使用的用户角色为network-admin,授权访问目录为Flash的根目录,abc可以使用的服务类型为FTP。
<Sysname> system-view [Sysname] local-user root class manage [Sysname-luser-manage-abc] password simple root12345 [Sysname-luser-manage-abc] authorization-attribute user-role network-admin work-directory flash:/
接着把ftp服务添加到账号的type中去
# local-user admin class manage password hash $h$6$j4B0HnIyMKpAYqtM$pz1q8MGLEJuvHNbEZnDcS4YEnRup+n+CVNcIwyKW6eSA8JNEwViMRoLM69/1jNGLi9nSFpbMERtsg5x6SffREA== service-type ftp service-type telnet http https terminal authorization-attribute work-directory flash:/ authorization-attribute user-role network-admin authorization-attribute user-role network-operator # ftp server enable
如果要直接访问从设备Flash的根目录,需要将“authorization-attribute work-directory flash:/”配置中的“flash:/”替换成“slot2#flash:/”。这里是irf环境 具体可以敲?补全命令查看
[Sysname-luser-manage-abc] service-type ftp [Sysname-luser-manage-abc] quit # 启动IRF的FTP服务功能。 [Sysname] ftp server enable [Sysname] quit
PC(FTP client)的配置
# 以用户名root、密码root2345登录FTP服务器。c:\> ftp 1.1.1.1 Connected to 1.1.1.1. 220 FTP service ready. User(1.1.1.1:(none)):abc 331 Password required for abc. Password: 230 User logged in.
# 将传输模式设置为ascii,并将配置文件config.cfg下载到PC本地进行备份。
ftp> ascii200 TYPE is now ASCII ftp> get config.cfg back-config.cfg# 将传输模式设置为binary,并上传文件temp.bin到主设备存储介质的根目录下。ftp> binary200 TYPE is now 8-bit binaryftp> put temp.bin# 退出FTP。 ftp> bye简单的话开启web服务 网页导出配置文件也可以
在PC机上打开命令提示符窗口,输入“ftp 192.168.1.1”回车,输入配置好的用户名密码(ftp/ftp),登录交换机的FTP服务
ftp> ascii200 TYPE is now ASCII ftp> dir 200 PORT command successful 150 Connecting to port 51726 -rw-rw-rw- 1 1 1 7142 May 24 09:42 20220620.cfg -rw-rw-rw- 1 1 1 100486 May 24 09:42 20220620.mdb -rwxrwxrwx 1 0 0 454366 Jan 1 2011 bendi.zip drwxrwxrwx 1 1 1 2048 Jun 21 2022 diagfile -rw-rw---- 1 1 1 735 Aug 2 2022 hostkey -rw-rw-rw- 1 1 1 259 May 24 09:42 ifindex.dat -rwxrwxrwx 1 0 0 4725 May 25 01:29 lauth.dat drwxrwxrwx 1 0 0 2048 Jan 1 2011 license drwxrwxrwx 1 1 1 2048 May 24 18:48 logfile -rwxrwxrwx 1 0 0 6582272 Jan 1 2017 mer3200-cmw710-boot-r0821p18.bin -rwxrwxrwx 1 0 0 6508544 Jan 1 2017 mer3200-cmw710-boot-r6728p25.bin -rwxrwxrwx 1 0 0 3885056 Jan 1 2017 mer3200-cmw710-data-r0821p18.bin -rwxrwxrwx 1 0 0 4040704 Jan 1 2017 mer3200-cmw710-data-r6728p25.bin -rwxrwxrwx 1 0 0 571392 Jan 1 2017 mer3200-cmw710-security-r0821p18.bin -rwxrwxrwx 1 0 0 581632 Jan 1 2017 mer3200-cmw710-security-r6728p25.bin -rwxrwxrwx 1 0 0 59598848 Jan 1 2017 mer3200-cmw710-system-r0821p18.bin -rwxrwxrwx 1 0 0 64691200 Jan 1 2017 mer3200-cmw710-system-r6728p25.bin -rwxrwxrwx 1 0 0 10240 Jan 1 2017 mer3200-cmw710-voice-r0821p18.bin -rwxrwxrwx 1 0 0 10240 Jan 1 2017 mer3200-cmw710-voice-r6728p25.bin -rwxrwxrwx 1 0 0 84992 Jan 1 2017 mer3200-cmw710-wifidog-r0821p18.bin -rwxrwxrwx 1 0 0 83968 Jan 1 2017 mer3200-cmw710-wifidog-r6728p25.bin -rwxrwxrwx 1 0 0 93184 Jan 1 2017 mer3200-cmw710-wwd-r0821p18.bin -rwxrwxrwx 1 0 0 93184 Jan 1 2017 mer3200-cmw710-wwd-r6728p25.bin drwxrwx--- 1 1 1 2048 Jan 1 2011 pki drwxrwxrwx 1 1 1 2048 Jan 1 2011 seclog -rw-rw---- 1 1 1 591 Aug 2 2022 serverkey -rw-rw-rw- 1 1 1 3738 Jun 20 2022 startup.cfg -rw-rw-rw- 1 1 1 73697 Jun 20 2022 startup.mdb -rwxrwxrwx 1 0 0 72830 Jan 1 2011 weixin.zip 226 29 matches total ftp: 收到 2457 字节,用时 0.03秒 72.26千字节/秒。ftp> get startup.cfg e:/back_startup.cfg #备份到PC的 e:/back_startup.cfg200 PORT command successful 150 Connecting to port 51730 226 File successfully transferred ftp: 收到 3904 字节,用时 0.00秒 1952.00千字节/秒。 ftp>
执行“get config.cfg”,将交换机的配置文件下载到PC机的当前目录。(如果用户以Administrator登录PC,则默认的本地目录是C:\Documents and Settings\Administrator。另存为其它位置执行:ftp> get startup.cfg e:/back_startup.cfg
# 将传输模式设置为binary,并上传文件temp.bin到主设备存储介质的根目录下
ftp> binary200 TYPE is now 8-bit binaryftp> put temp.bin# 退出FTP。 ftp> bye
ftp> binary200 TYPE is now 8-bit binaryftp> put e:/back_startup.cfg200 PORT command successful 150 Connecting to port 51801 226 File successfully transferred ftp: 发送 3904 字节,用时 0.39秒 9.91千字节/秒。 ftp> dir 200 PORT command successful 150 Connecting to port 51802 -rw-rw-rw- 1 1 1 7142 May 24 09:42 20220620.cfg -rw-rw-rw- 1 1 1 100486 May 24 09:42 20220620.mdb -rw-rw-rw- 1 1 1 3904 May 25 01:37 back_startup.cfg -rwxrwxrwx 1 0 0 454366 Jan 1 2011 bendi.zip drwxrwxrwx 1 1 1 2048 Jun 21 2022 diagfile -rw-rw---- 1 1 1 735 Aug 2 2022 hostkey -rw-rw-rw- 1 1 1 259 May 24 09:42 ifindex.dat -rwxrwxrwx 1 0 0 4725 May 25 01:37 lauth.dat drwxrwxrwx 1 0 0 2048 Jan 1 2011 license drwxrwxrwx 1 1 1 2048 May 24 18:48 logfile -rwxrwxrwx 1 0 0 6582272 Jan 1 2017 mer3200-cmw710-boot-r0821p18.bin -rwxrwxrwx 1 0 0 6508544 Jan 1 2017 mer3200-cmw710-boot-r6728p25.bin -rwxrwxrwx 1 0 0 3885056 Jan 1 2017 mer3200-cmw710-data-r0821p18.bin -rwxrwxrwx 1 0 0 4040704 Jan 1 2017 mer3200-cmw710-data-r6728p25.bin -rwxrwxrwx 1 0 0 571392 Jan 1 2017 mer3200-cmw710-security-r0821p18.bin -rwxrwxrwx 1 0 0 581632 Jan 1 2017 mer3200-cmw710-security-r6728p25.bin -rwxrwxrwx 1 0 0 59598848 Jan 1 2017 mer3200-cmw710-system-r0821p18.bin -rwxrwxrwx 1 0 0 64691200 Jan 1 2017 mer3200-cmw710-system-r6728p25.bin -rwxrwxrwx 1 0 0 10240 Jan 1 2017 mer3200-cmw710-voice-r0821p18.bin -rwxrwxrwx 1 0 0 10240 Jan 1 2017 mer3200-cmw710-voice-r6728p25.bin -rwxrwxrwx 1 0 0 84992 Jan 1 2017 mer3200-cmw710-wifidog-r0821p18.bin -rwxrwxrwx 1 0 0 83968 Jan 1 2017 mer3200-cmw710-wifidog-r6728p25.bin -rwxrwxrwx 1 0 0 93184 Jan 1 2017 mer3200-cmw710-wwd-r0821p18.bin -rwxrwxrwx 1 0 0 93184 Jan 1 2017 mer3200-cmw710-wwd-r6728p25.bin drwxrwx--- 1 1 1 2048 Jan 1 2011 pki drwxrwxrwx 1 1 1 2048 Jan 1 2011 seclog -rw-rw---- 1 1 1 591 Aug 2 2022 serverkey -rw-rw-rw- 1 1 1 3738 Jun 20 2022 startup.cfg -rw-rw-rw- 1 1 1 73697 Jun 20 2022 startup.mdb -rwxrwxrwx 1 0 0 72830 Jan 1 2011 weixin.zip 226 30 matches total ftp: 收到 2537 字节,用时 0.03秒 76.88千字节/秒。 ftp>
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/5647.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~