溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何實現(xiàn)不同vlan互通

發(fā)布時間:2021-10-14 13:58:06 來源:億速云 閱讀:400 作者:iii 欄目:編程語言

本篇內容介紹了“如何實現(xiàn)不同vlan互通”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

不同vlan互通

如何實現(xiàn)不同vlan互通

說明:

左側VLAN10,右側VLAN20,左側switch6 trunk口上送,右側switch7 access口上送。

所以左側router3的ge0/0/1口接收到的為到vlan tag的包,為了處理它需要起一個子接口,封裝為dot1Q 10,這才能處理此vlan10的tag包,才不至于被丟棄。

右側access口出,到router4的為untag包,所以設定個網關地址就行了。

右側switch7雖然上下游都看不到帶vlan tag的包,但其經過switch7時還是經過一個口打了vlan 20的tag,出去時拆了vlan 20的tag。

配置

router3

# 和router4的互聯(lián)地址
interface GigabitEthernet0/0/0
 ip address 10.0.1.1 255.255.255.252
 duplex auto
 speed auto
!

interface GigabitEthernet0/0/1
 no ip address
 duplex auto
 speed auto
!
# 下連switch6的邏輯口,這里我們dot1Q包裝,vlan 10
interface GigabitEthernet0/0/1.10
 encapsulation dot1Q 10
 ip address 192.168.1.254 255.255.255.0
!
# 到router4的靜態(tài)路由
ip route 192.168.2.0 255.255.255.0 10.0.1.2

route4

# 和router3的互聯(lián)地址
interface GigabitEthernet0/0/0
 ip address 10.0.1.2 255.255.255.252
 duplex auto
 speed auto
!
# 下連switch8的端口,這里只設置了網關地址
interface GigabitEthernet0/0/1
 ip address 192.168.2.254 255.255.255.0
 duplex auto
 speed auto
!
# 到router3的靜態(tài)路由
ip route 192.168.1.0 255.255.255.0 10.0.1.1

switch6

# 接router3的接口,這里trunk模式,允許所有vlan通過
interface FastEthernet0/1
 switchport mode trunk
!
# 下連PC7的端口,untag包到這里會打上10的標記
interface FastEthernet0/2
 switchport access vlan 10
!

switch7

# 接router4的端口,主要是和右側比較,這里是access模式,且是vlan20,所以可以允許下面上來vlan20的數(shù)據通過,且由此口出去到router4時就已經去掉了vlan tag
interface FastEthernet0/1
 switchport access vlan 20
!
# 接PC8,untag包經過它會打上vlan20的tag
interface FastEthernet0/2
 switchport access vlan 20
!

PC7

如何實現(xiàn)不同vlan互通

PC8

如何實現(xiàn)不同vlan互通

“如何實現(xiàn)不同vlan互通”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI