前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >DHCP中继(实验操作)

DHCP中继(实验操作)

作者头像
宝耶需努力
发布2022-12-13 13:27:59
3870
发布2022-12-13 13:27:59
举报
文章被收录于专栏:Cloud-DIY

DHCP中继(实验操作)

实验拓扑:

在这里插入图片描述
在这里插入图片描述

实验配置:

代码语言:javascript
复制
#DHCP服务器基础配置
sys
sys AR1
int g0/0/0
ip add 192.168.12.1 24
ip route-static 192.168.10.0 24 192.168.12.2
ip route-static 192.168.20.0 24 192.168.12.2
代码语言:javascript
复制
#DHCP中继基础配置
sys
sys SW1
vlan batch 10 20
int g0/0/1
p l a
p d v 10
int g0/0/2
p l a
p d v 20

int vlanif 10
ip add 192.168.10.254 24
int vlanif 20
ip add 192.168.20.254 24
int vlanif 1
ip add 192.168.12.2 24
代码语言:javascript
复制
#DHCP服务器配置全局地址池
#开启全局DHCP
[AR1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[AR1]

#配置vlan10 地址池
[AR1]ip pool vlan10
Info: It's successful to create an IP address pool.	
[AR1-ip-pool-vlan10]network 192.168.10.0 mask 24	
[AR1-ip-pool-vlan10]gateway-list 192.168.10.254	
[AR1-ip-pool-vlan10]dns-list 114.114.114.114
[AR1-ip-pool-vlan10]dis thi
[V200R003C00]
#
ip pool vlan10
 gateway-list 192.168.10.254 
 network 192.168.10.0 mask 255.255.255.0 
 dns-list 114.114.114.114 
#
return
[AR1-ip-pool-vlan10]

#配置vlan20 地址池
[AR1]ip pool vlan20
Info: It's successful to create an IP address pool.
[AR1-ip-pool-vlan20]
[AR1-ip-pool-vlan20] gateway-list 192.168.20.254 
[AR1-ip-pool-vlan20]
[AR1-ip-pool-vlan20] network 192.168.20.0 mask 255.255.255.0 
[AR1-ip-pool-vlan20]
[AR1-ip-pool-vlan20] dns-list 114.114.114.114 
[AR1-ip-pool-vlan20]
[AR1-ip-pool-vlan20]dis thi
[V200R003C00]
#
ip pool vlan20
 gateway-list 192.168.20.254 
 network 192.168.20.0 mask 255.255.255.0 
 dns-list 114.114.114.114 
#
return
[AR1-ip-pool-vlan20]

#进入接口,开启全局DHCP服务功能
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]dhcp select global 

#查询DHCP地址池
[AR1]display ip pool 
  -----------------------------------------------------------------------
  Pool-name      : vlan10
  Pool-No        : 0
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.10.254  
  Mask           : 255.255.255.0
  VPN instance   : --

  -----------------------------------------------------------------------
  Pool-name      : vlan20
  Pool-No        : 1
  Position       : Local           Status           : Unlocked
  Gateway-0      : 192.168.20.254  
  Mask           : 255.255.255.0
  VPN instance   : --


  IP address Statistic
    Total       :506   
    Used        :0          Idle        :506   
    Expired     :0          Conflict    :0          Disable   :0     
[AR1]
代码语言:javascript
复制
#DHCP中继
[SW1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[SW1]
[SW1]dhcp server group office
Info:It's successful to create a DHCP server group.
[SW1-dhcp-server-group-office]dhcp-server 192.168.12.1

[SW1]interface Vlanif 10
[SW1-Vlanif10]dhcp select relay 
[SW1-Vlanif10]dhcp relay server-select office
[SW1-Vlanif10]dis thi
#
interface Vlanif10
 ip address 192.168.10.254 255.255.255.0
 dhcp select relay
 dhcp relay server-select office
#
return
[SW1-Vlanif10]

[SW1]interface Vlanif20
[SW1-Vlanif20] ip address 192.168.20.254 255.255.255.0
Error: The address already exists.
[SW1-Vlanif20] dhcp select relay
[SW1-Vlanif20] dhcp relay server-select office
[SW1-Vlanif20]dis thi
#
interface Vlanif20
 ip address 192.168.20.254 255.255.255.0
 dhcp select relay
 dhcp relay server-select office
#
return
[SW1-Vlanif20]
代码语言:javascript
复制
#主机自动获取DHCP IP地址
#vlan 10 PC1
PC>ipconfig /renew

IP Configuration


Link local IPv6 address...........: fe80::5689:98ff:fe35:5abc
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.10.253
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.254
Physical address..................: 54-89-98-35-5A-BC
DNS server........................: 114.114.114.114

#vlan20 PC2
PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe98:45b7
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.20.253
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.20.254
Physical address..................: 54-89-98-98-45-B7
DNS server........................: 114.114.114.114


PC>
在这里插入图片描述
在这里插入图片描述
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-08-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • DHCP中继(实验操作)
相关产品与服务
VPN 连接
VPN 连接(VPN Connections)是一种基于网络隧道技术,实现本地数据中心与腾讯云上资源连通的传输服务,它能帮您在 Internet 上快速构建一条安全、可靠的加密通道。VPN 连接具有配置简单,云端配置实时生效、可靠性高等特点,其网关可用性达到 99.95%,保证稳定、持续的业务连接,帮您轻松实现异地容灾、混合云部署等复杂业务场景。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档