DHCP(动态主机配置协议)是一个局域网的网络协议。指的是由服务器控制一段IP地址范围,客户机登录服务器时就可以自动获得服务器分配的IP地址和子网掩码。
拓扑图
对R1进行配置
对GE 0/0/0 和GE 0/0/1分配ip
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 24
Jul 19 2022 13:02:48-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 172.16.1.1 24
Jul 19 2022 13:03:13-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
配置DHCP
开启dhcp
[Huawei]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
配置左边广播域的dhcp
创建一个地址池aa
[Huawei]ip pool aa
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-aa]
配置地址池的ip、网关、dns
[Huawei-ip-pool-aa]network 192.168.1.0 mask 24
[Huawei-ip-pool-aa]gateway-list 192.168.1.1
[Huawei-ip-pool-aa]dns-list 114.114.114.114 8.8.8.8
在接口中选择全局配置
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp select global
返回用户视图模式,保存
<Huawei>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
<Huawei>
测试
在pc1上选择使用dhcp获取ip地址 通过抓包工具,可以发现,dhcp获取ip配置成功 也可以在pc1的命令行输入ipconfig查看
同理,在pc2上选择使用dhcp获取ip地址
配置右边广播域的dhcp
右边的配置与左边类似 略…… (以下省略一千字)
对R1进行加密
创建两个用户,一个管理员用户admin(权限15),一个访客用户guest(权限0)
[Huawei]aaa
[Huawei-aaa]local-user admin privilege level 15 password cipher admin
[Huawei-aaa]local-user guest privilege level 0 password cipher guest
[Huawei-aaa]local-user admin service-type terminal
[Huawei-aaa]local-user guest service-type terminal
设置使用aaa认证模式登陆
[Huawei]user-interface console 0
[Huawei-ui-console0]authentication-mode aaa
测试
使用admin登陆
使用 guest登陆
|