利用三層交換機實現不一樣VLAN間的訪問

【實驗名稱】
VLAN/802.1Q-VLAN間的通訊
【實驗目的】
經過三層交換機實現VLAN間互相通訊
【實驗功能】
使在同一VLAN裏的計算機系統能跨交換機進行相互通訊,而在不一樣VLAN裏的計算機系統也能進行相互通訊
【實驗設備】
三層交換機(1臺)、普通可網管交換機(1臺)、直連線(3條)
【實驗拓撲】
 
 
【實驗步驟】
三層交換機:3Switch1
Switch>enable
Switch#configure terminal
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet 0/5
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/15
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/24
Switch(config-if)#switchport mode trunk
 
二層交換機:Switch1
Switch>enable
Switch#configure terminal
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet 0/5
Switch(config-if)#switchport access vlan 10
Switch(config)#interface fastEthernet 0/24
Switch(config-if)#switchport mode trunk
如今咱們把192.168.10.1 、192.168.10.2分別給VLAN10 裏的2個PC
192.168.10.3 給VLAN 20的 PC
此時發現
PC>ping 192.168.10.2
Pinging 192.168.10.2 with 32 bytes of data:
Reply from 192.168.10.2: bytes=32 time=93ms TTL=128
Reply from 192.168.10.2: bytes=32 time=78ms TTL=128
Reply from 192.168.10.2: bytes=32 time=93ms TTL=128
Reply from 192.168.10.2: bytes=32 time=94ms TTL=128
Ping statistics for 192.168.10.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 78ms, Maximum = 94ms, Average = 89ms
PC>ping 192.168.10.3
Pinging 192.168.10.3 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 192.168.10.3:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
相同VLAN能夠通訊 不一樣VLAN 不可通訊!
本章節關鍵就在這裏!
繼續在三層交換機配置
Switch(config)#interface vlan 10              (進入虛擬VLAN接口)
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.10.254 255.255.255.0        (配置IP地址 即VLAN10網關)
Switch(config-if)#exit
Switch(config)#interface vlan 20
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.20.254 255.255.255.0
 
這時把VLAN20的PC IP改爲192.168.20.1    由於要和網關一個網段 (開始配置是爲了證實不通VLAN 就算一個網段IP亦不可通)
VLAN10 的PC 網關改成192.168.10.254  VLAN 20PC網關 192.168.20.254
此時:
PC>ping 192.168.10.1
Pinging 192.168.10.1 with 32 bytes of data:
Reply from 192.168.10.1: bytes=32 time=62ms TTL=127
Reply from 192.168.10.1: bytes=32 time=63ms TTL=127
Reply from 192.168.10.1: bytes=32 time=31ms TTL=127
Reply from 192.168.10.1: bytes=32 time=62ms TTL=127
Ping statistics for 192.168.10.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 31ms, Maximum = 63ms, Average = 54ms
PC>ping 192.168.10.2
Pinging 192.168.10.2 with 32 bytes of data:
Reply from 192.168.10.2: bytes=32 time=94ms TTL=127
Reply from 192.168.10.2: bytes=32 time=93ms TTL=127
Reply from 192.168.10.2: bytes=32 time=78ms TTL=127
Reply from 192.168.10.2: bytes=32 time=94ms TTL=127
Ping statistics for 192.168.10.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 78ms, Maximum = 94ms, Average = 89ms
全網互通!
相關文章
相關標籤/搜索