通过DHCP获取IP地址,使相关PC可以互相访问

HCIA中关于DHCP的常见问题

首先我们要了解何为DHCP
DHCP服务 – 动态主机配置协议 统一分发管理ip地址;
在网络中部署一台DHCP服务器,之后终端设备通过广播来寻找DHCP服务器获取ip地址即可
成为DHCP服务器的条件:
1、 该设备必须存在接口或网卡连接到所要下放地址的广播域内
2、 该接口或网卡,必须已经拥有合法ip地址,且可以通信
[Huawei]dhcp enable 先在设备上开启DHCP服务
在设备上创建名为xiaoqiang的DHCP池塘,一台设备上可以创建多个池塘,但一个池塘只能服务一个广播域
通过DHCP获取IP地址,使相关PC可以互相访问_第1张图片
关于上图,我们要想实现PC5和PC6互相访问,先点击路由器,等待其连接好后,在其中输入
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 255.255.255.0
Jan 5 2021 21:10:16-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[2]: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 address 192.168.2.1 24
Jan 5 2021 21:10:59-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[3]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]q
[Huawei]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]ip pool xianyu
Info: It’s successful to create an IP address pool.
[Huawei-ip-pool-xianyu]network 192.168.1.0 ma
[Huawei-ip-pool-xianyu]network 192.168.1.0 mask 255.255.255.0
[Huawei-ip-pool-xianyu]gateway-list 192.168.1.1
[Huawei-ip-pool-xianyu]dns-list 114.114.114.114 8.8.8.8
[Huawei-ip-pool-xianyu]q
[Huawei]ip pool xianyu
[Huawei-ip-pool-xianyu]q
[Huawei]ip pool cangshu
Info: It’s successful to create an IP address pool.
[Huawei-ip-pool-cangshu]network 192.168.2.0 mask 255.255.255.0
[Huawei-ip-pool-cangshu]gateway-list 192.168.2.1
[Huawei-ip-pool-cangshu]dns-list 114.114.114.114 8.8.8.8
[Huawei-ip-pool-cangshu]q
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp select global
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]
[Huawei-GigabitEthernet0/0/1]
成功后在 PC段输入
通过DHCP获取IP地址,使相关PC可以互相访问_第2张图片
就配置成功了
用PC5访问PC6
通过DHCP获取IP地址,使相关PC可以互相访问_第3张图片
成功访问
要想访问右边借口,在路由器中输入
sys
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]int
[Huawei]interface g
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]dhcp se
[Huawei-GigabitEthernet0/0/1]dhcp select g
[Huawei-GigabitEthernet0/0/1]dhcp select global
查看PC7中ip
通过DHCP获取IP地址,使相关PC可以互相访问_第4张图片
配置成功
用PC7访问PC8
通过DHCP获取IP地址,使相关PC可以互相访问_第5张图片

用PC6访问PC8
通过DHCP获取IP地址,使相关PC可以互相访问_第6张图片
实验成功

你可能感兴趣的:(HCIA入门,网络,路由器)