注:本實驗的路由器使用的是AR2240,交換機是S3700,以及4台PC機。
拓撲圖如下:
拓撲中左邊用於練習全局DHCP配置,右邊用於接口DHCP配置.
一.進入g0/0/1,添加接口IP
命令:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.10.254 24
Apr 7 2020 16:38:59-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]
二.配置DHCP
命令:
[R1]dhcp enable ##啟用DHCP功能
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]ip pool pool1 ##創建一個pool1地址池
Info: It's successful to create an IP address pool.
[R1-ip-pool-pool1]
[R1-ip-pool-pool1]netw
[R1-ip-pool-pool1]network 192.168.10.0 m
[R1-ip-pool-pool1]network 192.168.10.0 mask 24 ##宣告網段
[R1-ip-pool-pool1]ga
[R1-ip-pool-pool1]gateway-list 192.168.10.254 ##添加網關
[R1-ip-pool-pool1]dn
[R1-ip-pool-pool1]dns-list 8.8.8.8 ##添加DNS
三.進入接口啟用全局模式
命令:
[R1]int g0/0/1 ##進入相應的接口
[R1-GigabitEthernet0/0/1]dh
[R1-GigabitEthernet0/0/1]dhcp se
[R1-GigabitEthernet0/0/1]dhcp select g
[R1-GigabitEthernet0/0/1]dhcp select global ##啟用全局模式
四.進入PC驗證是否配置成功
1.進入PC機點擊DHCP
2.命令行中輸入:ipconfig
看到顯示上述信息則證明DHCP全局配置成功.
接口配置DHCP(在拓撲的右邊實驗)
一.接口dhcp配置
命令:
[R1]
[R1]int g0/0/2 ##進入相應的接口
[R1-GigabitEthernet0/0/2]ip add
[R1-GigabitEthernet0/0/2]ip address 172.16.10.254 255.255.255.0 ##配置IP地址范圍
Apr 7 2020 16:57:12-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R1-GigabitEthernet0/0/2]dh
[R1-GigabitEthernet0/0/2]dhcp se
[R1-GigabitEthernet0/0/2]dhcp select int
[R1-GigabitEthernet0/0/2]dhcp select interface ##選擇接口模式
[R1-GigabitEthernet0/0/2]dh
[R1-GigabitEthernet0/0/2]dhcp ser
[R1-GigabitEthernet0/0/2]dhcp server dn
[R1-GigabitEthernet0/0/2]dhcp server dns-list 114.114.114.114 ##添加DNS
二.進入PC驗證
看到上述命令輸出則表明接口DHCP配置成功.
全局模式可選操作:
9、excluded-IP-address 192.168.1.250 ##排除地址的操作
10、excluded-IP-address 192.168.1.1 192.168.1.10 ##代表排除1到10ip
11、lease day 0 hour 1 minute 0 ##調整租期
12、static-bind IP-address 192.168.1.88 mac-address XXXX-XXXX-XXXX ##為pc綁定某個IP
接口模式可選操作:
6、DHCP server excluded-IP-address 192.168.1.250 ##排除地址的操作
7、DHCP server excluded-IP-address 192.168.1.1 192.168.1.10 ##排除1-10IP地址
8、DHCP server lease day 0 hour 1 minute 0 ##調整租期
9、DHCP server static-bind IP-address 192.168.1.88 mac-address XXXX-X
PC上的操作:
在PC命令行上操作:
ipconfig ##顯示IP地址等信息
ipconfig /renew ##重新獲取IP地址
ipconfig /release ##釋放地址
ipconfig /?
注:此文為原創,未經同意不可轉載