近日看到一个VLAN图,为了验证交换机与路由器这个箭头所指接口,到底是配成Access类型,还是Trunk类型,特地做了个实验。
使用模拟器,搭建了下面这个环境,如图所示。
这个图也是我们中小企业,常用的网络拓扑图。
对于路由器RouterB做了如下配置。
<RouterB>DIS CU
#
sysname RouterB
#
undo info-center enable
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domAIn default
domain default_admin
local-user admin password cipher I@qZ>s3UmQjKUGU-KkpBb1>#
local-user admin service-type http
#
firewall zone Local
priority 16
#
interface Ethe.NET0/0/0
#
interface Ethernet0/0/1
#
interface Serial0/0/0
link-protocol ppp
#
interface Serial0/0/1
link-protocol ppp
#
interface Serial0/0/2
link-protocol ppp
#
interface Serial0/0/3
link-protocol ppp
#
interface GigabitEthernet0/0/0
ip address 192.168.60.254 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 2.2.2.3 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 60.60.60.61 255.255.255.0
#
interface GigabitEthernet0/0/3
#
wlan
#
interface NULL0
#
ip route-static 192.168.10.0 255.255.255.0 192.168.60.253
ip route-static 192.168.20.0 255.255.255.0 192.168.60.253
#
user-interface con 0
user-interface vty 0 4
user-interface vty 16 20
#
return
<RouterB>
针对交换机JRJHJ5,做了如下配置
<JRJHJ5>dis current-configuration
#
sysname JRJHJ5
#
undo info-center enable
#
vlan batch 10 20 60 999
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
dhcp enable
#
diffserv domain default
#
drop-profile default
#
ip pool vlan10
gateway-list 192.168.10.254
network 192.168.10.0 mask 255.255.255.0
DNS-list 202.102.192.68
#
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 Vlanif10
ip address 192.168.10.254 255.255.255.0
dhcp select global
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
#
interface Vlanif60
#
interface Vlanif999
ip address 192.168.60.253 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
description ToRouter
port link-type access
port default vlan 999
#
interface NULL0
#
ip route-static 0.0.0.0 0.0.0.0 192.168.60.254
#
user-interface con 0
user-interface vty 0 4
#
return
<JRJHJ5>
测试配置
此交换机接口配置为Access类型,若将交换机与路由器连接的端口配置成Trunk口,经过测试是不能互通的。