写在前面
- 问答平台看到这样一个问题,回答后所以顺便整理一下
- 一般情况下,三层交换机不直接连终端,太浪费了,可以连一个交换机然后再连终端
傍晚时分,你坐在屋檐下,看着天慢慢地黑下去,心里寂寞而凄凉,感到自己的生命被剥夺了。当时我是个年轻人,但我害怕这样生活下去,衰老下去。在我看来,这是比死亡更可怕的事。--------王小波
案例
需求:实验室有一条接入网线,该网线直接连接PC,PC的IP设置为 192.168.100.xxx 后可以访问服务器机房的服务器(IP为192.168.100.1),但是想要实验室内的多台PC都能访问 192.168.100.1,请问交换机应该如何配置?
拓扑图
设计拓扑图
拓扑图。配置 |
|
配置三层交换机 |
配置终端IP |
ping测试 |
配置
配置三层交换机
在三层交换机LSW上创建VLAN
Please press enter to start cmd line!
syst
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 100 10
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]
Oct 16 2021 14:06:41-08:00 Huawei 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, th
e change loop count is 0, and the maximum number of records is 4095.
[Huawei]quit
undo terminal debugging
Info: Current terminal debugging is off.
undo terminal monitor
Info: Current terminal monitor is off.
undo terminal logging
Info: Current terminal logging is off.
undo terminal trapping
Info: Current terminal trapping is off.
将接口加入到对应VLAN中
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type access
[Huawei-GigabitEthernet0/0/1]port default vlan 100
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]port-group 2
[Huawei-port-group-2]group-member GigabitEthernet 0/0/2 GigabitEthernet 0/0/3
[Huawei-port-group-2]port link-type access
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/3]port link-type access
[Huawei-port-group-2]port default vlan 10
[Huawei-GigabitEthernet0/0/2]port default vlan 10
[Huawei-GigabitEthernet0/0/3]port default vlan 10
[Huawei-port-group-2]quit
在三层交换机上给VLAN配置网关
[Huawei]interface Vlanif 100
[Huawei-Vlanif100]ip address 192.168.100.254 24
[Huawei-Vlanif100]quit
[Huawei]interface Vlanif 10
[Huawei-Vlanif10]ip address 192.168.10.254 24
[Huawei-Vlanif10]quit
[Huawei]display ip routing-table 关键词:华为三层交换机设置不同网段互通(三层交换机设置不同网段通信)