DHCP采样UDP链接方式,服务器端口为67,客户机端口为68.
实验环境(H3C ENSP)
一、配置要点
a:在路由器上配置DHCPserver
第一步:(系统视图)开启DHCP :DHCP enable
第二步:(进入接口视图)为与客户端相连的端口配置ip地址
第三步:(系统视图)建立DHCP地址池 :ip pool aaa
第四步:(pool模式下)配置network网段、Gateway-list网关、
dns-list DNS服务器地址、excluded-ip-address需要排除的ip地址
第五步:进入接口模式,在接口中启动DHCP动态分配:dhcp select globle
第六步:将客户端的dhcp启动即可
实例:
路由器配置:
#
sysname Huawei
#
dhcp enable
#
ip pool aaa
gateway-list 192.168.1.1
network 192.168.1.0 mask 255.255.255.0
excluded-ip-address 192.168.1.10
dns-list 192.168.1.10 192.168.10.10
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher OOCM4m($F4ajUn1vMEIBNUw#
local-user admin service-type http
#
firewall zone Local
priority 16
#
interface Ethernet0/0/0
ip address 192.168.1.1 255.255.255.0
dhcp select global
#
interface Ethernet0/0/1
#
interface Serial0/0/0
link-protocol ppp
#
interface Serial0/0/1
link-protocol ppp
#
interface Serial0/0/2
link-protocol ppp
#
interface Serial0/0/3
link-protocol ppp
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/3
#
wlan
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
user-interface vty 16 20
#
return
b:在三层交换机中为不同vlan配置不同DHCPserver
第一步:在三层交换机上建好vlan并分配好端口
第二步:(系统视图)开启DHCP :DHCP enable
第三步:为每一个vlan都建立一个相应的DHCP地址池(命名可以随意)
第四步:为每一个地址池配置好自己相应vlan的network网段、Gateway-list网关、
dns-list DNS服务器地址、excluded-ip-address需要排除的ip地址
第五步:进入每一个vlan接口,先配置好各自的ip地址,然后在启动DHCP动态分配:dhcp select globle
第六步:将客户端的dhcp启动即可
实例:
三层交换机配置:
[Huawei]display current-configuration
#
sysname Huawei
#
vlan batch 2 to 3
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
dhcp enable
#
diffserv domain default
#
drop-profile default
#
ip pool aaa
network 192.168.1.0 mask 255.255.255.0
excluded-ip-address 192.168.1.1
dns-list 192.168.10.10
#
ip pool bbb
network 192.168.2.0 mask 255.255.255.0
excluded-ip-address 192.168.2.1
dns-list 192.168.10.10
#
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 Vlanif2
ip address 192.168.1.1 255.255.255.0
dhcp select global
#
interface Vlanif3
ip address 192.168.2.1 255.255.255.0
dhcp select global
#
interface MEth0/0/1
#
interface Ethernet0/0/1
port link-type access
port default vlan 2
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3
#
interface Ethernet0/0/4
port link-type access
port default vlan 3
#
interface Ethernet0/0/5
#
interface Ethernet0/0/6
#
interface Ethernet0/0/7
#
interface Ethernet0/0/8
#
interface Ethernet0/0/9
#
interface Ethernet0/0/10
#
interface Ethernet0/0/11
#
interface Ethernet0/0/12
#
interface Ethernet0/0/13
#
interface Ethernet0/0/14
#
interface Ethernet0/0/15
#
interface Ethernet0/0/16
#
interface Ethernet0/0/17
#
interface Ethernet0/0/18
#
interface Ethernet0/0/19
#
interface Ethernet0/0/20
#
interface Ethernet0/0/21
#
interface Ethernet0/0/22
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
return