三層交換實(shí)現(xiàn)vlan間路由配置實(shí)例詳解2016
華為三層交換機(jī)怎么實(shí)現(xiàn)vlan間路由配置呢?有哪些基本命令呢?下面yjbys小編為大家分享三層交換實(shí)現(xiàn)vlan間路由配置實(shí)例詳細(xì)介紹,僅供參考!
一、實(shí)驗(yàn)網(wǎng)絡(luò)拓?fù)洌?/strong>
使用ENSP模擬器(版本V100R002C00 1.2.00.350)
二、實(shí)驗(yàn)需求:
屬于vlan 10的C1能和屬于vlan 20的C3、C4及R1通信
三、實(shí)驗(yàn)步驟:
A. IP地址及valn劃分規(guī)劃配置如下:
C1:ip地址為192.168.10.10/24 屬于vlan 10
C2: ip地址為192.168.20.20/24屬于vlan 20
C3: ip地址為192.168.10.30/24屬于vlan 10
C4: ip地址為192.168.20.40/24屬于vlan 20
Sw1: vlan10 的網(wǎng)關(guān)為192.168.10.1/24
vlan20 的網(wǎng)關(guān)為192.168.20.1/24
G0/0/3屬于vlan100ip為201.100.100.1 /24
R1:G0/0/0 ip為201.100.100.2/24
B.配置腳本:
1.交換機(jī)SW2的配置
先在交換機(jī)上加VLAN 10 20,再設(shè)置接口傳輸模式為access口
sy
[Huawei]vlan bat 10 20 #批量加vlan10和20
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]portlink-type ac
[Huawei-Ethernet0/0/1]port link-typeaccess #接口類型為access
[Huawei-Ethernet0/0/1]port defaultvlan 10 #讓接口屬于vlan10
[Huawei-Ethernet0/0/1]inte0/0/2
[Huawei-Ethernet0/0/2]portlink-type ac
[Huawei-Ethernet0/0/2]portlink-type access
[Huawei-Ethernet0/0/2]portde
[Huawei-Ethernet0/0/2]portdefault vlan 20
[Huawei-Ethernet0/0/2]intg0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk #將g0/0/1設(shè)為trunk 中繼口
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 10 20
#此中繼接口允許vlan1 10 20的數(shù)據(jù)過,也稱透?jìng)?/p>
用display vlan 查看配置結(jié)果如下圖
l 給交換機(jī)SW2配IP地址和網(wǎng)關(guān),便于遠(yuǎn)程管理
因?yàn)榻粨Q機(jī)的接口是二層接口不能陪IP,所以給交換機(jī)配IP只能為其VLAN虛擬口配IP
[Huawei]int vlan 1
[Huawei-Vlanif1]ip add192.168.1.254 24
[Huawei-Vlanif1]q
在華為模擬器上通過設(shè)默認(rèn)路由的方式為其設(shè)置網(wǎng)關(guān)
[Huawei]ip route-s
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
[Huawei]
用display ip interface brief查看各接口配置
2.交換機(jī)SW3的配置
為交換機(jī)SW3配VLAN,接口傳輸模式為hybrid untagged模式,hybriduntagged模式不帶標(biāo)簽相當(dāng)于access模式,hybrid tagged模式帶標(biāo)簽相當(dāng)于trunk模式
sy
[Huawei]vlan bat 10 20
[Huawei]interface e0/0/3
[Huawei-Ethernet0/0/3]portlink-type hybrid #將接口類型設(shè)為hybrid混合接口,華為三層交換機(jī)接口默認(rèn)就是hybrid,屬于這條命令可以不用寫
[Huawei-Ethernet0/0/3]port hybridpvid vlan 10
[Huawei-Ethernet0/0/3]porthy
[Huawei-Ethernet0/0/3]porthybrid un
[Huawei-Ethernet0/0/3]porthybrid untagged
[Huawei-Ethernet0/0/3]porthybrid untagged vlan 10 #允許vlan10 的數(shù)據(jù)過且不帶標(biāo)簽
[Huawei-Ethernet0/0/3]inte0/0/4
[Huawei-Ethernet0/0/4]porthybrid pvid vlan 20
[Huawei-Ethernet0/0/4]porthybrid un
[Huawei-Ethernet0/0/4]porthybrid untagged vlan 20
[Huawei-Ethernet0/0/4]
[Huawei-Ethernet0/0/4]intg0/0/1
[Huawei-GigabitEthernet0/0/1]porthybrid pvid vlan 10
[Huawei-GigabitEthernet0/0/1]porthybrid pvid vlan 20
[Huawei-GigabitEthernet0/0/1]porthy
[Huawei-GigabitEthernet0/0/1]porthybrid t
[Huawei-GigabitEthernet0/0/1]porthybrid tagged vlan 10 20
#允許vlan10 20的數(shù)據(jù)通過且?guī)?biāo)簽
用display vlan查看vlan配置
給交換機(jī)vlan1配ip地址和網(wǎng)關(guān),便于遠(yuǎn)程管理
[Huawei-GigabitEthernet0/0/1]intvlan 1
[Huawei-Vlanif1]ip add192.168.1.253 24
[Huawei-Vlanif1]q
[Huawei]ip route-s
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
[Huawei]
結(jié)果如圖:
3.三層交換機(jī)SW1的配置
給交換機(jī)SW1配vlan
sy
[Huawei]vlan bat 10 20 100
[Huawei]interface g0/0/1
[Huawei-GigabitEthernet0/0/1]portlink-type trunk
[Huawei-GigabitEthernet0/0/1]porttrunk allow-pass vlan 1 10 20
[Huawei-GigabitEthernet0/0/1]intg0/0/2
[Huawei-GigabitEthernet0/0/2]port hybridpvid vlan 1
[Huawei-GigabitEthernet0/0/2]port hybridpvid vlan 10
[Huawei-GigabitEthernet0/0/2]port hybridpvid vlan 20
[Huawei-GigabitEthernet0/0/2]porthybrid un
[Huawei-GigabitEthernet0/0/2]port hybriduntagged vlan 1 10 20
[Huawei-GigabitEthernet0/0/2]intg0/0/3
[Huawei-GigabitEthernet0/0/3]portlink-type ac
[Huawei-GigabitEthernet0/0/3]portlink-type access
[Huawei-GigabitEthernet0/0/3]portde
[Huawei-GigabitEthernet0/0/3]portdefault vlan 100
給vlan110 20 100配ip地址
[Huawei-GigabitEthernet0/0/3]intvlan 1
[Huawei-Vlanif1]ipadd 192.168.1.1 24
[Huawei-Vlanif1]
[Huawei]intvlan 10
[Huawei-Vlanif10]
[Huawei-Vlanif10]ip add192.168.10.1 24
[Huawei-Vlanif10]
[Huawei-Vlanif10]int vlan20
[Huawei-Vlanif20]ip add192.168.20.1 24
[Huawei-Vlanif20]
[Huawei-Vlanif20]int vlan100
[Huawei-Vlanif100]ip add201.100.100.1 24
為交換機(jī)配默認(rèn)路由
[Huawei]iproute-s
[Huawei]ip route-static 0.0.0.0 0.0.0.0 201.100.100.2
結(jié)果如圖:
4.路由器R1 的配置
給路由器R1接口配ip地址和默認(rèn)路由
sy
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ipadd 201.100.100.2 24
[Huawei]ip route-s
[Huawei]ip route-static 0.0.0.0 0.0.0.0 201.100.100.1
用display ip int b查看接口配置,用displayip routing-t查看路由表,結(jié)果如圖
4).驗(yàn)證結(jié)果
因?yàn)镃1和C3屬于vlan10,C2和C4屬于vlan20,如果沒有做vlan間路由,不同vlan間的成員是無法通信的.,現(xiàn)在用C1 ping C2、C4和R1就說明vlan間路由是做成功的
C1 ping C2 d的ip192.168.20.20和C4的ip192.168.20.40 結(jié)果如圖:
C1ping R1的ip201.100.100.2 結(jié)果如圖:
由上可得華為三層交換vlan間路由的實(shí)驗(yàn)成功了。
【三層交換實(shí)現(xiàn)vlan間路由配置實(shí)例詳解2016】相關(guān)文章:
三層交換實(shí)現(xiàn)VLAN間路由配置方法08-15
三層交換VLAN路由配置技巧詳解05-09
三層交換機(jī)怎么實(shí)現(xiàn)VLAN間路由11-13
華為三層交換機(jī)VLAN間路由怎么設(shè)置11-13
華為交換機(jī)路由器配置實(shí)例201610-04