HCNA-5 配置通过FTP进行文件操作
1、基本配置
R1<Huawei>clocktimezone BJ add 8:00:00 <Huawei>clockdatetime 22:34 2020-04-23 <Huawei>system-view [Huawei]headerlogin information "Welcome to ipgzj.com" [Huawei]headershell information "Welcome to zurkj.com" [Huawei]sysnameR1 [R1]interfacegigabitethernet 0/0/0 [R1-GigabitEthernet0/0/0]ipaddress 10.1.1.1 24 [R1-GigabitEthernet0/0/0]quit [R1]interfacegigabitethernet 0/0/1 [R1-GigabitEthernet0/0/1]ipaddress 10.1.2.1 24 [R1-GigabitEthernet0/0/1]quit [R1]display ipinterface brief [R1]return <R1>save
2、配置FTP Server 使用R1 FTP连接服务器 <R1>ftp10.1.2.100 Trying 10.1.2.100... Press CTRL+K toabort Connected to10.1.2.100. 220 FtpServerTryFtpD for free User(10.1.2.100: (none)):zurkj //初次登录创建用户名 331 Passwordrequired for zurkj . Enter password: //创建密码 230 User zurkjlogged in , proceed [R1-ftp]
[R1-ftp]ls //LS 查看FTP服务器文件状态 200 Portcommand okay. 150 OpeningASCII NO-PRINT mode data connection for ls -l. Config 226Transfer finished successfully. Data connection closed. FTP: 8byte(s) received in 0.200 second(s) 40.00byte(s)/sec.
[R1-ftp]cdconfig //进入config文件夹 250"/config" is current directory.
[R1-ftp]dir //查看文件属性 200 Portcommand okay. 150 OpeningASCII NO-PRINT mode data connection for ls -l. -rwxrwxrwx 1 zurkj nogroup 20 Apr 23 2020 test.txt 226Transfer finished successfully. Data connection closed. FTP: 68byte(s) received in 0.140 second(s) 485.71byte(s)/sec.
[R1-ftp]gettest.txt //下载test.txt到本地路由器 200 Portcommand okay. 150 Sendingtest.txt (20 bytes). Mode STREAM Type BINARY
100% _226Transfer finished successfully. Data connection closed. FTP: 20byte(s) received in 0.110 second(s) 181.81byte(s)/sec.
[R1-ftp]puttest.txt ipgzj.txt //上传test.txt到FTP服务器并重命名文件为ipgzj.txt 200 Portcommand okay. 150 OpeningBINARY data connection for ipgzj.txt
100% 226Transfer finished successfully. Data connection closed. FTP: 20byte(s) sent in 0.110 second(s) 181.81byte(s)/sec.
[R1-ftp]cd.. //返回上一级 [R1-ftp]ls 200 Portcommand okay. 150 OpeningASCII NO-PRINT mode data connection for ls -l. Config ipgzj.txt 226Transfer finished successfully. Data connection closed. FTP: 19byte(s) received in 0.210 second(s) 90.47byte(s)/sec. [R1-ftp]quit 221Goodbye.
3、配置路由器为FTPServer [R1]ftpserver enable //FTP服务开启 配置FTP的用户名和密码: [R1-aaa]local-userzurkj password cipher admin1234 privilege level 15 //配置本地用户 密码为密文显示 特权级别15 [R1-aaa]local-userzurkj service-type ftp //配置本地用户 服务类型 FTP [R1-aaa]local-userzurkj ftp-directory flash: //配置本地FTP用户可访问的目录
使用PC FTP Clinet 上传文件到FTP路由器
注意PC FTP Clinet登录的FTP用户名和密码为路由器上创建的。
<R1>dir //查看文件属性 Directoryof flash:/
Idx Attr Size(Byte) Date Time(LMT) FileName 0 drw- - Apr 23 2020 14:27:37 dhcp 2 -rw- 121,802 May 26 2014 09:20:58 portalpage.zip 3 -rw- 20 Apr 23 2020 22:58:42 test.txt 5 -rw- 2,263 Apr 23 2020 14:27:27 statemach.efs 6 -rw- 828,482 May 26 2014 09:20:58 sslvpn.zip 7 -rw- 249 Apr 23 2020 22:42:09 private-data.txt 8 -rw- 591 Apr 23 2020 22:42:09 vrpcfg.zip
1,090,732KB total (784,452 KB free) |