一、协议介绍
DHCP:Dynamic Host Configure Protocol,动态主机配置协议
• 从BOOTP(Bootstrap Protocol)协议发展而来。
• UDP封装,服务器=67,客户端=68
• 动态分配TCP/IP信息(IP地址、子网掩码、默认网关、DNS服务器等)
• 分配出去的信息是有租约的
二、工作流程
三、租约更新
四、配置案例
4.1接口地址池配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[SW1]vlan 10
[SW1-vlan10]q
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]port link access
[SW1-GigabitEthernet0/0/1]port default vlan 10
[SW1-GigabitEthernet0/0/1]int vlanif10
[SW1-Vlanif10]ip add 192.168.10.254 24
[SW1-Vlanif10]dhcp select interface
[SW1-Vlanif10]dhcp server dns-list 8.8.8.8
[SW1-Vlanif10]dhcp server excluded-ip-address 192.168.10.101 192.168.10.253
4.2全局地址池配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[SW1]ip pool 1
Info:It's successful to create an IP address pool.
[SW1-ip-pool-1]network 192.168.20.0
[SW1-ip-pool-1]gateway-list 192.168.20.254
[SW1-ip-pool-1]dns-list 6.6.6.6
[SW1-ip-pool-1]excluded-ip-address 192.168.20.101 192.168.20.253
[SW1-ip-pool-1]q
[SW1]vlan 20
[SW1-vlan10]q
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]port link access
[SW1-GigabitEthernet0/0/1]port default vlan 20[SW1-Vlanif10]int vlanif20
[SW1-Vlanif10]ip add 192.168.20.254 24
[SW1-Vlanif10]dhcp select global