• DHCP自动获取IP地址实验(华为)


     思科设备参考:DHCP自动获取IP地址实验(思科)

    一,实验目的

    路由器搭载DHCP,让PC通过DHCP自动获取IP地址

    二,不划分vlan--全局地址池

    实验拓扑

     

    配置命令

    Router

    system-view

    [Huawei]ip pool mypool

    [Huawei-ip-pool-mypool]network 192.168.10.0

    [Huawei-ip-pool-mypool]excluded-ip-address 192.168.10.10 192.168.10.254

    [Huawei-ip-pool-mypool]lease day 2 hour 0 minute 0

    [Huawei-ip-pool-mypool]dns-list 114.114.114.114

    [Huawei-ip-pool-mypool]quit

    [Huawei]dhcp enable

    [Huawei]int g0/0/0

    [Huawei-GigabitEthernet0/0/0]ip address 192.168.10.254 24

    [Huawei-GigabitEthernet0/0/0]dhcp select global

    [Huawei-GigabitEthernet0/0/0]quit

    [Huawei]display current-configuration

    测试结果

    PC1 和 PC2 成功获取到 IP 地址

    ① 打开PC--->基础配置--->IPv4配置--->DHCP--->应用

    ② 命令行--->输入指令    ipconfig /renew

    三,划分vlan--接口地址池

    实验拓扑

     

    配置命令

    Switch

     sys

    system-view

    [Huawei]vlan batch 10 20

    [Huawei]int g0/0/1

    [Huawei-GigabitEthernet0/0/1]port link-type trunk

    [Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all

    [Huawei-GigabitEthernet0/0/1]quit

    [Huawei]int g0/0/2

    [Huawei-GigabitEthernet0/0/2]port link-type access

    [Huawei-GigabitEthernet0/0/2]port default vlan 10

    [Huawei-GigabitEthernet0/0/2]quit

    [Huawei]int g0/0/3

    [Huawei-GigabitEthernet0/0/3]port link-type access

    [Huawei-GigabitEthernet0/0/3]port default vlan 10

    [Huawei-GigabitEthernet0/0/3]quit

    [Huawei]int g0/0/4

    [Huawei-GigabitEthernet0/0/4]port link-type access

    [Huawei-GigabitEthernet0/0/4]port default vlan 20

    [Huawei-GigabitEthernet0/0/4]quit

    [Huawei]int g0/0/5

    [Huawei-GigabitEthernet0/0/5]port link-type access

    [Huawei-GigabitEthernet0/0/5]port default vlan 20

    [Huawei-GigabitEthernet0/0/5]quit

    [Huawei]display current-configuration

    Router

    system-view

    [Huawei]dhcp enable

    [Huawei]int g0/0/0.10

    [Huawei-GigabitEthernet0/0/0.10]dot1q termination vid 10

    [Huawei-GigabitEthernet0/0/0.10]ip address 192.168.10.1 24

    [Huawei-GigabitEthernet0/0/0.10]arp broadcast enable

    [Huawei-GigabitEthernet0/0/0.10]dhcp select interface

    [Huawei-GigabitEthernet0/0/0.10]dhcp server dns-list 8.8.8.8

    [Huawei-GigabitEthernet0/0/0.10]dhcp server domain-name vl_10

    [Huawei-GigabitEthernet0/0/0.10]dhcp server lease day 3 hour 3 minute 3

    [Huawei-GigabitEthernet0/0/0.10]dhcp server excluded-ip-address 192.168.10.5 192.168.10.254

    [Huawei-GigabitEthernet0/0/0.10]quit

    [Huawei]int g0/0/0.20

    [Huawei-GigabitEthernet0/0/0.20]dot1q termination vid 20

    [Huawei-GigabitEthernet0/0/0.20]ip address 192.168.20.1 24

    [Huawei-GigabitEthernet0/0/0.20]arp broadcast enable

    [Huawei-GigabitEthernet0/0/0.20]dhcp select interface

    [Huawei-GigabitEthernet0/0/0.20]dhcp server dns-list 8.8.8.8

    [Huawei-GigabitEthernet0/0/0.20]dhcp server domain-name vl_20

    [Huawei-GigabitEthernet0/0/0.20]dhcp server lease day 3 hour 3 minute 3

    [Huawei-GigabitEthernet0/0/0.20]dhcp server excluded-ip-address 192.168.20.5 192.168.20.254

    [Huawei-GigabitEthernet0/0/0.20]quit

    [Huawei]display current-configuration

    测试结果

    四台 PC 都能成功获取到 IP 地址

  • 相关阅读:
    DuckDB优化器之Filter提升
    Ceres Solver简介及使用
    VisualStudio 制作Dynamic Link Library动态链接库文件
    保研计网复习笔记:数据链路层
    SpringAOP-底层原理解析
    文献解读:有监督的机器学习在心理学上的应用
    Django
    VS Code中PlatformIO IDE的安装并开发Arduino
    【计算机网络实验】RIP的基本配置
    PyQt 定义控件SwitchButton 指南
  • 原文地址:https://blog.csdn.net/qq_65150735/article/details/136044871