赞
踩
作者:【吴业亮】
博客:https://wuyeliang.blog.csdn.net/
华为交换机&路由器&防火墙DHCP常用操作
一、排除不参与自动分配的IP地址
1、采用全局地址池时的配置:
<switch> system-view
[switch] ip pool pool1
[switch-ip-pool-pool1] network 10.10.10.0 mask 24
[switch-ip-pool-pool1] gateway-list 10.10.10.1
[switch-ip-pool-pool1] excluded-ip-address 10.10.10.200 10.10.10.200
2、采用接口地址池时的配置:
<switch> system-view
[switch] dhcp enable
[switch] interface vlanif 200
[switch-Vlanif200] ip address 10.10.10.1 24
[switch-Vlanif200] dhcp select interface
[switch-Vlanif200] dhcp server excluded-ip-address 10.10.10.200 10.10.10.200
二、修改租期
缺省情况下,设备作为DHCP服务器的缺省租期是1天;设备作为DHCP客户端时未配置缺省租期。
1、采用全局地址池时的配置:
<switch> system-view
[switch] ip pool pool1
[switch-ip-pool-pool1] lease day 10
2、采用接口地址池时的配置:
<switch> system-view
[switch] interface vlanif 200
[switch-Vlanif200] dhcp server lease day 10
3、在作为DHCP客户端的设备上,修改租期为10天(即864000秒)。
<switch> system-view
[switch] interface vlanif 200
[switch-Vlanif200] dhcp client expected-lease 864000
三、为客户端分配固定的IP地址
1、采用全局地址池时的配置:
<switch> system-view
[switch] ip pool pool1
[switch-ip-pool-pool1] static-bind ip-address 10.10.10.200 mac-address add1-fd91-e9a0
2、采用接口地址池时的配置:
<switch> system-view
[switch] interface vlanif 200
[switch-Vlanif200] dhcp server static-bind ip-address 10.10.10.200 mac-address add1-fd91-e9a0
四、取消为客户端分配固定的IP地址
1、采用全局地址池时的配置:
回收IP地址10.10.10.5
<switch> reset ip pool name pool1 10.10.10.5
解除静态绑定关系
<switch> system-view
[switch] ip pool pool1
[switch-ip-pool-pool1] undo static-bind ip-address 10.10.10.5
2、采用接口地址池时的配置:
回收IP地址10.10.10.5
<switch> reset ip pool interface vlanif200 10.10.10.5
解除静态绑定关系
<switch> system-view
[switch] interface vlanif 200
[switch-Vlanif200] undo dhcp server static-bind ip-address 10.10.10.5
五、查看已使用的IP地址
<switch> display ip pool name pool1 used
六、清除冲突地址
1、采用全局地址池时的配置:
<switch> reset ip pool name pool1 conflict
2、采用接口地址池时的配置:
<switch> reset ip pool interface vlanif200 conflict
七、扩大地址池范围
1、如果没有分配出去
1.1、采用全局地址池时的配置:
<switch> system-view
[switch] ip pool pool1
[switch-ip-pool-pool1] undo network
[switch-ip-pool-pool1] network 10.10.10.0 mask 24 //调整掩码长度
1.2、采用接口地址池时的配置:
<switch> system-view
[switch] interface vlanif 200
[switch-Vlanif200] ip address 10.10.10.1 24 //调整掩码长度
[switch-Vlanif200] dhcp select interface //重新使能接口地址池功能
2、如果已经分配出去
2.1、采用全局地址池时的配置:
<switch> reset ip pool name pool1 all //回收所有的IP地址
<switch> system-view
[switch] dhcp server ping packet 3 //配置防止IP地址重复分配功能
[switch] dhcp server ping timeout 200 //配置防止IP地址重复分配功能
[switch] ip pool pool1
[switch-ip-pool-pool1] undo network
[switch-ip-pool-pool1] network 10.10.10.0 mask 24 //调整掩码长度
2.2、采用接口地址池时的配置:
<switch> system-view
[switch] dhcp server ping packet 3 //配置防止IP地址重复分配功能
[switch] dhcp server ping timeout 200 //配置防止IP地址重复分配功能
[switch] interface vlanif 200
[switch-Vlanif200] ip address 10.10.10.1 24 //调整掩码长度
[switch-Vlanif200] dhcp select interface //重新使能接口地址池功能
八、缩小地址池范围
1、如果没有分配出去
1.1、采用全局地址池时的配置:
<switch> system-view
[switch] ip pool pool1
[switch-ip-pool-pool1] undo network
[switch-ip-pool-pool1] network 10.10.10.0 mask 25 //调整掩码长度
1.2、采用接口地址池时的配置:
<switch> system-view
[switch] interface vlanif 200
[switch-Vlanif200] ip address 10.10.10.1 25 //调整掩码长度
[switch-Vlanif200] dhcp select interface //重新使能接口地址池功能
2、如果已经分配出去
2.1、采用全局地址池时的配置:
<switch> reset ip pool name pool1 all //回收所有的IP地址
<switch> system-view
[switch] dhcp server ping packet 3 //配置防止IP地址重复分配功能
[switch] dhcp server ping timeout 200 //配置防止IP地址重复分配功能
[switch] ip pool pool1
[switch-ip-pool-pool1] undo network
[switch-ip-pool-pool1] network 10.10.10.0 mask 25 //调整掩码长度
2.2、采用接口地址池时的配置:
<switch> system-view
[switch] dhcp server ping packet 3 //配置防止IP地址重复分配功能
[switch] dhcp server ping timeout 200 //配置防止IP地址重复分配功能
[switch] interface vlanif 200
[switch-Vlanif200] ip address 10.10.10.1 25 //调整掩码长度
[switch-Vlanif200] dhcp select interface //重新使能接口地址池功能
九、防止从仿冒的DHCP服务器获取IP地址
1.全局下的配置。
<switch> system-view
[switch] dhcp enable
[switch] dhcp snooping enable
2.连接DHCP客户端侧接口的配置。所有连接DHCP客户端的接口都需要配置,以接口GE 1/0/1为例。
[switch] interface gigabitethernet 1/0/1
[switch-GigabitEthernet1/0/1] dhcp snooping enable
[switch-GigabitEthernet1/0/1] quit
3.连接DHCP服务器侧接口的配置。
[switch] interface gigabitethernet 1/0/2
[switch-GigabitEthernet1/0/2] dhcp snooping trusted
[switch-GigabitEthernet1/0/2] quit
十、关闭DHCP服务
<switch> system-view
[switch] undo dhcp enable
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。