【DHCP实验】使用三层交换机配置DHCP Server服务器(基于全局地址池配置)

本文涉及的产品
全局流量管理 GTM,标准版 1个月
公共DNS(含HTTPDNS解析),每月1000万次HTTP解析
云解析 DNS,旗舰版 1个月
简介: 【DHCP实验】使用三层交换机配置DHCP Server服务器(基于全局地址池配置)

一、实验拓扑

f04acda16878410fb343d8b481aee0a5.png

二、实验要求

三层交换机S1通过DHCP的公有地址池给PC1和PC2分配IP地址,PC1属于vlan30,PC2属于vlan40,具体要求如下:

(1) 更改主机名S1

(2) 创建vlan 30 40

(3) 配置vlanif 30接口的IP地址为192.168.30.254,vlanif 40接口的IP地址为192.168.40.254

(4) 配置access接口

(5) 启用DHCP

(6) 配置全局地址池

地址池1名:dhcp_vlan30

地址网段:192.168.30.0/24

网关:192.168.30.254

DNS服务器地址:114.114.114.114和 8.8.8.8

地址池2名:dhcp_vlan40

地址网段:192.168.40.0/24

网关:192.168.40.254

DNS服务器地址:114.114.114.114和 8.8.8.8

(7) 配置vlanif 30和vlanif40虚接口下启用全局地址池


三、实验步骤

(1) 更改主机名S1
The device is running!
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.  
[Huawei]undo info-center enable 
Info: Information center is disabled. 
[Huawei]sysname S1
[S1]
(2) 创建vlan 30 40
[S1]vlan batch 30 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1]
(3) 配置vlanif 30接口的IP地址为192.168.30.254,vlanif 40接口的IP地址为192.168.40.254
!!!注意配置接口IP地址与配置端口access时的先后顺序,应先创建并配置vlan以及接口IP地址,再将各个端口加入相应的vlan中,否则vlan端口启动不了!!!
[S1]interface Vlanif 30
[S1-Vlanif30]ip address 192.168.30.254 24
[S1-Vlanif30]display this
#
interface Vlanif30
 ip address 192.168.30.254 255.255.255.0
#
return
[S1-Vlanif30]quit 
[S1]interface Vlanif 40
[S1-Vlanif40]ip address 192.168.40.254 24
[S1-Vlanif40]display this
#
interface Vlanif40
 ip address 192.168.40.254 255.255.255.0
#
return
[S1-Vlanif40]quit 
[S1]display ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 1
The number of interface that is DOWN in Protocol is 4
Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           unassigned           up         down      
Vlanif30                          192.168.30.254/24    down       down      
Vlanif40                          192.168.40.254/24    down       down      
[S1]
(4) 配置access接口
[S1]interface GigabitEthernet 0/0/1
[S1-GigabitEthernet0/0/1]port link-type access    
[S1-GigabitEthernet0/0/1]port default vlan 30
[S1-GigabitEthernet0/0/1]display this
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 30
#
return
[S1-GigabitEthernet0/0/1]quit
[S1]interface GigabitEthernet 0/0/3
[S1-GigabitEthernet0/0/3]port link-type access  
[S1-GigabitEthernet0/0/3]port default vlan 40
[S1-GigabitEthernet0/0/3]display this
#
interface GigabitEthernet0/0/3
 port link-type access
 port default vlan 40
#
return
[S1-GigabitEthernet0/0/3]quit
[S1]display ip interface brief 
*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 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface                         IP Address/Mask      Physical   Protocol  
MEth0/0/1                         unassigned           down       down      
NULL0                             unassigned           up         up(s)     
Vlanif1                           unassigned           down       down      
Vlanif30                          192.168.30.254/24    up         up        
Vlanif40                          192.168.40.254/24    up         up        
[S1]
(5) 启用DHCP
[S1]dhcp enable 
[S1]
(6) 配置全局地址池
     地址池1名:dhcp_vlan30
     地址网段:192.168.30.0/24
     网关:192.168.30.254
     DNS服务器地址:114.114.114.114和 8.8.8.8
     地址池2名:dhcp_vlan40
     地址网段:192.168.40.0/24
     网关:192.168.40.254
     DNS服务器地址:114.114.114.114和 8.8.8.8
[S1]ip pool dhcp_vlan30
Info:It's successful to create an IP address pool.  
[S1-ip-pool-dhcp_vlan30]network 192.168.30.0 mask 24  
[S1-ip-pool-dhcp_vlan30]gateway-list 192.168.30.254 
[S1-ip-pool-dhcp_vlan30]dns-list 114.114.114.114 8.8.8.8
[S1-ip-pool-dhcp_vlan30]display this
#
ip pool dhcp_vlan30
 gateway-list 192.168.30.254
 network 192.168.30.0 mask 255.255.255.0
 dns-list 114.114.114.114 8.8.8.8
#
return
[S1-ip-pool-dhcp_vlan30]quit
[S1]ip pool dhcp_vlan40
Info:It's successful to create an IP address pool.
[S1-ip-pool-dhcp_vlan40]network 192.168.40.0 mask 24
[S1-ip-pool-dhcp_vlan40]gateway-list 192.168.40.254
[S1-ip-pool-dhcp_vlan40]dns-list 114.114.114.114 8.8.8.8
[S1-ip-pool-dhcp_vlan40]display this
#
ip pool dhcp_vlan40
 gateway-list 192.168.40.254
 network 192.168.40.0 mask 255.255.255.0
 dns-list 114.114.114.114 8.8.8.8
#
return
[S1-ip-pool-dhcp_vlan40]quit
[S1]display ip pool 
  -----------------------------------------------------------------------
  Pool-name      : dhcp_vlan30
  Pool-No        : 0
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.30.254  
  Mask           : 255.255.255.0
  VPN instance   : --
  -----------------------------------------------------------------------
  Pool-name      : dhcp_vlan40
  Pool-No        : 1
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.40.254  
  Mask           : 255.255.255.0
  VPN instance   : --
  IP address Statistic
    Total       :506   
    Used        :0          Idle        :506   
    Expired     :0          Conflict    :0          Disable   :0     
[S1]
(7) 配置vlanif 30和vlanif40虚接口下启用全局地址池
[S1]interface Vlanif 30 
[S1-Vlanif30]dhcp select global 
[S1-Vlanif30]display this
#
interface Vlanif30
 ip address 192.168.30.254 255.255.255.0
 dhcp select global
#
return
[S1-Vlanif30]quit
[S1]interface Vlanif 40
[S1-Vlanif40]dhcp select global
[S1-Vlanif40]display this
#
interface Vlanif40
 ip address 192.168.40.254 255.255.255.0
 dhcp select global
#
return
[S1-Vlanif40]quit
[S1]display ip pool name dhcp_vlan30 
  Pool-name      : dhcp_vlan30
  Pool-No        : 0
  Lease          : 1 Days 0 Hours 0 Minutes
  Domain-name    : -
  DNS-server0    : 114.114.114.114 
  DNS-server1    : 8.8.8.8        
  NBNS-server0   : -               
  Netbios-type   : -               
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.30.254  
  Mask           : 255.255.255.0
  VPN instance   : --
 -----------------------------------------------------------------------------
         Start           End     Total  Used  Idle(Expired)  Conflict  Disable
 -----------------------------------------------------------------------------
    192.168.30.1  192.168.30.254   253     1        252(0)         0        0
 -----------------------------------------------------------------------------
[S1]
[S1]display ip pool name dhcp_vlan40 
  Pool-name      : dhcp_vlan40
  Pool-No        : 1
  Lease          : 1 Days 0 Hours 0 Minutes
  Domain-name    : -
  DNS-server0    : 114.114.114.114 
  DNS-server1    : 8.8.8.8         
  NBNS-server0   : -               
  Netbios-type   : -               
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.40.254  
  Mask           : 255.255.255.0
  VPN instance   : --
 -----------------------------------------------------------------------------
         Start           End     Total  Used  Idle(Expired)  Conflict  Disable
 -----------------------------------------------------------------------------
    192.168.40.1  192.168.40.254   253     1        252(0)         0        0
 -----------------------------------------------------------------------------
[S1]
(8)保存S1交换机上的配置文件
[S1]q
<S1>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Now saving the current configuration to the slot 0.
Save the configuration successfully.
<S1>


四、实验测试

执行ipconfig命令

执行ipconfig /release ——释放获取到的IP地址参数

执行ipconfig /renew——获取新的IP地址参数

f0f3646ec2a54d81a3f14e11c648f871.png

698d1bde614446e5adea0d87a64c842b.png

PC1

PC>ipconfig /release
IP Configuration
Link local IPv6 address...........: fe80::5689:98ff:fe79:248a
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 0.0.0.0
Subnet mask.......................: 0.0.0.0
Gateway...........................: 0.0.0.0
Physical address..................: 54-89-98-79-24-8A
DNS server........................:
PC>ipconfig /renew
IP Configuration
Link local IPv6 address...........: fe80::5689:98ff:fe79:248a
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.30.253
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.30.254
Physical address..................: 54-89-98-79-24-8A
DNS server........................: 114.114.114.114
                                    8.8.8.8
PC>


PC2

PC>ipconfig /release
IP Configuration
Link local IPv6 address...........: fe80::5689:98ff:fe99:4726
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 0.0.0.0
Subnet mask.......................: 0.0.0.0
Gateway...........................: 0.0.0.0
Physical address..................: 54-89-98-99-47-26
DNS server........................:
PC>ipconfig /renew
IP Configuration
Link local IPv6 address...........: fe80::5689:98ff:fe99:4726
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.40.253
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.40.254
Physical address..................: 54-89-98-99-47-26
DNS server........................: 114.114.114.114
                                    8.8.8.8
PC>


相关文章
|
24天前
|
安全 Linux 应用服务中间件
从零开始启动、配置、保护你的云服务器并搭建一个简单的网站
本文详细介绍了如何准备原料、搭建基础环境、进行安全防护、建设网站、管理证书以及开启BBR优化网络性能。主要内容包括获取健康云服务器、配置SSH登录、创建非root用户、启用密钥认证、安装Nginx、申请TLS证书、配置HTTPS自动跳转及优化网络性能等步骤。通过本文,读者可以掌握从零开始搭建个人网站的全过程。
37 1
从零开始启动、配置、保护你的云服务器并搭建一个简单的网站
|
16天前
|
开发框架 .NET PHP
网站应用项目如何选择阿里云服务器实例规格+内存+CPU+带宽+操作系统等配置
对于使用阿里云服务器的搭建网站的用户来说,面对众多可选的实例规格和配置选项,我们应该如何做出最佳选择,以最大化业务效益并控制成本,成为大家比较关注的问题,如果实例、内存、CPU、带宽等配置选择不合适,可能会影响到自己业务在云服务器上的计算性能及后期运营状况,本文将详细解析企业在搭建网站应用项目时选购阿里云服务器应考虑的一些因素,以供参考。
|
24天前
|
存储 人工智能 弹性计算
阿里云弹性计算(ECS)提供强大的AI工作负载平台,支持灵活的资源配置与高性能计算,适用于AI训练与推理
阿里云弹性计算(ECS)提供强大的AI工作负载平台,支持灵活的资源配置与高性能计算,适用于AI训练与推理。通过合理优化资源分配、利用自动伸缩及高效数据管理,ECS能显著提升AI系统的性能与效率,降低运营成本,助力科研与企业用户在AI领域取得突破。
45 6
|
27天前
|
负载均衡 监控 应用服务中间件
配置Nginx反向代理时如何指定后端服务器的权重?
配置Nginx反向代理时如何指定后端服务器的权重?
49 4
|
1月前
|
监控 PHP Apache
优化 PHP-FPM 参数配置:实现服务器性能提升
优化PHP-FPM的参数配置可以显著提高服务器的性能和稳定性。通过合理设置 `pm.max_children`、`pm.start_servers`、`pm.min_spare_servers`、`pm.max_spare_servers`和 `pm.max_requests`等参数,并结合监控和调优措施,可以有效应对高并发和负载波动,确保Web应用程序的高效运行。希望本文提供的优化建议和配置示例能够帮助您实现服务器性能的提升。
62 3
|
7月前
|
网络性能优化 网络虚拟化 网络架构
配置接口限速示例(盒式交换机)
接口限速简介 接口限速对通过整个端口的全部报文流量速率进行限制,不对具体流量进行区分,可以实现给某个接口分配固定的带宽,控制方式单一,配置简单。 入方向与出方向的接口限速属于并列关系,用户可以根据需要同时配置,也可以单独配置。
105 2
|
1月前
|
网络协议 安全 网络虚拟化
思科交换机配置命令归纳
【11月更文挑战第8天】本文总结了思科交换机的常见配置命令,包括模式转换、基本配置、查看命令、VLAN 配置、Trunk 配置、以太网通道配置、VTP 配置、三层交换机配置、生成树配置以及其他常用命令,适用于网络管理和维护。
121 2
|
2月前
|
安全 网络安全 数据安全/隐私保护
Cisco-交换机配置聚合端口
Cisco-交换机配置聚合端口
|
5月前
|
网络安全 数据安全/隐私保护 网络虚拟化
|
4月前
|
数据中心
配置案例 | CE交换机如何配置堆叠?
配置案例 | CE交换机如何配置堆叠?