三层交换机为不同VLAN自动分配IP地址实现_第1张图片
需求:3台电脑分别所属不同VLAN,现在需要为它们设置DHCP服务器
实现:先为交换机的各个接口配好连接类型
现在为LSW9交换机开始建立不同网段虚拟网关地址
现在开始为DHCP授权
建立网段池并设置名字为10
给这池子添加网段,子网掩码,网关,DNS
再回到接口并把DHCP设置为全局模式
LSW7
system-view
[Huawei]vlan batch 10 20
[Huawei]interface Ethernet 0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port default vlan 10
[Huawei]interface Ethernet 0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 20
[Huawei]interface Ethernet 0/0/3
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all

                LSW8
                system-view 
                [Huawei]vlan batch 30
                [Huawei]interface Ethernet 0/0/1
                [Huawei-Ethernet0/0/1]port link-type trunk
                [Huawei-Ethernet0/0/1]port trunk allow-pass vlan all
                [Huawei-Ethernet0/0/2]]port link-type access
                [Huawei-Ethernet0/0/2]port default vlan 30

                LSW9
                system-view 
                [Huawei]vlan batch 10 20 30
                [Huawei]interface GigabitEthernet 0/0/1
                [Huawei-GigabitEthernet0/0/1]port link-type trunk
                [Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
                [Huawei]in vlan 10
                [Huawei-Vlanif10]ip address 192.168.10.254 24
                [Huawei]in vlan 20
                [Huawei-Vlanif20]ip address 192.168.20.254 24
                [Huawei]in vlan 30
                [Huawei-Vlanif30]ip address 192.168.30.254 24
                [Huawei]dhcp enable
                [Huawei]ip pool 10
                [Huawei-ip-pool-10]network 192.168.10.0 mask 24
                [Huawei-ip-pool-10]gateway-list 192.168.10.254
                [Huawei-ip-pool-10]dns-list 8.8.8.8
                [Huawei]in vlan 10
              [Huawei-Vlanif10]dhcp select global