FTP搭建

2018-11-13  本文已影响0人  潘俊百
TIM截图20181113143827.jpg

基础配置

R1接口配置

[R1]interface GigabitEthernet 0/0/1 
[R1-GigabitEthernet0/0/1]ip address 192.168.100.1 24

R2接口配置

[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.100.2 24

测试网络是否通畅

[R2]ping 192.168.100.1
  PING 192.168.100.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.100.1: bytes=56 Sequence=1 ttl=255 time=90 ms
    Reply from 192.168.100.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 192.168.100.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 192.168.100.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 192.168.100.1: bytes=56 Sequence=5 ttl=255 time=10 ms

  --- 192.168.100.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/32/90 ms

在R1开启ftp服务

开启ftp,并设置ftp默认家目录

[R1]ftp server enable 
Info: Succeeded in starting the FTP server
[R1]qu
<R1>dir
Directory of flash:/

  Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
    0  drw-              -  Nov 13 2018 06:15:19   dhcp
    1  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
    2  -rw-          2,263  Nov 13 2018 06:15:14   statemach.efs
    3  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip

1,090,732 KB total (784,464 KB free)
<R1>system-view 
Enter system view, return user view with Ctrl+Z.
[R1]set default ftp-directory flash:/

设置ftp用户

通过在AAA中设置用户名和密码,授权FTP合法用户连接到FTP服务器。这样,非法用户就无法连接FTP服务器,降低了安全风险。

[R1]aaa
[R1-aaa]local-user panjunbai password cipher 123456
[R1-aaa]local-user panjunbai service-type ftp
[R1-aaa]local-user panjunbai privilege level 15
[R1-aaa]local-user panjunbai ftp-directory flash:
[R1-aaa]qu
[R1]display ftp-server 
   FTP server is running          
   Max user number                 5
   User count                      0
   Timeout value(in minute)        30
   Listening port                  21
   Acl number                      0
   FTP server's source address     0.0.0.0

在R2连接R1的FTP服务器

<R2>ftp 192.168.100.1
Trying 192.168.100.1 ...

Press CTRL+K to abort
Connected to 192.168.100.1.
220 FTP service ready.
User(192.168.100.1:(none)):panjunbai
331 Password required for panjunbai.
Enter password:
230 User logged in.

[R2-ftp]dir
200 Port command okay.
150 Opening ASCII mode data connection for *.
drwxrwxrwx   1 noone    nogroup         0 Nov 13 06:15 dhcp
-rwxrwxrwx   1 noone    nogroup    121802 May 26  2014 portalpage.zip
-rwxrwxrwx   1 noone    nogroup      2263 Nov 13 06:15 statemach.efs
-rwxrwxrwx   1 noone    nogroup    828482 May 26  2014 sslvpn.zip
drwxrwxrwx   1 noone    nogroup         0 Nov 13 06:15 .
226 Transfer complete.
FTP: 327 byte(s) received in 0.100 second(s) 3.27Kbyte(s)/sec.

[R2-ftp]binary 
200 Type set to I.

上传文件并重命名

[R2-ftp]put vrpcfg.zip 123.zip
200 Port command okay.
150 Opening ASCII mode data connection for 123.zip.

 100%     
226 Transfer complete.
FTP: 573 byte(s) sent in 0.170 second(s) 3.37Kbyte(s)/sec.

下载文件

[R2-ftp]get 456.zip
200 Port command okay.
150 Opening ASCII mode data connection for 456.zip.
226 Transfer complete.
FTP: 573 byte(s) received in 0.230 second(s) 2.49Kbyte(s)/sec.
上一篇 下一篇

猜你喜欢

热点阅读