1.DHCP中继
2.配置命令:sys
int g0/0/0
ip add 192.168.2.2 24
dhcp enable
ip pool pool1
net 192.168.1.0 mask 24
dns-list 8.8.8.8
gateway-list 192.168.1.1
dhcp select global //启用全局地址池
ip route-static 192.168.1.0 24 192.168.2.254
//配置一条去1.0网段的静态路由
sys
sys sw2
vlan batch 10 996
int vlanif10
ip add 192.168.1.1 24
ip add 192.168.1.2 24
int vlan996
ip add 192.168.2.254 24
int g0/0/1
port link-type access
port default vlan 10
int g0/0/2
port link-type access
port default vlan 10
int g0/0/3
port link-type access
port default vlan 996
dhcp enable
int vlanif10
dhcp select relay //启用dhcp中继
dhcp relay server-ip 192.168.2.2
3.打开pc的dhcp获取功能输入ipconfig获取地址
(华为默认是末尾地址,我这里没有排除地址和设置dhcp时间默认八天。)
1.DHCP接口配置和全局配置
2.配置命令:
sys
sys sw1
vlan batch 10 20
int g0/0/1
port link-type access
port default vlan 10
port link-type access
port default vlan 20
//划分access口并让vlan 10 20的流量进入sw1
int vlanif10
ip add 192.168.10.1 24
int vlanif20
ip add 192.168.20.1 24
dhcp enable
int vlanif10
dhcp select interface
dhcp server dns 8.8.8.8
dhcp excluded-ip-address 192.168.10.101 192.168.10.150
//基于接口配置
ip pool pool1
net 192.168.20.0 mask 24
dns-list 8.8.8.8
gateway-list 192.168.20.1
[sw1-Vlanif20]dhcp select global //vlan接口下配置dhcp全局发放
//基于全局地址池配置
(获取到10和20网段的地址)