- 組網需求
• Host A 和Host C 屬於部門A,但是通過不同的設備接入公司網絡;Host B 和Host D 屬於部
門B,也通過不同的設備接入公司網絡。
• 爲了通信的安全性,也爲了避免廣播報文氾濫,公司網絡中使用 VLAN 技術來隔離部門間的
二層流量。其中部門A 使用VLAN 100,部門B 使用VLAN 200。
• 現要求不管是否使用相同的設備接入公司網絡,同一 VLAN 內的主機能夠互通,即Host A 和
Host C 能夠互通,Host B 和Host D 能夠互通。
- 配置步驟
(1) 配置 Device A創建VLAN 100,並將GigabitEthernet1/0/1 加入VLAN 100。
<DeviceA> system-view
[DeviceA] vlan 100
[DeviceA-vlan100] port gigabitethernet 1/0/1
[DeviceA-vlan100] quit
創建VLAN 200,並將GigabitEthernet1/0/2 加入VLAN 200。
[DeviceA] vlan 200
[DeviceA-vlan200] port gigabitethernet 1/0/2
[DeviceA-vlan200] quit
爲了使Device A 上VLAN 100 和VLAN 200 的報文能發送給Device B , 將
GigabitEthernet1/0/3 的鏈路類型配置爲Trunk,並允許VLAN 100 和VLAN 200 的報文通過。
[DeviceA] interface gigabitethernet 1/0/3
[DeviceA-GigabitEthernet1/0/3] port link-type trunk
[DeviceA-GigabitEthernet1/0/3] port trunk permit vlan 100 200
(2) Device B 上的配置與Device A 上的配置相同,不再贅述。
(3) 將Host A 和Host C 配置在一個網段,比如192.168.100.0/24;將Host B 和Host D 配置在
一個網段,比如192.168.200.0/24。
- 驗證配置
(1) Host A 和Host C 能夠互相ping 通,但是均不能ping 通Host B。Host B 和Host D 能夠互相
ping 通,但是均不能ping 通Host A。
(2) 通過查看顯示信息驗證配置是否成功。查看Device A 上VLAN 100 和VLAN 200 的配置信息,驗證以上配置是否生效。
[DeviceA-Ten-GigabitEthernet1/0/3] display vlan 100
VLAN ID: 100
VLAN type: Static
Route interface: Not configured
Description: VLAN 0100
Name: VLAN 0100
Tagged ports:
Ten-GigabitEthernet1/0/3
1-13
Untagged ports:
Ten-GigabitEthernet1/0/1
[DeviceA-Ten-GigabitEthernet1/0/3] display vlan 200
VLAN ID: 200
VLAN type: Static
Route interface: Not configured
Description: VLAN 0200
Name: VLAN 0200
Tagged ports:
Ten-GigabitEthernet1/0/3
Untagged ports:
Ten-GigabitEthernet1/0/2