DHCP中继
DHCP中继(也叫做DHCP中继代理)是一个小程序,其可以实现在不同子网和物理网段之间处理和转发dhcp信息的功能。如果DHCP客户机与DHCP服务器在同一个物理网段,则客户机可以正确地获得动态分配的ip地址。如果不在同一个物理网段,则需要DHCP Relay Agent(中继代理)。
1、拓扑图
2、AR1 路由器设置
<Huawei>sys
[Huawei]sys R1
[R1]undo info en
# 开启路由器 DHCP 功能
[R1]dhcp enable
# 进入接口
[R1]int g0/0/0
# 设置IP
[R1-GigabitEthernet0/0/0]ip addr 10.0.0.1 24
# 接口开启DHCP
[R1-GigabitEthernet0/0/0]dhcp select global
# 配置 vlan10 地址池
[R1-GigabitEthernet0/0/0]ip pool vlan10
[R1-ip-pool-vlan10]network 192.168.10.0 mask 24
[R1-ip-pool-vlan10]gateway-list 192.168.10.1
[R1-ip-pool-vlan10]dns-list 114.114.114.114
[R1-ip-pool-vlan10]excluded-ip-address 192.168.10.200 192.168.10.254
# 配置 vlan20 地址池
[R1-ip-pool-vlan10]ip pool vlan20
[R1-ip-pool-vlan20]network 192.168.20.0 mask 24
[R1-ip-pool-vlan20]gateway-list 192.168.20.1
[R1-ip-pool-vlan20]dns-list 114.114.114.114
[R1-ip-pool-vlan20]excluded-ip-address 192.168.20.200 192.168.20.254
3、AR1 路由器设置静态路由
[R1]ip route-static 192.168.10.0 24 10.0.0.2
[R1]ip route-static 192.168.20.0 24 10.0.0.2
4、SW1 交换机设置
<Huawei>sys
[Huawei]sys SW1
# 批量创建 vlan
[SW1]vlan batch 10 20 100
# 接口加入 vlan
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l a
[SW1-GigabitEthernet0/0/1]p d v 10
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]p l a
[SW1-GigabitEthernet0/0/2]p d v 20
[SW1-GigabitEthernet0/0/2]int g0/0/3
[SW1-GigabitEthernet0/0/3]p l a
[SW1-GigabitEthernet0/0/3]p d v 100
# 配置 vlanif100 接口
[SW1]int vlanif 100
[SW1-Vlanif100]ip addr 10.0.0.2 24
5、交换机配置 DHCP 中继文章来源:https://www.toymoban.com/news/detail-521926.html
# 开启交换机 DHCP 功能
[SW1]dhcp enable
# 配置 vlanif10 接口
[SW1]int vlanif 10
[SW1-Vlanif10]ip addr 192.168.10.1 24
# 设置为中继模式
[SW1-Vlanif10]dhcp select relay
# 指向 10.0.0.1 DHCP服务器地址,以请求DHCP服务
[SW1-Vlanif10]dhcp relay server-ip 10.0.0.1
# 配置 vlanif20 接口
[SW1]int vlanif 20
[SW1-Vlanif20]ip addr 192.168.20.1 24
[SW1-Vlanif20]dhcp select relay
[SW1-Vlanif20]dhcp relay server-ip 10.0.0.1
6、测试文章来源地址https://www.toymoban.com/news/detail-521926.html
PC1>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe2a:e09
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.10.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.10.1
Physical address..................: 54-89-98-2A-0E-09
DNS server........................: 114.114.114.114
PC2>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fee3:6765
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.20.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.20.1
Physical address..................: 54-89-98-E3-67-65
DNS server........................: 114.114.114.114
到了这里,关于华为三层交换机 配置VLAN 基于中继开启DHCP的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!