配置流程
1)在交换机上创建vlan
vlan batch 10 20 30
2)配置vlan端口
int g0/0/1
port link-type access
port default vlan 10
3)将与路由器相连的接口设置为trunk
int g0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20 30
4)配置路由器
int g0/0/0.1
dot1q terminal vid 10 //启用802.1q协议,启用vlan 10
ip address 10.1.1.1 24
arp broadcast enable
路由器的完整配置
<r1>display current-configuration
[V200R003C00]
#
sysname r1
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus 08:00:00
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold 80 restore 75
#
dhcp enable
#
ip pool dhcp10
gateway-list 10.1.1.1
network 10.1.1.0 mask 255.255.255.0
lease day 5 hour 5 minute 30
dns-list 8.8.8.8
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<0`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
#
interface GigabitEthernet0/0/0.1
dot1q termination vid 10
ip address 10.1.1.1 255.255.255.0
arp broadcast enable
dhcp select global
#
interface GigabitEthernet0/0/0.2
dot1q termination vid 20
ip address 20.1.1.1 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/0.3
dot1q termination vid 30
ip address 30.1.1.1 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/1
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
#
wlan ac
#
return
<r1>