近日看到一個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口,經過測試是不能互通的。