zoukankan      html  css  js  c++  java
  • 网络基础-DHCP

    DHCP

    • 动态路由主机协议(dynamic host configuration protocol),局域网协议,使用udp工作

    • 作用

      • 内部网或网络服务器供应商自动分配ip
      • 用于用户内部管理员作为对计算机管理手段
    • 思路

      • 先在汇聚层定义和配置地址池
      • 接入层交换机端口划分vlan
      • 在地址池中配置pc端Mac或之间指定一个dns-list
      • 在vlan上配置好改网关,并在vlan上开启DHCP
    • 实现命令

    #
    dhcp enable 
    ip  pool  xxx  //配置地址池名称
    network  x.x.x.x  mask x.x.x.x
    static-bina  ip  add  x.x.x.x  mac-add x.x.x.x  //把固定的地址给xxx
    dns-list  x.x.x.x  //dns服务器
    leese  day xx  //生存时间
    gateway-list  x.x.x.x 
    exduded-ip-add  x.x.x.x //保留ip
    #
    int  vlan xx
    ip  add  mask
    dhcp select  globe   //在vlan内开启DHCP功能
    

    实验演示

    topo

    在这里插入图片描述
    实验要求

    • 在 R1 的 g0/0/0 接口配置接口地址池,需求如下:

      不包含地址 10.1.1.1

      租期为 1 天 2 小时 5 分钟

      DNS 服务器为 10.1.1.1

    • 在 R1 的 g0/0/1 接口配置全局地址池,需求如下:

      网关为 20.1.1.254

      分配的地址为 20.1.1.0/24

      租期为 1 天 2 小时 5 分钟**

    #在r1上配置基本的ip地址
    
    [r1]dis  ip  int  br
    *down: administratively down
    ^down: standby
    (l): loopback
    (s): spoofing
    The number of interface that is UP in Physical is 3
    The number of interface that is DOWN in Physical is 0
    The number of interface that is UP in Protocol is 3
    The number of interface that is DOWN in Protocol is 0
    
    Interface                         IP Address/Mask      Physical   Protocol  
    GigabitEthernet0/0/0              10.1.1.254/24        up         up        
    GigabitEthernet0/0/1              20.1.1.254/24        up         up     
    

    接口地址池

    配置g0/0/0口
    #
    interface GigabitEthernet0/0/0
     ip address 10.1.1.254 255.255.255.0 
     dhcp select interface
     dhcp server excluded-ip-address 10.1.1.1 
     dhcp server lease day 1 hour 1 minute 5 
     dhcp server dns-list 10.1.1.1 
    #
    
    
    • 在pc1上开启DHCP,在r1的G0/0/0口抓包

    在这里插入图片描述
    全局地址池

    在r1的g0/0/1接口上
    #
    ip pool pool2
     gateway-list 20.1.1.254 
     network 20.1.1.0 mask 255.255.255.0 
     lease day 2 hour 1 minute 5 
    #
    #
    interface GigabitEthernet0/0/1
     ip address 20.1.1.254 255.255.255.0 
     dhcp select global
    #
    
    
    
    • 开启PC2上的DHCP,用ipconfig命令查看
      在这里插入图片描述
      可以看到,10.1.1.253这个地址分配到PC1。

    同理,r3可以使用抓包或者在PC3的命令行输入ipconfig查看!

    谢谢你的喜欢!
  • 相关阅读:
    [LeetCode 题解]: Triangle
    [LeetCode 题解]: pow(x,n)
    [LeetCode 题解]: plusOne
    [LeetCode 题解]: ZigZag Conversion
    error: field 'b' has imcomplete type
    两个分数的最小公倍数
    DDR工作原理
    流水线技术原理和Verilog HDL实现
    FPGA主要应用
    提高器件工作的速度
  • 原文地址:https://www.cnblogs.com/linwenye/p/12773791.html
Copyright © 2011-2022 走看看