Cyber_Security_Notes/A. 第一阶段/拓扑练习/0822_VLAN聚合.md

112 lines
2.7 KiB
Markdown
Raw Normal View History

2024-08-22 18:19:15 +08:00
# VLAN聚合
![image-20240822175016583](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240822175016583.png)
### 一、配置PC的IP、子网掩码、网关
### 二、配置二层交换机
- **SW2**
```
<Huawei>u t m
<Huawei>sys
[Huawei]sys SW2
[SW2]vlan batch 10 20 30
[SW2]port-group 1
[SW2-port-group-1]group-member g0/0/2 g0/0/3
[SW2-port-group-1]port link-type access
2024-08-22 20:23:21 +08:00
[SW2-port-group-1]port default vlan 10
[SW2-port-group-1]quit
2024-08-22 18:19:15 +08:00
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]port link-type trunk
2024-08-22 20:23:21 +08:00
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW2-GigabitEthernet0/0/1]return
2024-08-22 18:19:15 +08:00
<SW2>save
```
- **SW3**
```
<Huawei>u t m
<Huawei>sys
[Huawei]sys SW3
2024-08-22 20:23:21 +08:00
[SW3]vlan batch 10 20 30
2024-08-22 18:19:15 +08:00
[SW3]port-group 1
[SW3-port-group-1]group-member g0/0/2 g0/0/3
[SW3-port-group-1]port link-type access
2024-08-22 20:23:21 +08:00
[SW3-port-group-1]port default vlan 20
[SW3-port-group-1]quit
2024-08-22 18:19:15 +08:00
[SW3]int g0/0/1
2024-08-22 20:23:21 +08:00
[SW3-GigabitEthernet0/0/1]port link-type trunk
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW3-GigabitEthernet0/0/1]return
2024-08-22 18:19:15 +08:00
<SW3>save
```
- **SW4**
```
<Huawei>u t m
<Huawei>sys
[Huawei]sys SW4
2024-08-22 20:23:21 +08:00
[SW4]vlan batch 10 20 30
2024-08-22 18:19:15 +08:00
[SW4]port-group 1
[SW4-port-group-1]group-member g0/0/2 g0/0/3
[SW4-port-group-1]port link-type access
2024-08-22 20:23:21 +08:00
[SW4-port-group-1]port default vlan 30
[SW4-port-group-1]quit
2024-08-22 18:19:15 +08:00
[SW4]int g0/0/1
2024-08-22 20:23:21 +08:00
[SW4-GigabitEthernet0/0/1]port link-type trunk
[SW4-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[SW4-GigabitEthernet0/0/1]return
2024-08-22 18:19:15 +08:00
<SW4>save
```
### 三、配置三层交换机
- **SW1**
```
<Huawei>u t m
<Huawei>sys
2024-08-22 20:23:21 +08:00
[Huawei]sys SW1
[SW1]vlan batch 10 20 30 100
2024-08-22 18:19:15 +08:00
[SW1]vlan 100
[SW1-vlan100]aggregate-vlan
[SW1-vlan100]access-vlan 10 20 30
2024-08-22 20:23:21 +08:00
[SW1-vlan100]quit
2024-08-22 18:19:15 +08:00
[SW1]int vlanif 100
[SW1-Vlanif100]ip a 192.168.100.254 24
[SW1-Vlanif100]arp-proxy inter-sub-vlan-proxy enable
2024-08-22 20:23:21 +08:00
[SW1-Vlanif100]quit
2024-08-22 18:19:15 +08:00
[SW1]port-group group-member g0/0/1 to g0/0/3
[SW1-port-group]port link-type trunk
2024-08-22 20:23:21 +08:00
[SW1-port-group]port trunk allow-pass vlan 10 20 30
[SW1-port-group]return
<SW1>save
2024-08-22 18:19:15 +08:00
```
### 四、测试
- PING
```
PC6>ping 192.168.100.1
Ping 192.168.100.1: 32 data bytes, Press Ctrl_C to break
From 192.168.100.6: Destination host unreachable
From 192.168.100.1: bytes=32 seq=1 ttl=127 time=78 ms
From 192.168.100.1: bytes=32 seq=2 ttl=127 time=78 ms
From 192.168.100.1: bytes=32 seq=3 ttl=127 time=94 ms
From 192.168.100.1: bytes=32 seq=4 ttl=127 time=78 ms
From 192.168.100.1: bytes=32 seq=5 ttl=127 time=78 ms
--- 192.168.100.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/81/94 ms
```