VLAN 間路由是一個把網(wǎng)絡(luò)流量從一個 VLAN 轉(zhuǎn)發(fā)到另一個 VLAN 的過程
VLAN 間路由有三種選項:
-
傳統(tǒng)的 VLAN 間路由?- 這是一個傳統(tǒng)的解決方案。它的擴(kuò)展性乏善可陳。
-
單臂路由器?- 在中小型網(wǎng)絡(luò)中,這是一種可以接受的解決方案
- 使用交換虛擬接口 (SVI) 的第 3 層交換機(jī)?- 這種解決方案最具可擴(kuò)展性,適用于中型到大型組織機(jī)構(gòu)。
?
?
?
單臂路由(router-on-a-stick)是指在路由器的一個接口上通過配置子接口(或“邏輯接口”,并不存在真正物理接口)的方式,實現(xiàn)原來相互隔離的不同VLAN(虛擬局域網(wǎng))之間的互聯(lián)互通。
- 路由器的一個物理接口可以被劃分為多個邏輯接口
- 每個子接口對應(yīng)一個VLAN網(wǎng)段的網(wǎng)關(guān)
- encapsulation dot1q?此命令將子接口配置為響應(yīng)來自指定?vlan-id?的 802.1Q 封裝的流量.
- ip address?這條命令的作用是給子接口配置 IPv4 地址。這個地址一般會充當(dāng)對應(yīng) VLAN 的默認(rèn)網(wǎng)關(guān)。
?優(yōu)點:實現(xiàn)不同vlan之間的通信
?缺點:容易成為網(wǎng)絡(luò)單點故障,配置稍有復(fù)雜
802.1q協(xié)議:就是給VLAN打標(biāo)簽,區(qū)分VLAN
拓?fù)浯罱?/h2>
vlan配置
S1(config)#vlan 10
S1(config-vlan)#vlan 20
S1(config-vlan)#vlan 30
S1(config-vlan)#exit
S1(config)#interface f0/1
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 10
S1(config-if)#exit
S1(config)#interface f0/2
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 20
S1(config-if)#exit
S1(config)#interface f0/3
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 30
S1(config-if)#exit
S1(config)#interface gigabitEthernet 0/1
S1(config-if)#switchport mode trunk
S1(config-if)#switchport trunk allowed vlan all
S1(config-if)#exit
S2(config)#vlan 10
S2(config-vlan)#vlan 20
S2(config-vlan)#vlan 30
S2(config-vlan)#exit
S2(config)#interface f0/1
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 10
S2(config-if)#exit
S2(config)#interface f0/2
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 20
S2(config-if)#exit
S2(config)#interface f0/3
S2(config-if)#switchport mode access
S2(config-if)#switchport access vlan 30
S2(config-if)#exit
S2(config)#interface gigabitEthernet 0/1
S2(config-if)#switchport mode trunk
S2(config-if)#switchport trunk allowed vlan all
S2(config-if)#exit
S3(config)#vlan 10
S3(config-vlan)#vlan 20
S3(config-vlan)#vlan 30
S3(config-vlan)#exit
S3(config)#interface gigabitEthernet 0/1
S3(config-if)#switchport mode trunk
S3(config-if)#switchport trunk allowed vlan all
S3(config-if)#exit
S3(config)#interface g0/2
S3(config-if)#switchport mode trunk
S3(config-if)#switchport trunk allowed vlan all
S3(config-if)#exit
查看VLAN信息
?
?連通性測試
PC1 | 192.168.1.2 | 255.255.255.0 |
PC2 | 192.168.2.2 | 255.255.255.0 |
PC3 | 192.168.3.2 | 255.255.255.0 |
PC4 | 192.168.1.3 | 255.255.255.0 |
PC5 | 192.168.2.3 | 255.255.255.0 |
PC6 | 192.168.3.3 | 255.255.255.0 |
?同一VLAN通;不同VLAN不通?
?配置單臂路由
單臂路由目的就是為了使得不同VLAN之間進(jìn)行一個通信,有點像是“網(wǎng)關(guān)”
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 192.168.1.0
R1(config-router)#network 192.168.2.0
R1(config-router)#network 192.168.3.0
R1(config-router)#exit
R1(config)#interface g0/0
R1(config-if)#no ip address
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface gigabitEthernet 0/0.1
R1(config-subif)#encapsulation dot1Q 1
R1(config-subif)#ip address 192.168.1.1 255.255.255.0
R1(config-subif)#exit
R1(config)#interface gigabitEthernet 0/0.2
R1(config-subif)#encapsulation dot1Q 2
R1(config-subif)#ip address 192.168.2.1 255.255.255.0
R1(config-subif)#exit
R1(config)#interface gigabitEthernet 0/0.3
R1(config-subif)#encapsulation dot1Q 3
R1(config-subif)#ip address 192.168.3.1 255.255.255.0
R1(config-subif)#exit
查看路由表
文章來源:http://www.zghlxwxcb.cn/news/detail-493040.html
OK,配置完成!文章來源地址http://www.zghlxwxcb.cn/news/detail-493040.html
到了這里,關(guān)于Cisco簡單配置(六)—VLAN間的路由:單臂路由的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!