1、實驗目的
掌握跨交換機同一VLAN中的計算機通信技術。
2、實訓任務
- 根據拓撲圖連接交換機和計算機,組建局域網。
- 配置交換機,創建VLAN。
- 配置交換機的端口為TRUNK模式。
- 測試跨交換機同一VLAN 中計算機的通信。
3、端口簡介
1.Access端口
Access模式的端口只能屬於一個vlan,是交換機端口的默認模式。在access端口的鏈路上傳輸標准的以太網幀,即IEEE802.3數據幀,不附加任何標記。
2.trunk端口
trunk模式的端口同時屬於多個vlan,在兩台交換機的trunk端口之間的鏈路上傳輸的是封裝802.1q的數據幀,在發送端打上標記,接收端再拆去標記。
4、實驗過程
1、配置雙交換機的網絡拓撲結構,如圖所示
2、給兩台交換機配置名稱,分別划分vlan10 和 vlan20
這里只給出第一台交換機的配置步驟,第二台相同:
- 進入全局配置模式下,配置主機名稱
Switch>enable
Switch#conf
Switch(config)#hostname nty000
- 划分vlan10和vlan20
nty000(config)#vlan 10
nty000(config-vlan)#exit
nty00(config)#vlan 20
nty000(config-vlan)#exit
nty000(config)#exit
# 查看vlan
nty000#show vlan
- 給vlan10分配端口1-10,vlan20分配端口11-20
# 進入配置模式
nty000#conf
# 進入接口配置模式
nty000(config)#interface range fastEtherent 0/1-10
# 分配vlan 10
nty000(config-if-range)#switchport access vlan 10
# 退出
nty000(config-if-range)#exit
nty000(config)#
# 進入接口配置模式
nty000(config)#interface range fastEtherent 0/11-20
# 分配vlan 10
nty000(config-if-range)#switchport access vlan 20
# 退出
nty000(config-if-range)#exit
- 配置trunk干道
# 進入24接口
nty000(config)# interface f0/24
# 改變接口模式,配置為trunk模式
nty000(config-if)#switchport trunk allowed vlan all
# 退出
nty000(config-if)#exit
nty000(config)#exit
nty000#
- 查看vlan
- 給每台主機配置主機ip和子網掩碼
192.168.1.100 255.255.255.0
192.168.1.101 255.255.255.0
192.168.1.102 255.255.255.0
192.168.1.103 255.255.255.0
- 在命令行中ping同一vlan下的主機,驗證連通性