1. 程式人生 > >交換技術之 Valn 的簡單理解及不同Vlan互通

交換技術之 Valn 的簡單理解及不同Vlan互通

vlan trunk 單臂路由 三層交換

交換技術之 Valn 的簡單理解及不同Vlan互通


一、Vlan解決的問題


  • 解決同一個網段間廣播數據的隔離

  • 擴展:借助三層設備可以即隔離了二層同網段的廣播數據,也可以實現不同網段的鏈接互通。


二、Vlan簡單理解


  • 在一個交換機上劃分了好幾個區域,每個區域都是一個相互隔離的容器(隔離的內容就是網絡中的廣播數據)。

技術分享


  • 不同的Vlan之間互通,一般是指不同的網段之間互通。既然網段都不一樣了,想要通信的那就在‘二層’無法做到,就需要‘三層’的路由技術(即需要‘網關’:門口管理員,想去那裏和我說下,我看你能去不,哈哈哈)。

技術分享


  • 同一個Vlan分別在不同的交換機上的互通,就需要借助 trunk(中繼技術)來實現。個人理解:就是在交換機 1上有10個口歸歸Vlan1管理 ,現在想擴展地盤了,連交換機2上邊的 Vlan1 的口子 也管理起來。

技術分享


  • 不同的Vlan之間互通的另一種方式是,用3層設備路由器去做‘看門的人 ’(網關)。

技術分享


三、模擬器實驗一


  • 目的:通過Vlan 將同一個網段的廣播域隔離,即同一個網段的兩個IP ,當屬於不同Vlan的時候不能互通。


  • 拓撲:

技術分享


  • 交換機配置:


Switch#show vlan br

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gig1/1, Gig1/2
10   VLAN0010                         active    Fa0/1, Fa0/2
40   VLAN0040                         active    Fa0/4
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
Switch#



四、模擬器實驗二


  • 目的:通過3層交換機的路由功能實現不同網段互通

  • 拓撲:

技術分享

  • 交換機配置:


S1#show vlan br

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa2/1, Fa3/1, Fa4/1, Fa5/1
10   VLAN0010                         active    Fa0/1
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S1#


S2#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa2/1, Fa3/1, Fa4/1, Fa5/1
20   VLAN0020                         active    Fa0/1
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S2#


S3#show  vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig0/1, Gig0/2
10   VLAN0010                         active    
20   VLAN0020                         active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S3#


S3#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       desirable    n-802.1q       trunking      1
Fa0/2       auto         n-802.1q       trunking      1

Port        Vlans allowed on trunk
Fa0/1       1-1005
Fa0/2       1-1005

Port        Vlans allowed and active in management domain
Fa0/1       1,10,20
Fa0/2       1,10,20

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       1,10,20
Fa0/2       1,10,20
S3#


S3#show ip interface brief 
Interface              IP-Address      OK? Method Status                Protocol
 
FastEthernet0/1        unassigned      YES unset  up                    up
 
FastEthernet0/2        unassigned      YES unset  up                    up
 
FastEthernet0/3        unassigned      YES unset  down                  down
 
.
.
 
Vlan1                  unassigned      YES unset  administratively down down
 
Vlan10                 192.168.1.254   YES manual up                    up
 
Vlan20                 192.168.2.254   YES manual up                    up
S3#



五、模擬器實驗三


  • 目的:通過路由器實現不同網段互通,即單臂路由或一根棍路由。


  • 拓撲:


技術分享

  • 交換機配置:


Switch#show vlan br

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/4, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/15
                                                Fa0/16, Fa0/17, Fa0/18, Fa0/19
                                                Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24, Gig1/1, Gig1/2
10   VLAN0010                         active    Fa0/1
20   VLAN0020                         active    Fa0/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
Switch#


  • 路由器配置


Router#show  ip  route 
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/0.1
C    192.168.2.0/24 is directly connected, FastEthernet0/0.2
Router#


Router#show ip interface brief 
Interface              IP-Address      OK? Method Status                Protocol
 
FastEthernet0/0        unassigned      YES unset  up                    up
 
FastEthernet0/0.1      192.168.1.254   YES manual up                    up
 
FastEthernet0/0.2      192.168.2.254   YES manual up                    up
 
FastEthernet1/0        unassigned      YES unset  administratively down down
 
Router#


Router#show  running-config 
Building configuration...

Current configuration : 800 bytes
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/0.1
 encapsulation dot1Q 10
 ip address 192.168.1.254 255.255.255.0
!
interface FastEthernet0/0.2
 encapsulation dot1Q 20
 ip address 192.168.2.254 255.255.255.0
!

Router#



六、總結:


  • 可以利用Vlan將1臺交換機劃分出不同Vlan,實現虛擬出多臺交換機的樣子

  • 可以利用Vlan的三層交換功能實現不同Vlan(也是不同網段)之間互通,也可以通過將路由器的子接口封裝(encapsulation)成dot1Q(即Vlan)實現。

#

本文出自 “Frog的技術歸檔” 博客,請務必保留此出處http://frogtwo.blog.51cto.com/3805708/1941255

交換技術之 Valn 的簡單理解及不同Vlan互通