1. DHCP工作原理图

DHCP工作原理_数据传输

  1. DHCP关键知识点
  • DHCP服务器数据传输的端口为UDP67
  • DHCP客户机数据传输的端口为UDP68
  • 客户机的源IP地址为:0.0.0.0
  • 客户机的目的IP地址:255.255.255.255
  1. DHCP过程详解
  • 发现阶段(discover):DHCP客户机获取网络中DHCP服务器信息的阶段(广播报文)
  • 提供阶段(offer):DHCP SERVER向DHCP客户机提供预分配IP地址(单播报文)
  • 选择阶段(request):DHCP客户机选择IP地址的阶段。(广播报文)
  • 确认阶段(ack):DHCP服务器确认分配DHCP客户端IP地址的阶段。(单播报文)
  • 再次选择阶段(renew):DHCP客户机租约到期前,租约期50%时,申请一次,如果续约成功后,正常使用;续约失败,租约期87.5%时,再次申请,如果续约成功,正常使用;续约失败,租约到期后,自动断网。
  • 再次确认阶段:DHCP服务器再次确认分配DHCP客户机IP地址。

DHCP工作原理_ip地址_02

  1. 实例

DHCP工作原理_ip地址_03

配置:<LSW2>display current-configuration  

#

sysname LSW2

#

vlan batch 10 20 30

#

cluster enable

ntdp enable

ndp enable

#

drop illegal-mac alarm

#

dhcp enable //注意需要开启dhcp enable,默认是关闭

#

diffserv domain default

#

drop-profile default

#

ip pool vlan10

gateway-list 10.1.1.1

network 10.1.1.0 mask 255.255.255.240

excluded-ip-address 10.1.1.8

dns-list 8.8.8.8 114.114.114.114

#

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 10.1.1.1 255.255.255.240

dhcp select global

#

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 10

#

interface GigabitEthernet0/0/3

#

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

注意:本例用了使用为全局:dhcp select global