使用交換機搭建一個簡單的局域網(路由器交換機如何組建局域網)
模擬及地址劃分
設計一個單位的網絡,分為三個部門,地址如下:
部門名
IP地址
子網掩碼
網關
部門A
19.20.20.*
255.255.255.0
19.29.20.1
部門B
19.20.21.*
255.255.255.0
19.29.21.1
部門C
19.20.22.*
255.255.255.0
19.29.22.1
設計一個單位的服務器網絡,分為2個服務器,地址如下:
服務器名
IP地址
子網掩碼
網關
服務A
18.20.19.2
255.255.255.0
19.29.19.1
服務B
18.20.19.3
255.255.255.0
19.29.19.1
規劃不同部門及服務器在不同的網段,將其分在不同的vlan下面,主要是為了隔離廣播風暴,提高網速。然后通過核心交換機進行數據交換。
三、拓撲結構圖
拓撲結構圖如上,地址分配也已經在圖上展現,接下來就是配置了。
四、各個設備配置
01
PART
配置核心交換機
先分VLAN,如下圖:
再配置各個接口類型,如下圖:
然后配置各個vlan的網關。如下圖:
[Huawei]clear configuration int g0/0/1 //由于之前配置失誤,這里清除一下配置
Warning: All configurations of the interface will be cleared, and its state will
be shutdown. Continue? [Y/N] :y
Info: Total execute 2 command(s), 2 successful, 0 failed.
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]
[Huawei-GigabitEthernet0/0/1]port link-type trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int vlanif 10
[Huawei-Vlanif10]ip add
[Huawei-Vlanif10]ip address 18.29.20.1 25
[Huawei-Vlanif10]ip address 18.29.20.1 24
[Huawei-Vlanif10]q
[Huawei]int Vlanif 20
[Huawei-Vlanif20]ip add
[Huawei-Vlanif20]ip address 18.29.21.1 24
[Huawei-Vlanif20]q
[Huawei]int vlanif 30
[Huawei-Vlanif30]
[Huawei-Vlanif30]ip add
[Huawei-Vlanif30]ip address 18.29.22.1 24
[Huawei-Vlanif30]
[Huawei-Vlanif30]q
[Huawei]
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]undo shu
[Huawei-GigabitEthernet0/0/1]undo shutdown //由于清理了配置,所以需要重啟端口1
[Huawei-GigabitEthernet0/0/1]q
[Huawei]vlan 40
[Huawei-vlan40]q
[Huawei]int vlanif 40
[Huawei-Vlanif40]ip add
[Huawei-Vlanif40]ip address 18.29.19.1 24
02
PART
配置服務器的交換機
sys
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/1]q
[Huawei]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type trunk
[Huawei-Ethernet0/0/2]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/2]q
[Huawei]int e0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 40
Error: The VLAN does not exist.
[Huawei-Ethernet0/0/3]q
[Huawei]vlan 40
[Huawei-vlan40]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type access
Error: Please renew the default configurations.
[Huawei-Ethernet0/0/2]q
[Huawei]cle
[Huawei]clear configuration interface e0/0/2
Warning: All configurations of the interface will be cleared, and its state will
be shutdown. Continue? [Y/N] :y
Info: Total execute 2 command(s), 2 successful, 0 failed.
[Huawei]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type a
[Huawei-Ethernet0/0/2]
[Huawei-Ethernet0/0/2]port default vlan 40
[Huawei-Ethernet0/0/2]undo shutdown
[Huawei-Ethernet0/0/2]
[Huawei-Ethernet0/0/2]q
[Huawei]int e0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 40
[Huawei-Ethernet0/0/3]q
[Huawei]
[Huawei]
五、測試聯通性
01
PC1 PING PC2
01
PC1 PING PC3
01
PC1 PING 核心網關
01
PC1 PING 服務器
六、結語
通過以上配置,就可以完成一個較為高級的局域網配置了,大部分中等局域網都是這么配置的,這樣的配置也適用大多網絡。你們看懂了嗎?