DHCP ( Dynamic Host Configuration Protocol ) 是在IP (Internet Protocol)网络上使用的一种网络管理协议,用于为使用客户端-服务器架构连接到网络的设备自动分配IP地址和其他通信参数。

    另外一个同样功能的协议是 BOOTP

    DHCP采用无连接的服务模型,使用UDP (User Datagram Protocol)协议。它使用两个UDP端口号来实现操作,这与bootstrap协议(BOOTP)相同。UDP端口号67为服务器的目的端口号,68为客户端使用的端口号。

    DHCP的操作分为四个阶段:服务器发现、IP租期提供、IP租期请求和IP租期确认。这些阶段通常缩写为DORA,表示发现、提供、请求和确认。

    image.png

    image.png

    image.png

    conf t
    no ip routing
    int fa0/0
    ip address dhcp
    no shut
    exit

    shop ip int brief

    conf t
    ip dhcp pool POOL1

    network 192.168.100.0 /24

    dns-server 192.168.100.1
    default-router 192.168.100.1
    lease 12
    exit

    show run

    conf t
    ip dhcp excluded-address 192.168.100.1 192.168.100.19
    int fa0/0
    ip address 192.168.100.1 255.255.255.0
    no shut

    show ip dhcp binding
    show cdp neighbors

    pc1
    show ip interface brief