欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

HCIA中如何配置FTP服务器

程序员文章站 2022-03-10 18:12:47
...

1.1 问题

  1. 如图配置IP地址
  2. 将R1配置为FTP服务器,用户名和密码为huawei/HCIE
  3. 将R2配置为FTP客户端,从服务器下载文件

1.2 方案

使用eNSP搭建实验环境,如图-1所示。

HCIA中如何配置FTP服务器

图-1

1.3 步骤

实现此案例需要按照如下步骤进行。

1)配置IP地址,确保设备互通

    <Huawei>undo terminal monitor
    [Huawei]sysname R1     
    [R1]interface GigabitEthernet 0/0/1
    [R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24
    [R1-GigabitEthernet0/0/0]quit
    <Huawei>undo terminal monitor
    [Huawei]sysname R2     
    [R2]interface GigabitEthernet 0/0/1
    [R2-GigabitEthernet0/0/0]ip add 192.168.12.2 24
    [R2-GigabitEthernet0/0/0]quit

2)配置R1为FTP服务器

    [R1]ftp server enable //开启FTP服务器功能
    [R1]set default  ftp-directory  flash:/  //设定默认的 FTP 根目录
    [R1]aaa    
    [R1-aaa]local-user huawei password cipher HCIE //创建用户和密码
    [R1-aaa]local-user huawei service-type  ftp    //指定用户的服务类型为FTP
    [R1-aaa]local-user huawei ftp-directory flash: //指定该用户的FTP登录目录
    [R1-aaa]local-user huawei privilege level 15   //指定该用户的权限为*别15

3)R2登录FTP服务器,下载并查看文件

    <R2>ftp 192.168.12.1    //登录FTP服务器
    Trying 192.168.12.1 ...
    Press CTRL+K to abort
    Connected to 192.168.12.1.
    220 FTP service ready.
    User(192.168.12.1:(none)):huawei
    331 Password required for huawei.
    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 Mar 25 06:32 dhcp
    -rwxrwxrwx   1 noone    nogroup      2263 Mar 25 06:40 statemach110.efs
    -rwxrwxrwx   1 noone    nogroup    121802 May 26  2014 portalpage.zip
    -rwxrwxrwx   1 noone    nogroup      2263 Mar 25 06:44 statemach222.efs
    drwxrwxrwx   1 noone    nogroup         0 Mar 25 06:39 111
    -rwxrwxrwx   1 noone    nogroup      2263 Mar 25 06:32 statemach.efs
    -rwxrwxrwx   1 noone    nogroup    828482 May 26  2014 sslvpn.zip
    drwxrwxrwx   1 noone    nogroup         0 Mar 25 06:44 .
    226 Transfer complete.
    FTP: 533 byte(s) received in 0.040 second(s) 13.32Kbyte(s)/sec.
    [R2-ftp]get statemach110.efs  //下载特定的文件
    Warning: The file statemach110.efs already exists. Overwrite it? (y/n)[n]:y
    200 Port command okay.
    150 Opening ASCII mode data connection for statemach110.efs.
    64%_226 Transfer complete.
    FTP: 2263 byte(s) received in 0.130 second(s) 17.40Kbyte(s)/sec.
    [R2-ftp]quit                  //退出 FTP 服务器
    221 Server closing.
    <R2>dir                        //查看当前设备上是否存在已经下载的文件
    Directory of flash:/
      Idx  Attr     Size(Byte)  Date        Time(LMT)  FileName 
        0  drw-              -  Mar 25 2020 06:32:51   dhcp
        1  -rw-          2,263  Mar 25 2020 06:56:04   statemach110.efs
        2  -rw-        121,802  May 26 2014 09:20:58   portalpage.zip
        3  -rw-          2,263  Mar 25 2020 06:44:04   statemach222.efs
        4  -rw-          2,263  Mar 25 2020 06:38:11   statemach.efs
        5  -rw-        828,482  May 26 2014 09:20:58   sslvpn.zip
    1,090,732 KB total (784,456 KB free)

 

相关标签: HCIA