一、DHCP中继,相同网段

1、网络拓扑图

Linux网络服务——DHCP(华为ENSP)

2、LSW2配置

vlan batch 100 200

interface Ethernet0/0/1
port link-type access
port default vlan 100

interface Ethernet0/0/2
port link-type access
port default vlan 200

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094

3、LSW3配置

vlan batch 100 200

interface Ethernet0/0/1
port link-type access
port default vlan 100

interface Ethernet0/0/2
port link-type access
port default vlan 200

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094

3、LSW1配置

vlan batch 100 200

cluster enable
ntdp enable
ndp enable

drop illegal-mac alarm

dhcp enable

diffserv domain default

drop-profile default

ip pool dhcp1
gateway-list 192.168.100.1
network 192.168.100.0 mask 255.255.255.0
lease day 7 hour 0 minute 0
dns-list 2.2.2.2 4.4.4.4

ip pool dhcp2
gateway-list 192.168.200.1
network 192.168.200.0 mask 255.255.255.0
lease day 7 hour 0 minute 0
dns-list 2.2.2.2 4.4.4.4

aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http

interface Vlanif1

interface Vlanif100
ip address 192.168.100.1 255.255.255.0
dhcp select global

interface Vlanif200
ip address 192.168.200.1 255.255.255.0
dhcp select global

interface MEth0/0/1

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094

二、验证结果

把所有PC机的IP配置设置为DHCP,再在命令行中输入ipconfig验证效果
Linux网络服务——DHCP(华为ENSP)

PC1

Linux网络服务——DHCP(华为ENSP)

PC2

Linux网络服务——DHCP(华为ENSP)

PC3

Linux网络服务——DHCP(华为ENSP)

PC4

Linux网络服务——DHCP(华为ENSP)

相关文章: