5-1配置FTP业务
###学习目标
理解建立FTP连接的过程
掌握FTP服务器参数的配置
掌握与FTP服务器传输文件的方法
拓扑图
{width="4.166666666666667in" height="1.0772517497812772in"}
CLI
步骤一、实验环境准备
<Huawei>sys
[Huawei]sysn R1
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.0.12.1 24
<Huawei>sys
[Huawei]sysname R2
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 10.0.12.2 24
步骤二、在路由器上启用FTP业务
[R1]ftp server enable
Info: Succeeded in starting the FTP server //配置R1为FTP服务器,R2为客户端
[R1]set default ftp-directory flash:/ //将机器的flash的/作为FTP根目录
[R1]aaa
[R1-aaa]local-user huawei password cipher huawei123
[R1-aaa]local-user huawei service-type ftp
[R1-aaa]local-user huawei privilege level 15
[R1-aaa]local-user huawei ftp-directory flash:
[R1-aaa]display ftp-server //通过AAA中设置用户名和密码,授权FTP合法用户连接到FTP服务器
步骤三、建立FTP客户端与服务器的连接
ftp 10.0.12.1
Trying 10.0.12.1 ...
Press CTRL+K to abort
Connected to 10.0.12.1.
220 FTP service ready.
User(10.0.12.1:(none)):huawei
331 Password required for huawei.
Enter password:
230 User logged in. //建立连接
[R2-ftp]dir //查看文件详细信息
[R2-ftp]binary //配置文件传输模式(二进制)
[R2-ftp]get vrpcfg.zip vrpnew.zip //下载文件
[R2-ftp]bye //关闭连接
[R2-ftp]put vrpnew.zip vrpnew2.zip //上传并重命名
<R1>delete flash:/vrpnew2.zip
<R2>delete flash:/vrpnew.zip //删除文件
5-2配置DHCP
###学习目标
掌握DHCP全局地址池的配置方法
掌握DHCP接口地址池的配置方法
掌握在交换机端口启用DHCP发现功能和IP地址分配功能的方法
拓扑图
{width="4.166666666666667in" height="2.517716535433071in"}
CLI
步骤一、实验环境准备
配置IP地址,并关闭R1的g0/0/2,R3的g0/0/1
步骤二、启用DHCP
[R1]dhcp enable
[R3]dhcp enable
步骤三、创建全局IP地址池
[R1]ip pool pool1
[R1-ip-pool-pool1]network 10.0.12.0 mask 24 //可分配ip地址10.0.12.1~10.0.12.254
[R1-ip-pool-pool1]gateway-list 10.0.12.1 //网关ip地址,即DHCP server的接口0的ip地址
[R1-ip-pool-pool1]lease day 1 hour 12 //设置租约期
[R1-ip-pool-pool1]int g0/0/1
[R1-GigabitEthernet0/0/1]dhcp select global //开启基于全局地址池的服务方式
[R3]ip pool pool2
[R3-ip-pool-pool2]network 10.0.23.0 mask 24
[R3-ip-pool-pool2]gateway-list 10.0.23.3
[R3-ip-pool-pool2]lease day 1 hour 12
[R3-ip-pool-pool2]int g0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
[S1]dhcp enable
[S1]int v1
[S1-Vlanif1]ip add dhcp-alloc //获取DHCP地址池ip地址
<S1>dis ip int bri
<R1>dis ip pool nam pool1
步骤四、创建接口地址池
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]shutdown
[R3]int g0/0/2
[R3-GigabitEthernet0/0/2]shutdown //关闭接口
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]dhcp select int
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]dhcp select int //开启接口DHCP服务功能
[R1-GigabitEthernet0/0/2]dhcp server dns-list 10.0.23.254
[R1-GigabitEthernet0/0/2]dhcp server excluded-ip-address 10.0.23.254
[R1-GigabitEthernet0/0/2]dhcp server lease day 1 hour 12
[R3-GigabitEthernet0/0/1]dhcp server dns-list 10.0.12.254
[R3-GigabitEthernet0/0/1]dhcp server excluded-ip-address 10.0.12.254
[R3-GigabitEthernet0/0/1]dhcp server lease day 1 hour 12 //从接口地址池中为DNS服务预览ip地址,并设置租期
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]undo shutdown //开启接口
[S2-Vlanif1]shutdown
[S2-Vlanif1]undo shutdown //重启清楚ip地址,以便从接口地址池重新获得地址