祖瑞科技 全国计算机 网络IT运维社区!

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 7450|回复: 0

HCNA-44 配置DHCP

[复制链接]

205

主题

218

帖子

1286

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1286
发表于 2021-2-5 17:46:10 | 显示全部楼层 |阅读模式
HCNA-44 配置DHCP

基于接口配置DHCP
<Huawei>system-view
[Huawei]sysnamer1
[r1]interfaceGigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ipaddress 192.168.10.1 24
[r1-GigabitEthernet0/0/0]interfaceGigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ipaddress 192.168.20.1 24
[r1-GigabitEthernet0/0/1]quit
[r1]dhcpenable  //全局开启DHCP
[r1-GigabitEthernet0/0/0]dhcpselect interface  //配置DHCP基于接口Server
[r1-GigabitEthernet0/0/0]interfaceGigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]dhcpselect interface
[r1]interfaceGigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]dhcpserver lease day 0 hour 12 minute 0  //配置DHCP租约
[r1-GigabitEthernet0/0/0]dhcpserver excluded-ip-address 192.168.10.200 192.168.
10.254  //配置DHCP地址池内不参与分配的地址(保留地址)
[r1-GigabitEthernet0/0/0]dhcpserver dns-list 114.114.114.114  //配置DHCP的DNS服务地址
[r1]interfaceGigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]dhcpserver excluded-ip-address 192.168.20.200 192.168.
20.254
[r1-GigabitEthernet0/0/1]dhcpserver lease day 0 hour 12 minute 0
[r1-GigabitEthernet0/0/1]dhcpserver dns-list 114.114.114.114
[r1-GigabitEthernet0/0/1]displaythis  //查看配置
[V200R003C00]
#
interfaceGigabitEthernet0/0/1
ip address 192.168.20.1 255.255.255.0
dhcp select interface
dhcp server excluded-ip-address 192.168.20.200192.168.20.254
dhcp server lease day 0 hour 12 minute 0
dhcp server dns-list 114.114.114.114
#
Return
[r1]displayip pool  //查看IP地址池
  -----------------------------------------------------------------------
  Pool-name      :GigabitEthernet0/0/0
  Pool-No       : 0
  Position      : Interface       Status           : Unlocked
  Gateway-0      : 192.168.10.1   
  Mask          : 255.255.255.0
  VPN instance  : --
-----------------------------------------------------------------------
  Pool-name      :GigabitEthernet0/0/1
  Pool-No       : 1
  Position      : Interface       Status           : Unlocked
  Gateway-0      : 192.168.20.1   
  Mask          : 255.255.255.0
  VPN instance  : --
  IP address Statistic
    Total      :506   
    Used       :2          Idle        :394  
Expired     :0         Conflict    :0          Disable   :110  
PC>ipconfig
Linklocal IPv6 address...........: fe80::5689:98ff:fe20:2080
IPv6address......................: :: / 128
IPv6gateway......................: ::
IPv4address......................: 192.168.10.199
Subnetmask.......................: 255.255.255.0
Gateway...........................:192.168.10.1
Physicaladdress..................: 54-89-98-20-20-80
DNSserver........................: 114.114.114.114

基于全局配置DHCP
<Huawei>system-view
[Huawei]sysnamer1
[r1]interfaceGigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ipaddress 192.168.10.1 24
[r1-GigabitEthernet0/0/0]interfaceGigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]ipaddress 192.168.20.1 24
[r1-GigabitEthernet0/0/1]quit
[r1]dhcpenable  //全局DHCP服务开启
[r1]ippool zurkj  //创建全局地址池
[r1-ip-pool-zurkj]network192.168.10.0 mask 255.255.255.0  //配置网段 掩码
[r1-ip-pool-zurkj]gateway192.168.10.1   //配置网关地址
[r1-ip-pool-zurkj]excluded-ip-address192.168.10.200 192.168.10.254  //配置DHCP地址池不参与地址(保留地址)
[r1-ip-pool-zurkj]leaseday 0 hour 12 minute 0  //配置租约
[r1-ip-pool-zurkj]dns-list114.114.114.114 8.8.8.8  //配置主备DNS地址
[r1-ip-pool-zurkj]displaythis
[r1-ip-pool-zurkj]quit
[r1]ippool ipgzj
[r1-ip-pool-ipgzj]network192.168.20.0 mask 24
[r1-ip-pool-ipgzj]gateway192.168.20.1
[r1-ip-pool-ipgzj]excluded-ip-address192.168.20.200 192.168.20.254
[r1-ip-pool-ipgzj]leaseday 0 hour 12 minute 0
[r1-ip-pool-ipgzj]dns-list114.114.114.114 8.8.8.8
[r1-ip-pool-ipgzj]quit
[r1]interfaceGigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]dhcpselect global  //配置接口先择全局DHCP
[r1]interfaceGigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]dhcpselect global
[r1-GigabitEthernet0/0/1]quit
PC>ipconfig
Linklocal IPv6 address...........: fe80::5689:98ff:fe20:2080
IPv6address......................: :: / 128
IPv6gateway......................: ::
IPv4address......................: 192.168.10.199
Subnetmask.......................: 255.255.255.0
Gateway...........................:192.168.10.1
Physicaladdress..................: 54-89-98-20-20-80
DNSserver........................: 114.114.114.114
                                    8.8.8.8
PC>ping192.168.20.199
Ping192.168.20.199: 32 data bytes, Press Ctrl_C to break
From192.168.20.199: bytes=32 seq=1 ttl=127 time=79 ms
From192.168.20.199: bytes=32 seq=2 ttl=127 time=93 ms
From192.168.20.199: bytes=32 seq=3 ttl=127 time=94 ms
From192.168.20.199: bytes=32 seq=4 ttl=127 time=47 ms
From192.168.20.199: bytes=32 seq=5 ttl=127 time=62 ms
---192.168.20.199 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/75/94 ms

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
祖瑞(上海)网络科技有限公司
我们在全国范围提供企业IT运维、网络工程、弱电安装、监控安防、计算机产品收售、办公设备耗材等服务!
期待与您的合作!
邮箱:sanne@zurkj.com
电话:021-51850021 18918292296
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

公司网站

QQ|Archiver|手机版|小黑屋|祖瑞科技 全国计算机 网络IT运维社区! ( 沪ICP备16021636号-2 )

GMT+8, 2024-11-26 01:32 , Processed in 0.037872 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表