使用單臂路由,靜態、默認路由實現不同vlan之間互通

首先根據拓撲圖在eNSP中構建拓撲,配置PC1-6的ip,掩碼以及網關地址
在這裏插入圖片描述
PC客戶端配置ip,掩碼以及網關(切記點擊應用按鈕!!!
例:
在這裏插入圖片描述
將拓撲圖內全部設備啓動(根據配置可逐一啓動)
在這裏插入圖片描述

整理思緒,根據老師要求,需要將不同vlan的網段實現全網互通,可以將該實驗理解成三個部分
在這裏插入圖片描述
①:利用三層交換機,實現vlan10、20互通
②:利用單臂路由,實現vlan30、40互通
③:利用靜態路由、默認路由實現全網互通

開始第一部分
SW1二層交換機命令:

sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW1
[SW1]vlan bat 10 20 ###創建vlan 10 20
[SW1]int e0/0/1 ###選擇e0/0/1端口
[SW1-Ethernet0/0/1]p l a ###端口類型 access
[SW1-Ethernet0/0/1]p d v 10 ###划進vlan10
[SW1-Ethernet0/0/1]q
[SW1]
[SW1]int e0/0/2
[SW1-Ethernet0/0/2]p l a
[SW1-Ethernet0/0/2]p d v 20
[SW1-Ethernet0/0/2]q

在這裏插入圖片描述

SW2二層交換機命令:

sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW2
[SW2]
May 24 2020 16:21:08-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.vlan bat 10 20
Info: This operation may take a few seconds. Please wait for a moment…done.
[SW2]
May 24 2020 16:21:18-08:00 SW2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]p l a
[SW2-Ethernet0/0/1]p d v 10
[SW2-Ethernet0/0/1]int e0/0/2
[SW2-Ethernet0/0/2]p l a
[SW2-Ethernet0/0/2]p d v 20
[SW2-Ethernet0/0/2]q

在這裏插入圖片描述

SW1和SW2的vlan已創建完畢,且端口劃分好,接下來要實現兩個交換機中同網段可以互通
[SW1]int g0/0/2 ###選擇與交換機SW2相連的端口
[SW1-GigabitEthernet0/0/2]p l t ###端口類型trunk
[SW1-GigabitEthernet0/0/2]p t a v a ###允許通過全部vlan
[SW1-GigabitEthernet0/0/2]

在這裏插入圖片描述
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]p l t
[SW2-GigabitEthernet0/0/2]p t a v a

在這裏插入圖片描述

此時SW1的PC1與SW2的PC3,SW1的PC2與SW2的PC4可以互相鏈接,但是PC1與PC2,PC4不能連接

在這裏插入圖片描述

接下來就需要將PC1/2/3/4互相鏈接了
二層交換機SW1命令
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v a

在這裏插入圖片描述

三層交換機RSW4命令:

sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan bat 10 20
[Huawei]int vlanif 10
[Huawei-Vlanif10]ip add 192.168.10.1 24
[Huawei-Vlanif10]int vlanif 20
[Huawei-Vlanif20]ip add 192.168.20.1 24
[Huawei-Vlanif20]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v a
[Huawei-GigabitEthernet0/0/1]

在這裏插入圖片描述

此時PC1/2/3/4全部互通

在這裏插入圖片描述

到這一步區域①的全部內容完成,接下來做區域②,將PC5,6互通
二層交換SW3命令:
爲SW3劃分vlan
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys SW3
[SW3]vlan bat 30 40
Info: This operation may take a few seconds. Please wait for a moment…done.
[SW3]int e 0/0/1
[SW3-Ethernet0/0/1]p l a
[SW3-Ethernet0/0/1]p d v 30
[SW3-Ethernet0/0/1]int e0/0/2
[SW3-Ethernet0/0/2]p l a
[SW3-Ethernet0/0/2]p d v 40
[SW3-Ethernet0/0/2]q

在這裏插入圖片描述

爲SW3與R1創建鏈路
[SW3]int eth-t
[SW3]int Eth-Trunk 1
[SW3-Eth-Trunk1]t
[SW3-Eth-Trunk1]trunkport g 0/0/1 to 0/0/2
[SW3-Eth-Trunk1]p l t
[SW3-Eth-Trunk1]p t a v a
[SW3-Eth-Trunk1]q

在這裏插入圖片描述
爲路由器R1創建鏈路,vlan,且劃分端口以及分配ip
[Huawei]sys R1
[R1]vlan bat 30 40
[R1]int Eth-Trunk 1
[R1-Eth-Trunk1]trunkport g 0/0/1 to 0/0/2
[R1-Eth-Trunk1]q
[R1]int e
[R1]int Eth-t
[R1]int Eth-Trunk 1.30
[R1-Eth-Trunk1.30]d t v 30
[R1-Eth-Trunk1.30]ip add 192.168.30.1 24
[R1-Eth-Trunk1.30]a b e
[R1-Eth-Trunk1.30]int Eth-Trunk 1.4
[R1-Eth-Trunk1.40]d t v 40
[R1-Eth-Trunk1.40]ip add 192.168.40.1 24
[R1-Eth-Trunk1.40]a b e

在這裏插入圖片描述

此時區域②的步驟完成,vlan30,40可以互通

在這裏插入圖片描述

接下來是步驟③的步驟,創建靜態以及默認路由
三層交換命令
sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan bat 30 ###創建vlan30
Info: This operation may take a few seconds. Please wait for a moment…done.
[Huawei]int vlanif 30
[Huawei-Vlanif30]ip add 12.0.0.1 30 ###三層交換機需要在vlanif上配置ip
[Huawei-Vlanif30]q
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]p l a
[Huawei-GigabitEthernet0/0/3]p d v 30
[Huawei-GigabitEthernet0/0/3]q
[Huawei]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2 ###配置默認路由(向上靜態)

在這裏插入圖片描述
在這裏插入圖片描述

[R1]int g0/0/3
May 24 2020 17:21:53-08:00 R1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 15, the c
hange loop count is 0, and the maximum number of recordint g0/0/3
[R1-GigabitEthernet0/0/3]ip add 12.0.0.2 30
[R1-GigabitEthernet0/0/3]q
[R1]ip route-static 192.168.10.0 24 12.0.0.1
[R1]ip route-static 192.168.20.0 24 12.0.0.1
[R1]q

在這裏插入圖片描述

此時全機互通,實驗完成

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章