09-VLAN典型配置舉例
本章節下載: 09-VLAN典型配置舉例 (235.22 KB)
資料版本:6W100-20190628
Copyright © 2019 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
目 錄
本文檔介紹基於端口的VLAN、Super VLAN、Private VLAN的典型應用場景和配置舉例。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
本文檔假設您已了解VLAN特性。
如圖1所示,Host A和Host C屬於部門A,但是通過不同的設備接入公司網絡;Host B和Host D屬於部門B,也通過不同的設備接入公司網絡。為了通信的安全性,以及避免廣播報文泛濫,公司網絡中使用VLAN技術來隔離部門間的二層流量。其中部門A使用VLAN 100,部門B使用VLAN 200。
現要求同一VLAN內的主機能夠互通,即Host A和Host C能夠互通,Host B和Host D能夠互通。
圖1 基於端口的VLAN組網圖
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
缺省情況下,S6890係列交換機的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
# 創建VLAN 100,並將Ten-GigabitEthernet1/0/1加入VLAN 100。
[DeviceA-vlan100] port ten-gigabitethernet 1/0/1
[DeviceA-vlan100] quit
# 創建VLAN 200,並將Ten-GigabitEthernet1/0/2加入VLAN 200。
[DeviceA-vlan200] port ten-gigabitethernet 1/0/2
[DeviceA-vlan200] quit
# 為了使Device A上VLAN 100和VLAN 200的報文能發送給Device B,將Ten-GigabitEthernet1/0/3的鏈路類型配置為Trunk,並允許VLAN 100和VLAN 200的報文通過。
[DeviceA] interface ten-gigabitethernet 1/0/3
[DeviceA-Ten-GigabitEthernet1/0/3] port link-type trunk
[DeviceA-Ten-GigabitEthernet1/0/3] port trunk permit vlan 100 200
(2) Device B上的配置與Device A上的配置相同,不再贅述。
(3) 將Host A和Host C配置在一個網段,例如192.168.100.0/24;將Host B和Host D配置在一個網段,比如192.168.200.0/24。
(1) Host A和Host C能夠互相ping通,但是均不能ping通Host B。Host B和Host D能夠互相ping通,但是均不能ping通Host A。
# 查看Device A上VLAN 100和VLAN 200的配置信息,VLAN 100的報文僅允許通過接口XGE1/0/3和XGE1/0/1,VLAN 200的報文僅允許通過接口XGE1/0/3和XGE1/0/2。
[DeviceA-Ten-GigabitEthernet1/0/3] display vlan 100
VLAN ID: 100
VLAN type: Static
Route interface: Not configured
Description: VLAN 0100
Name: VLAN 0100
Tagged ports:
Ten-GigabitEthernet1/0/3
Untagged ports:
Ten-GigabitEthernet1/0/1
[DeviceA-Ten-GigabitEthernet1/0/3] display vlan 200
VLAN ID: 200
VLAN type: Static
Route interface: Not configured
Description: VLAN 0200
Name: VLAN 0200
Tagged ports:
Ten-GigabitEthernet1/0/3
Untagged ports:
Ten-GigabitEthernet1/0/2
Device B上的配置與Device A上的配置相同,此處僅以Device A的配置文件舉例。
#
vlan 100
#
vlan 200
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 100
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 200
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 100 200
#
如圖2所示:
· VLAN 2中的用戶通過Device A的Ten-GigabitEthernet1/0/1接入網絡,VLAN 3中的用戶通過Device A的Ten-GigabitEthernet1/0/2接入網絡。VLAN 2中有30個用戶,VLAN 3中有50個用戶。
· Device A的Ten-GigabitEthernet1/0/3和Device B的Ten-GigabitEthernet1/0/1屬於VLAN 20。
· VLAN 20中的終端用戶都使用192.168.2.0/24 網段的IP地址,使用192.168.2.1作為網關地址。
現要求通過配置Super VLAN功能實現以下應用需求:
· VLAN 2和VLAN 3中的終端用戶都使用192.168.1.0/24網段的IP地址以節省IP地址資源,使用192.168.1.1作為網關地址。
· VLAN 2、VLAN 3、VLAN 20中的終端用戶二層隔離,三層互通。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
· 由於Super VLAN中不能包含物理端口,由此若某VLAN中已經包含物理端口,則該VLAN不能被配置為Super VLAN。
· 缺省情況下,S6890係列交換機的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
# 創建Super VLAN 10。
<DeviceA> system-view
[DeviceA] vlan 10
[DeviceA-vlan10] supervlan
[DeviceA-vlan10] quit
# 創建VLAN 2並將端口Ten-GigabitEthernet1/0/1加入VLAN 2。
[DeviceA] vlan 2
[DeviceA-vlan2] port ten-gigabitethernet 1/0/1
[DeviceA-vlan2] quit
# 創建VLAN 3並將端口Ten-GigabitEthernet1/0/2加入VLAN 3。
[DeviceA] vlan 3
[DeviceA-vlan3] port ten-gigabitethernet 1/0/2
[DeviceA-vlan3] quit
# 將Super VLAN 10和Sub VLAN 2和Sub VLAN 3關聯。
[DeviceA] vlan 10
[DeviceA-vlan10] subvlan 2 3
[DeviceA-vlan10] quit
# 配置Super VLAN 10對應的VLAN接口的IP地址和本地代理ARP功能。
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] ip address 192.168.1.1 24
[DeviceA-Vlan-interface10] local-proxy-arp enable
[DeviceA-Vlan-interface10] quit
# 創建VLAN 20。
[DeviceA] vlan 20
[DeviceA-vlan20] quit
# 將端口Ten-GigabitEthernet1/0/3配置為Trunk端口並允許VLAN 20通過,取消允許VLAN 1通過。
[DeviceA] interface ten-gigabitethernet 1/0/3
[DeviceA-Ten-GigabitEthernet1/0/3] port link-type trunk
[DeviceA-Ten-GigabitEthernet1/0/3] undo port trunk permit vlan 1
[DeviceA-Ten-GigabitEthernet1/0/3] port trunk permit vlan 20
[DeviceA-Ten-GigabitEthernet1/0/3] quit
# 配置VLAN 20對應的VLAN接口的IP地址。
[DeviceA] interface Vlan-interface 20
[DeviceA-Vlan-interface20] ip address 192.168.2.1 24
[DeviceA-Vlan-interface20] quit
# 創建VLAN 20。
[DeviceB] vlan 20
[DeviceB-vlan20] quit
# 將端口Ten-GigabitEthernet1/0/1配置為Trunk端口並允許VLAN 20通過,取消允許VLAN 1通過。
[DeviceB] interface ten-gigabitethernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] port link-type trunk
[DeviceB-Ten-GigabitEthernet1/0/1] undo port trunk permit vlan 1
[DeviceB-Ten-GigabitEthernet1/0/1] port trunk permit vlan 20
[DeviceB-Ten-GigabitEthernet1/0/1] quit
# 將端口Ten-GigabitEthernet1/0/2加入VLAN 20。
[DeviceB] vlan 20
[DeviceB-vlan20] port ten-gigabitethernet 1/0/2
[DeviceB-vlan20] quit
(1) 查看Super VLAN配置信息。
[DeviceA] display supervlan
Super VLAN ID: 10
Sub-VLAN ID: 2-3
VLAN ID: 10
VLAN type: Static
It is a super VLAN.
Route interface: Configured
IPv4 address: 192.168.1.1
IPv4 subnet mask: 255.255.255.0
Description: VLAN 0010
Name: VLAN 0010
Tagged ports: none
Untagged ports: none
VLAN ID: 2
VLAN type: Static
It is a sub-VLAN.
Route interface: Configured
IPv4 address: 192.168.1.1
IPv4 subnet mask: 255.255.255.0
Description: VLAN 0002
Name: VLAN 0002
Tagged ports: none
Untagged ports:
Ten-GigabitEthernet1/0/1
VLAN ID: 3
VLAN type: Static
It is a sub-VLAN.
Route interface: Configured
IPv4 address: 192.168.1.1
IPv4 subnet mask: 255.255.255.0
Description: VLAN 0003
Name: VLAN 0003
Tagged ports: none
Untagged ports:
Ten-GigabitEthernet1/0/2
(2) Host A和Host B可以互相ping通。查看Host A的ARP表,表中Host B的IP地址對應的MAC地址是Vlan-interface10的MAC地址。查看Host B的ARP表,表中Host A的IP地址對應的MAC地址也是Vlan-interface10的MAC地址。
(3) Host A和Host C可以互相ping通。查看Host A的ARP表,表中沒有Host C的ARP表項。查看Host C的ARP表,表中也沒有Host A的ARP表項。說明VLAN 2和VLAN 20二層隔離,三層互通。Host B和Host C互相ping的情況同理。
· Device A
#
vlan 2
#
vlan 3
#
vlan 10
supervlan
subvlan 2 3
#
vlan 20
#
interface Vlan-interface10
ip address 192.168.1.1 255.255.255.0
local-proxy-arp enable
#
interface Vlan-interface20
ip address 192.168.2.1 255.255.255.0
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 2
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 3
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 20
#
· Device B
#
vlan 20
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type trunk
undo port trunk permit vlan 1
port trunk permit vlan 20
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 20
#
如圖3所示:
· 彙聚層設備Device A為接入設備Device B分配了VLAN 10,網關接口VLAN-interface10可以和所有用戶互通,以便用戶可以通過Device A來訪問外部網絡。Device B連接的所有用戶均處於同一網段10.0.0.0/24。
· Host A和B屬於銷售部,Host C和D屬於財務部。為保證安全,需要使不同部門之間二層隔離,同部門的用戶之間則可以互通。
現由於Device A不能為Device B分配更多VLAN,要求通過Private VLAN功能實現:
· Device A隻需識別VLAN 10。
· Device B在Primary VLAN 10下為各部門配置不同的Secondary VLAN,使部門間二層隔離。
圖3 Private VLAN典型配置舉例組網圖
Private VLAN功能隻需要在接入設備Device B上配置。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
· 係統缺省VLAN(VLAN 1)不支持Private VLAN相關配置。
· 缺省情況下,S6890係列交換機的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
# 配置VLAN 10為Primary VLAN。
<DeviceB> system-view
[DeviceB] vlan 10
[DeviceB-vlan10] private-vlan primary
[DeviceB-vlan10] quit
# 創建Secondary VLAN 201、202。
[DeviceB] vlan 201 to 202
# 建立Primary VLAN 10和Secondary VLAN 201、202的映射關係。
[DeviceB] vlan 10
[DeviceB-vlan10] private-vlan secondary 201 to 202
[DeviceB-vlan10] quit
# 配置上行端口Ten-GigabitEthernet1/0/1在VLAN 10中工作在promiscuous模式。
[DeviceB] interface ten-gigabitethernet 1/0/1
[DeviceB-Ten-GigabitEthernet1/0/1] port private-vlan 10 promiscuous
[DeviceB-Ten-GigabitEthernet1/0/1] quit
# 將下行端口Ten-GigabitEthernet1/0/2、Ten-GigabitEthernet1/0/3添加到VLAN 201,Ten-GigabitEthernet1/0/4、Ten-GigabitEthernet1/0/5添加到VLAN 202,並配置它們工作在host模式。
[DeviceB] interface range ten-gigabitethernet 1/0/2 to ten-gigabitethernet 1/0/3
[DeviceB-if-range] port access vlan 201
[DeviceB-if-range] port private-vlan host
[DeviceB-if-range] quit
[DeviceB] interface range ten-gigabitethernet 1/0/4 to ten-gigabitethernet 1/0/5
[DeviceB-if-range] port access vlan 202
[DeviceB-if-range] port private-vlan host
[DeviceB-if-range] quit
# 創建VLAN 10。將接口Ten-GigabitEthernet1/0/1加入VLAN 10。
<DeviceA> system-view
[DeviceA] vlan 10
[DeviceA] quit
[DeviceA] interface ten-gigabitethernet 1/0/1
[DeviceA-Ten-GigabitEthernet1/0/1] port access vlan 10
[DeviceA-Ten-GigabitEthernet1/0/1] quit
# 配置網關接口VLAN-interface10。
[DeviceA] interface vlan-interface 10
[DeviceA-Vlan-interface10] ip address 10.0.0.1 24
[DeviceA-Vlan-interface10] quit
# Device A可以ping通任意用戶。查看ARP表,可以看到所有用戶均屬於VLAN 10。
[DeviceA] display arp
Type: S-Static D-Dynamic O-Openflow R-Rule M-Multiport I-Invalid
IP address MAC address VLAN/VSI Interface/Link ID Aging Type
10.0.0.2 d485-64a1-7e4a 10 XGE1/0/1 19 D
10.0.0.3 7446-a0aa-7774 10 XGE1/0/1 19 D
10.0.0.4 6805-ca05-39ae 10 XGE1/0/1 20 D
10.0.0.5 6805-ca05-414e 10 XGE1/0/1 20 D
# 顯示Device B上的Private VLAN配置情況。
[DeviceB] display private-vlan
Primary VLAN ID: 10
Secondary VLAN ID: 201-202
VLAN ID: 10
VLAN type: Static
Private VLAN type: Primary
Route interface: Not configured
Description: VLAN 0010
Name: VLAN 0010
Tagged ports: None
Untagged ports:
Ten-GigabitEthernet1/0/1 Ten-GigabitEthernet1/0/2
Ten-GigabitEthernet1/0/3 Ten-GigabitEthernet1/0/4
Ten-GigabitEthernet1/0/5
VLAN ID: 201
VLAN type: Static
Private VLAN type: Secondary
Route interface: Not configured
Description: VLAN 0201
Name: VLAN 0201
Tagged ports: None
Untagged ports:
Ten-GigabitEthernet1/0/1 Ten-GigabitEthernet1/0/2
Ten-GigabitEthernet1/0/3
VLAN ID: 202
VLAN type: Static
Private VLAN type: Secondary
Route interface: Not configured
Description: VLAN 0202
Name: VLAN 0202
Tagged ports: None
Untagged ports:
Ten-GigabitEthernet1/0/1 Ten-GigabitEthernet1/0/4
Ten-GigabitEthernet1/0/5
可以看到,工作在promiscuous模式的端口Ten-GigabitEthernet1/0/1和工作在host模式的端口Ten-GigabitEthernet1/0/2~Ten-GigabitEthernet1/0/5均以Untagged方式允許VLAN報文通過。
# Host A、B之間可以互相ping通,Host C、D之間可以互相ping通。Host A、B與Host C、D之間均不能ping通。
· Device B
#
vlan 1
#
vlan 10
private-vlan primary
private-vlan secondary 201 to 202
#
vlan 201 to 202
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port link-type hybrid
undo port hybrid vlan 1
port hybrid vlan 10 201 to 202 untagged
port hybrid pvid vlan 10
port private-vlan 10 promiscuous
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port link-type hybrid
undo port hybrid vlan 1
port hybrid vlan 10 201 untagged
port hybrid pvid vlan 201
port private-vlan host
#
interface Ten-GigabitEthernet1/0/3
port link-mode bridge
port link-type hybrid
undo port hybrid vlan 1
port hybrid vlan 10 201 untagged
port hybrid pvid vlan 201
port private-vlan host
#
interface Ten-GigabitEthernet1/0/4
port link-mode bridge
port link-type hybrid
undo port hybrid vlan 1
port hybrid vlan 10 202 untagged
port hybrid pvid vlan 202
port private-vlan host
#
interface Ten-GigabitEthernet1/0/5
port link-mode bridge
port link-type hybrid
undo port hybrid vlan 1
port hybrid vlan 10 202 untagged
port hybrid pvid vlan 202
port private-vlan host
#
· Device A
#
vlan 1
#
vlan 10
#
interface Vlan-interface10
ip address 10.0.0.1 255.255.255.0
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 10
#
· H3C S6890係列交換機 二層技術-以太網交換機配置指導(R27xx)
· H3C S6890係列交換機 二層技術-以太網交換機命令參考(R27xx)
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!