Huawei DHCP 全局配置與接口配置


網絡拓撲圖如下所示:

 

 

說明:

1.交換機Ge0/0/1口和Ge0/0/2口配置基於全局的DHCP;

2.交換機Ge0/0/3口配置基於端口的DHCP;

3.交換機上配置vlan 10 、vlan 20 、vlan 30。vlan 10 地址192.168.10.1,vlan 20地址192.168.20.1,vlan 30地址192.168.30.1。

4.Ge0/0/1屬於vlan 10,Ge0/0/2屬於vlan 20,Ge0/0/3屬於vlan 30。

 

配置:

[Huawei]dis cu

#

sysname Huawei

#

vlan batch 10 20 30          “創建VLAN

#

cluster enable

ntdp enable

ndp enable

#

drop illegal-mac alarm

#

[Quidway]  dhcp enable    // 在配置模式下“啟用DHCP服務”

#

diffserv domain default

#

drop-profile default

#

[Quidway-ip-pool-vlan10-pool]  ip pool vlan10-pool   // 在IP-POOL 模式下“基於全局配置的DHCP地址池”

[Quidway-ip-pool-vlan10-pool] domain-name h3c.com

[Quidway-ip-pool-vlan10-pool]  gateway-list 192.168.10.1

[Quidway-ip-pool-vlan10-pool]  network 192.168.10.0 mask 255.255.255.0

[Quidway-ip-pool-vlan10-pool]  dns-list 3.3.3.2  

[Quidway-ip-pool-vlan10-pool] excluded-ip-address 192.168.10.2  //排除IP 10.2 不分配 

[Quidway-ip-pool-vlan10-pool] excluded-ip-address 192.168.10.200  192.168.10.254 //排除200-254 不分配 

[Quidway-ip-pool-vlan10-pool] static-bind ip-address 192.168.10.9 mac-address 28d2-4469-5a55  // 綁定 IP  192.168.10.9 固定分配給MAC 為28d2-4469-5a55的機器,需池中IP

//當一個用戶需要固定的IP地址時,可以將地址池中沒有在使用的IP地址與用戶的MAC地址綁定。

[[Quidway-ip-pool-vlan10-pool] lease day 10  //租期10天 

[Quidway-ip-pool-vlan10-pool] quit

 #

ip pool vlan20-pool    “基於全局配置的DHCP地址池”

 gateway-list 192.168.20.1

 network 192.168.20.0 mask 255.255.255.0 

 dns-list 202.101.172.35

#

aaa

 authentication-scheme default

 authorization-scheme default

 accounting-scheme default

 domain default

 domain default_admin

 local-user admin password simple admin

 local-user admin service-type http

#

interface Vlanif1

#

interface Vlanif10

 ip address 192.168.10.1 255.255.255.0

 dhcp select global    “設置DHCP基於全局配置”

#

interface Vlanif20

 ip address 192.168.20.1 255.255.255.0

 dhcp select global   //“設置DHCP基於全局配置”

#

interface Vlanif30

 ip address 192.168.30.1 255.255.255.0

 dhcp select interface       // “設置DHCP基於端口配置”           

 dhcp server excluded-ip-address 192.168.30.201 192.168.30.254   //“排查192.168.20.201到192.168.30.254這些地址”

 dhcp server dns-list 8.8.8.8             

#                                        

interface MEth0/0/1

#

interface GigabitEthernet0/0/1

 port link-type access

 port default vlan 10

#

interface GigabitEthernet0/0/2

 port link-type access

 port default vlan 20

#

interface GigabitEthernet0/0/3

 port link-type access

 port default vlan 30

#

interface GigabitEthernet0/0/4

#

interface GigabitEthernet0/0/5

#

interface GigabitEthernet0/0/6

#

interface GigabitEthernet0/0/7

#

interface GigabitEthernet0/0/8

#                                        

interface GigabitEthernet0/0/9

#

interface GigabitEthernet0/0/10

#

interface GigabitEthernet0/0/11

#

interface GigabitEthernet0/0/12

#

interface GigabitEthernet0/0/13

#

interface GigabitEthernet0/0/14

#

interface GigabitEthernet0/0/15

#

interface GigabitEthernet0/0/16

#

interface GigabitEthernet0/0/17

#

interface GigabitEthernet0/0/18

#

interface GigabitEthernet0/0/19

#

interface GigabitEthernet0/0/20

#                                        

interface GigabitEthernet0/0/21

#

interface GigabitEthernet0/0/22

#

interface GigabitEthernet0/0/23

#

interface GigabitEthernet0/0/24

#

interface NULL0

#

user-interface con 0

user-interface vty 0 4

#

return

[Huawei]

 

(說明:上面紅色字體部分是基於全局配置的,基於全局配置情況要在全局模式下設置dhcp服務的地址池、dns、網關等;綠色字體部分是基於端口配置的,基於端口配置的部分要在int vlan 30的接口下進行配置dhcp的dns、網關、地址池等。

 

查看交換機上的arp表:

[Huawei]dis arp

IP ADDRESS      MAC ADDRESS     EXPIRE(M) TYPE INTERFACE      VPN-INSTANCE     

                                          VLAN

------------------------------------------------------------------------------

192.168.10.1    4c1f-ccb7-23ea            I -  Vlanif10

192.168.10.254  5489-98cf-bd73  1         D-0  GE0/0/1

                                          10

192.168.10.253  5489-98cf-2650  1         D-0  GE0/0/1

                                          10

192.168.10.252  5489-98cf-bd73  1         D-0  GE0/0/1

                                          10

192.168.10.251  5489-98cf-2650  1         D-0  GE0/0/1

                                          10

192.168.20.1    4c1f-ccb7-23ea            I -  Vlanif20

192.168.20.254  5489-98cf-8b50  1         D-0  GE0/0/2

                                          20

192.168.20.253  5489-98cf-5c20  1         D-0  GE0/0/2

                                          20

192.168.20.252  5489-98cf-8b50  1         D-0  GE0/0/2

                                          20

192.168.20.251  5489-98cf-5c20  1         D-0  GE0/0/2

                                          20

192.168.30.1    4c1f-ccb7-23ea            I -  Vlanif30

192.168.30.200  5489-98cf-b623  1         D-0  GE0/0/3

                                          30

192.168.30.199  5489-98cf-1103  1         D-0  GE0/0/3

                                          30

------------------------------------------------------------------------------

Total:13        Dynamic:10      Static:0     Interface:3   

[Huawei]

DHCP維護

在確認需要清除DHCP服務器的統計信息后,請在用戶視圖下執行
reset dhcp server statistics命令。

在確認需要清除DHCP中繼的統計信息后,請在用戶視圖下執行
reset dhcp relay statistics命令。

使用命令display dhcp server statistics查看DHCP服務器的統計信息。

使用命令display ip pool name ip-pool-name [ low-ip-address high-ip-address | all | expired | conflict | used ]查看已經配置的全局地址池信息。

使用display dhcp relay { all | interface interface-type interface-number }命令查看VLANIF接口配置的中繼DHCP服務器組和服務器組對應的服務器。

使用display dhcp relay statistics命令查看DHCP Relay統計信息。

使用display dhcp server group [ group-name ]命令查看DHCP服務器組成員的配置信息。

釋放

Dis ip pool 查看設備的地址池

reset ip pool interface xx all //釋放針對基於接口的地址池

reset ip pool name yy all //釋放針對全局的地址池

執行命

令dhcp relay release client-ip-address mac-address [ server-ip-address | vpn-instance vpn-instance-name ],向DHCP服務器申請釋放DHCP客戶端已經獲取到的IP地址。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM