网络

DHCP

2024-09-13  本文已影响0人  _结弦

DHCP配置

DHCP 动态主机分配协议

global

[Huawei]dhcp en
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]ip pool 1
Info: It's successful to create an IP address pool.
# 配置ip域
[Huawei-ip-pool-1]network 192.168.1.0 mask 255.255.255.0
# 网关地址, 如果哪个接口使用了这个网关, 那么也就通过这个接口使用DHCP协议分配地址
[Huawei-ip-pool-1]gateway-list 192.168.1.1
# 排除dhcp能分配的地址, 现在也就是只有192.168.1.254可以分配
[Huawei-ip-pool-1]excluded-ip-address 192.168.1.2 192.168.1.253
[Huawei-ip-pool-1]dns-list 8.8.8.8
[Huawei-ip-pool-1]q
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[Huawei-GigabitEthernet0/0/0]dhcp select global 

interface

[Huawei-GigabitEthernet0/0/0]ip address 10.0.0.254 255.255.0.0
[Huawei-GigabitEthernet0/0/0]dhcp enable
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp server excluded-ip-address 10.0.0.254
Error:Please configure dhcp select interface first.
[Huawei-GigabitEthernet0/0/0]dhcp select interface
[Huawei-GigabitEthernet0/0/0]dhcp server excluded-ip-address 10.0.0.254
Error:Only idle or expired IP address can be disabled.
[Huawei-GigabitEthernet0/0/0]dhcp server excluded-ip-address 10.0.0.253
[Huawei-GigabitEthernet0/0/0]dhcp ?
  alarm     Alarm
  check     Check
  client    DHCP client
  option82  <Group> option82 command group
  relay     DHCP relay
  select    Select
  server    <Group> server command group
[Huawei-GigabitEthernet0/0/0]dhcp server ?
  dns-list             Configure DNS servers
  domain-name          Configure domain name 
  excluded-ip-address  Mark disable IP addresses 
  import               Imports the following network configuration parameters   
                       from a central server into local ip pool database: domain
                       name, dns server and netbios server.
  lease                Configure the lease of the IP pool
  nbns-list            Configure the windows's netbios name servers 
  netbios-type         Netbios node type
  next-server          The address of the server to use in the next step of the 
                       client's bootstrap process.
  option               Configure the DHCP options
  option121            DHCP option 121 
  option184            DHCP option 184
  recycle              Recycle IP address
  static-bind          Static bind
[Huawei-GigabitEthernet0/0/0]dhcp server lease day 8 hour 1 minute 0

difference between GLOBAL and INTERFACE

# global 会根据所有的地址池选择一个接口和网关相同的地址池(也就是自动选择)
[Huawei-GigabitEthernet0/0/0]dhcp select global 
# interface 需要自己手动指定
[Huawei-GigabitEthernet0/0/0]dhcp select interface
[Huawei-GigabitEthernet0/0/0] dhcp server ip-pool InterfacePool

6个包, 七个作用

  1. DHCPDiscover 发现DHCP服务器
  2. DHCPOffer 提供IP
  3. DHCPRequest 选择IP (广播)+ 续约(单播)
  4. DHCPAck 确认
  5. DHCPNack 拒绝
  6. DHCPDecline 发现地址冲突
上一篇下一篇

猜你喜欢

热点阅读