三个交换机分别为S1、S2、S3,两台PC分别为PCA和PCB,如果两台主机都属于同一个VLAN,要想实现主机之间的互通,三台交换机上需要怎么配置,用H3C
时间: 2024-03-06 22:49:09 浏览: 59
华为交换机划分vlan
3星 · 编辑精心推荐
在这种情况下,需要在三个交换机上进行以下配置:
1. 创建VLAN,并将两台主机分配到该VLAN中:
```
<S1> system-view
[S1] vlan 10
[S1-vlan10] quit
[S1] interface GigabitEthernet 1/0/1
[S1-GigabitEthernet1/0/1] port link-type access
[S1-GigabitEthernet1/0/1] port default vlan 10
[S1-GigabitEthernet1/0/1] quit
```
```
<S2> system-view
[S2] vlan 10
[S2-vlan10] quit
[S2] interface GigabitEthernet 1/0/1
[S2-GigabitEthernet1/0/1] port link-type access
[S2-GigabitEthernet1/0/1] port default vlan 10
[S2-GigabitEthernet1/0/1] quit
```
```
<S3> system-view
[S3] vlan 10
[S3-vlan10] quit
[S3] interface GigabitEthernet 1/0/1
[S3-GigabitEthernet1/0/1] port link-type access
[S3-GigabitEthernet1/0/1] port default vlan 10
[S3-GigabitEthernet1/0/1] quit
```
2. 配置交换机之间的链路:
```
<S1> system-view
[S1] interface GigabitEthernet 1/0/2
[S1-GigabitEthernet1/0/2] port link-type trunk
[S1-GigabitEthernet1/0/2] port trunk allow-pass vlan 10
[S1-GigabitEthernet1/0/2] quit
```
```
<S1> interface GigabitEthernet 1/0/3
[S1-GigabitEthernet1/0/3] port link-type trunk
[S1-GigabitEthernet1/0/3] port trunk allow-pass vlan 10
[S1-GigabitEthernet1/0/3] quit
```
```
<S2> system-view
[S2] interface GigabitEthernet 1/0/2
[S2-GigabitEthernet1/0/2] port link-type trunk
[S2-GigabitEthernet1/0/2] port trunk allow-pass vlan 10
[S2-GigabitEthernet1/0/2] quit
```
```
<S2> interface GigabitEthernet 1/0/3
[S2-GigabitEthernet1/0/3] port link-type trunk
[S2-GigabitEthernet1/0/3] port trunk allow-pass vlan 10
[S2-GigabitEthernet1/0/3] quit
```
```
<S3> system-view
[S3] interface GigabitEthernet 1/0/2
[S3-GigabitEthernet1/0/2] port link-type trunk
[S3-GigabitEthernet1/0/2] port trunk allow-pass vlan 10
[S3-GigabitEthernet1/0/2] quit
```
```
<S3> interface GigabitEthernet 1/0/3
[S3-GigabitEthernet1/0/3] port link-type trunk
[S3-GigabitEthernet1/0/3] port trunk allow-pass vlan 10
[S3-GigabitEthernet1/0/3] quit
```
这样,三个交换机之间的链路就配置好了,两台主机也都分配到了同一个VLAN中,它们之间就可以互相通信了。
阅读全文