配置示例
路由器上直接划分vlan,下挂二层交换机的简单网络示例。
vlan batch 100 150 200
vlan 100
description 806
vlan 150
description wifi
vlan 200
description 807
interface Vlanif1
ip address 192.168.1.1 255.255.255.0
dhcp select interface
dhcp server dns-list 192.168.1.1
sa application-statistic enable
#
interface Vlanif100
description 806-if
ip address 192.168.100.1 255.255.255.0
dhcp select interface
dhcp server excluded-ip-address 192.168.100.3 192.168.100.20
dhcp server dns-list 192.168.100.1
sa application-statistic enable
#
interface Vlanif150
description wifi-if
ip address 192.168.150.1 255.255.255.0
dhcp select interface
dhcp server excluded-ip-address 192.168.150.3 192.168.150.20
dhcp server dns-list 192.168.150.1
sa application-statistic enable
#
interface Vlanif200
description 807-if
ip address 192.168.200.1 255.255.255.0
dhcp select interface
dhcp server excluded-ip-address 192.168.200.2 192.168.200.20
dhcp server dns-list 192.168.200.1
sa application-statistic enable
#
interface GigabitEthernet0/0/1
port hybrid pvid vlan 100
undo port hybrid vlan 1
port hybrid untagged vlan 100 150 200
#
interface GigabitEthernet0/0/2
port hybrid pvid vlan 200
undo port hybrid vlan 1
port hybrid untagged vlan 100 150 200
#
interface GigabitEthernet0/0/3
port hybrid pvid vlan 150
undo port hybrid vlan 1
port hybrid untagged vlan 100 150 200
#
interface GigabitEthernet0/0/4
pppoe-client dial-bundle-number 1
sa application-statistic enable
#
命令解析
# 定义vlan接口100
# 设定接口地址为 192.168.100.1 并作为网关
# 开启 dhcp
interface Vlanif100
description 806-if
ip address 192.168.100.1 255.255.255.0
dhcp select interface
dhcp server excluded-ip-address 192.168.100.3 192.168.100.20
dhcp server dns-list 192.168.100.1
sa application-statistic enable
# 定义接口模式是hybrid
# 设定缺省vlan是100
# 允许携带100、150、200的报文以untagged方式通过接口,便于下挂access口
port link-type hybrid
port hybrid pvid vlan 100
undo port hybrid vlan 1
port hybrid untagged vlan 100 150 200