32 华三vlan案例+STP
1 开启STP
显示根桥信息
查看stp中的接口角色
查看设备的根桥ID 最小的值是根网桥
原则一 网络初始化时,网络中所有的STP设备都认为自己是“根桥”,根桥ID为自身的设备ID。通过交换BPDU,设备之间比较根桥ID,网络中根桥ID最小的设备被选为根桥。
SW4 优先机 改为0
2 在同一网段PC机可以互通 ping 172.168.12.254/24 测试结果
[H3C]ping 172.168.12.1
Ping 172.168.12.1 (172.168.12.1): 56 data bytes, press CTRL_C to break
56 bytes from 172.168.12.1: icmp_seq=0 ttl=255 time=0.000 ms
56 bytes from 172.168.12.1: icmp_seq=1 ttl=255 time=0.000 ms
56 bytes from 172.168.12.1: icmp_seq=2 ttl=255 time=0.000 ms
56 bytes from 172.168.12.1: icmp_seq=3 ttl=255 time=0.000 ms
56 bytes from 172.168.12.1: icmp_seq=4 ttl=255 time=0.000 ms
--- Ping statistics for 172.168.12.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.000/0.000/0.000/0.000 ms
[H3C]%Jul 10 13:03:43:815 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.12.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 0.000/0.000/0.000/0.000 ms.
[H3C]ping 172.168.12.2
Ping 172.168.12.2 (172.168.12.2): 56 data bytes, press CTRL_C to break
56 bytes from 172.168.12.2: icmp_seq=0 ttl=255 time=3.000 ms
56 bytes from 172.168.12.2: icmp_seq=1 ttl=255 time=1.000 ms
56 bytes from 172.168.12.2: icmp_seq=2 ttl=255 time=2.000 ms
56 bytes from 172.168.12.2: icmp_seq=3 ttl=255 time=1.000 ms
56 bytes from 172.168.12.2: icmp_seq=4 ttl=255 time=1.000 ms
--- Ping statistics for 172.168.12.2 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.000/1.600/3.000/0.800 ms
[H3C]%Jul 10 13:03:48:731 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.12.2: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.000/1.600/3.000/0.800 ms.
[H3C]ping 172.168.12.3
Ping 172.168.12.3 (172.168.12.3): 56 data bytes, press CTRL_C to break
56 bytes from 172.168.12.3: icmp_seq=0 ttl=255 time=5.000 ms
56 bytes from 172.168.12.3: icmp_seq=1 ttl=255 time=2.000 ms
56 bytes from 172.168.12.3: icmp_seq=2 ttl=255 time=1.000 ms
56 bytes from 172.168.12.3: icmp_seq=3 ttl=255 time=1.000 ms
56 bytes from 172.168.12.3: icmp_seq=4 ttl=255 time=1.000 ms
--- Ping statistics for 172.168.12.3 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.000/2.000/5.000/1.549 ms
[H3C]%Jul 10 13:03:52:366 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.12.3: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.000/2.000/5.000/1.549 ms.
[H3C]ping 172.168.12.4
Ping 172.168.12.4 (172.168.12.4): 56 data bytes, press CTRL_C to break
56 bytes from 172.168.12.4: icmp_seq=0 ttl=255 time=6.000 ms
56 bytes from 172.168.12.4: icmp_seq=1 ttl=255 time=2.000 ms
56 bytes from 172.168.12.4: icmp_seq=2 ttl=255 time=1.000 ms
56 bytes from 172.168.12.4: icmp_seq=3 ttl=255 time=1.000 ms
56 bytes from 172.168.12.4: icmp_seq=4 ttl=255 time=2.000 ms
--- Ping statistics for 172.168.12.4 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.000/2.400/6.000/1.855 ms
[H3C]%Jul 10 13:03:55:857 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.12.4: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.000/2.400/6.000/1.855 ms.
[H3C]ping 172.168.12.5
Ping 172.168.12.5 (172.168.12.5): 56 data bytes, press CTRL_C to break
56 bytes from 172.168.12.5: icmp_seq=0 ttl=255 time=6.000 ms
56 bytes from 172.168.12.5: icmp_seq=1 ttl=255 time=2.000 ms
56 bytes from 172.168.12.5: icmp_seq=2 ttl=255 time=2.000 ms
56 bytes from 172.168.12.5: icmp_seq=3 ttl=255 time=2.000 ms
56 bytes from 172.168.12.5: icmp_seq=4 ttl=255 time=2.000 ms
--- Ping statistics for 172.168.12.5 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 2.000/2.800/6.000/1.600 ms
[H3C]%Jul 10 13:03:59:474 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.12.5: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 2.000/2.800/6.000/1.600 ms.
[H3C]ping 172.168.12.6
Ping 172.168.12.6 (172.168.12.6): 56 data bytes, press CTRL_C to break
56 bytes from 172.168.12.6: icmp_seq=0 ttl=255 time=4.000 ms
56 bytes from 172.168.12.6: icmp_seq=1 ttl=255 time=1.000 ms
56 bytes from 172.168.12.6: icmp_seq=2 ttl=255 time=2.000 ms
56 bytes from 172.168.12.6: icmp_seq=3 ttl=255 time=1.000 ms
56 bytes from 172.168.12.6: icmp_seq=4 ttl=255 time=1.000 ms
--- Ping statistics for 172.168.12.6 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.000/1.800/4.000/1.166 ms
[H3C]%Jul 10 13:04:02:586 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.12.6: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.000/1.800/4.000/1.166 ms.
[H3C]ping 172.168.12.7
Ping 172.168.12.7 (172.168.12.7): 56 data bytes, press CTRL_C to break
--- Ping statistics for 172.168.12.7 ---
1 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
[H3C]%Jul 10 13:04:07:976 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.12.7: 1 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss.
3 在同一网段PC机可以互通 ping 172.168.13.254/24 测试结果
问题来了 为什么能通?
这是一个显示命令,用于查看交换机SW1-B上的所有VLAN配置信息。
- VLAN ID: 1 表示该VLAN的唯一标识为1。
- VLAN type: Static 表示该VLAN是静态VLAN,由管理员手动配置的。
- Route interface: Not configured 表示该VLAN没有配置路由接口,无法进行跨VLAN通信。
- Description: VLAN 0001 表示该VLAN的描述为"VLAN 0001"。
- Name: VLAN 0001 表示该VLAN的名称也为"VLAN 0001"。
- Tagged ports: None 表示该VLAN上没有配置Trunk端口,不能传递多个VLAN的数据。
- Untagged ports: FortyGigE1/0/53 表示该VLAN上配置了一个Untagged端口,即FortyGigE1/0/53端口,该端口上的数据将属于该VLAN,不需要打上VLAN标签。
4 vlan的创建
- Redirect it to a file - 这个选项允许用户将命令的输出重定向到一个文件中,而不是在终端上显示。
- Redirect it to a file in append mode - 这个选项类似于上一个选项,但它会将输出追加到现有文件的末尾,而不是覆盖文件。
- INTEGER<1-4094> - 这是一个参数,用户可以指定一个整数(1到4094之间),来显示特定VLAN的配置信息。
- all - 显示所有VLAN的配置信息。
- brief - 显示所有VLAN的简要信息。
- dynamic - 显示动态VLAN的配置信息。
- mapping - 显示VLAN映射信息,这可能包括VLAN ID与端口之间的映射关系。
- reserved - 显示保留的VLAN配置信息。
- static - 显示静态VLAN的配置信息。
- | - 这个符号通常用于管道操作,允许用户将命令的输出作为另一个命令的输入。
删除 undo
[SW4-A]undo vlan 12 to 17
You will delete all specified static VLANs except protocol reserved VLANs and the default VLAN. Continue? [Y/N]:y
[SW4-A]dis
[SW4-A]display vl
[SW4-A]display vlan al
[SW4-A]display vlan all
VLAN ID: 1
VLAN type: Static
Route interface: Not configured
Description: VLAN 0001
Name: VLAN 0001
Tagged ports: None
Untagged ports:
FortyGigE1/0/53 FortyGigE1/0/54
GigabitEthernet1/0/1 GigabitEthernet1/0/2
GigabitEthernet1/0/3 GigabitEthernet1/0/4
GigabitEthernet1/0/5 GigabitEthernet1/0/6
GigabitEthernet1/0/7 GigabitEthernet1/0/8
GigabitEthernet1/0/9 GigabitEthernet1/0/10
GigabitEthernet1/0/11 GigabitEthernet1/0/12
GigabitEthernet1/0/13 GigabitEthernet1/0/14
GigabitEthernet1/0/15 GigabitEthernet1/0/16
GigabitEthernet1/0/17 GigabitEthernet1/0/18
GigabitEthernet1/0/19 GigabitEthernet1/0/20
GigabitEthernet1/0/21 GigabitEthernet1/0/22
GigabitEthernet1/0/23 GigabitEthernet1/0/24
GigabitEthernet1/0/25 GigabitEthernet1/0/26
GigabitEthernet1/0/27 GigabitEthernet1/0/28
GigabitEthernet1/0/29 GigabitEthernet1/0/30
GigabitEthernet1/0/31 GigabitEthernet1/0/32
GigabitEthernet1/0/33 GigabitEthernet1/0/34
GigabitEthernet1/0/35 GigabitEthernet1/0/36
GigabitEthernet1/0/37 GigabitEthernet1/0/38
GigabitEthernet1/0/39 GigabitEthernet1/0/40
GigabitEthernet1/0/41 GigabitEthernet1/0/42
GigabitEthernet1/0/43 GigabitEthernet1/0/44
GigabitEthernet1/0/45 GigabitEthernet1/0/46
GigabitEthernet1/0/47 GigabitEthernet1/0/48
Ten-GigabitEthernet1/0/49
Ten-GigabitEthernet1/0/50
Ten-GigabitEthernet1/0/51
Ten-GigabitEthernet1/0/52
[SW4-A]
5 access接口增加对应对vlan操作 1:1关系 只能通过一个vlan编号
批量处理接口 对多个接口操作
单个vlan的接口增加对应端口简写
批量增加接口的简写处理简写
<H3C>ping 172.168.13.1
Ping 172.168.13.1 (172.168.13.1): 56 data bytes, press CTRL_C to break
56 bytes from 172.168.13.1: icmp_seq=0 ttl=255 time=0.000 ms
56 bytes from 172.168.13.1: icmp_seq=1 ttl=255 time=0.000 ms
56 bytes from 172.168.13.1: icmp_seq=2 ttl=255 time=0.000 ms
56 bytes from 172.168.13.1: icmp_seq=3 ttl=255 time=0.000 ms
56 bytes from 172.168.13.1: icmp_seq=4 ttl=255 time=0.000 ms
--- Ping statistics for 172.168.13.1 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.000/0.000/0.000/0.000 ms
<H3C>%Jul 10 13:57:51:079 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.13.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 0.000/0.000/0.000/0.000 ms.
<H3C>ping 172.168.13.2
Ping 172.168.13.2 (172.168.13.2): 56 data bytes, press CTRL_C to break
56 bytes from 172.168.13.2: icmp_seq=0 ttl=255 time=1.000 ms
56 bytes from 172.168.13.2: icmp_seq=1 ttl=255 time=2.000 ms
56 bytes from 172.168.13.2: icmp_seq=2 ttl=255 time=1.000 ms
56 bytes from 172.168.13.2: icmp_seq=3 ttl=255 time=0.000 ms
56 bytes from 172.168.13.2: icmp_seq=4 ttl=255 time=1.000 ms
--- Ping statistics for 172.168.13.2 ---
5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.000/1.000/2.000/0.632 ms
<H3C>%Jul 10 13:57:56:434 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.13.2: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 0.000/1.000/2.000/0.632 ms.
ping 172.168.13.3
Ping 172.168.13.3 (172.168.13.3): 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- Ping statistics for 172.168.13.3 ---
5 packet(s) transmitted, 0 packet(s) received, 100.0% packet loss
<H3C>%Jul 10 13:58:10:245 2024 H3C PING/6/PING_STATISTICS: Ping statistics for 172.168.13.3: 5 packet(s) transmitted, 0 packet(s) received, 100.0% packet los
6 trunk 1:N的关系
trunk的接口增加配置
简写
[SW1-B]display vlan all
VLAN ID: 1
VLAN type: Static
Route interface: Not configured
Description: VLAN 0001
Name: VLAN 0001
Tagged ports: None
Untagged ports:
FortyGigE1/0/53 FortyGigE1/0/54
GigabitEthernet1/0/1 GigabitEthernet1/0/2
GigabitEthernet1/0/3 GigabitEthernet1/0/4
GigabitEthernet1/0/5 GigabitEthernet1/0/6
GigabitEthernet1/0/7 GigabitEthernet1/0/8
GigabitEthernet1/0/9 GigabitEthernet1/0/10
GigabitEthernet1/0/11 GigabitEthernet1/0/12
GigabitEthernet1/0/13 GigabitEthernet1/0/14
GigabitEthernet1/0/15 GigabitEthernet1/0/16
GigabitEthernet1/0/17 GigabitEthernet1/0/18
GigabitEthernet1/0/19 GigabitEthernet1/0/20
GigabitEthernet1/0/21 GigabitEthernet1/0/22
GigabitEthernet1/0/23 GigabitEthernet1/0/24
GigabitEthernet1/0/25 GigabitEthernet1/0/26
GigabitEthernet1/0/27 GigabitEthernet1/0/28
GigabitEthernet1/0/29 GigabitEthernet1/0/30
GigabitEthernet1/0/31 GigabitEthernet1/0/32
GigabitEthernet1/0/33 GigabitEthernet1/0/34
GigabitEthernet1/0/35 GigabitEthernet1/0/36
GigabitEthernet1/0/37 GigabitEthernet1/0/38
GigabitEthernet1/0/39 GigabitEthernet1/0/40
GigabitEthernet1/0/41 GigabitEthernet1/0/42
GigabitEthernet1/0/43 GigabitEthernet1/0/44
GigabitEthernet1/0/45 GigabitEthernet1/0/46
GigabitEthernet1/0/47 GigabitEthernet1/0/48
Ten-GigabitEthernet1/0/49
Ten-GigabitEthernet1/0/50
Ten-GigabitEthernet1/0/51
Ten-GigabitEthernet1/0/52
VLAN ID: 12
VLAN type: Static
Route interface: Not configured
Description: VLAN 0012
Name: VLAN 0012
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
VLAN ID: 13
VLAN type: Static
Route interface: Not configured
Description: VLAN 0013
Name: VLAN 0013
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
VLAN ID: 14
VLAN type: Static
Route interface: Not configured
Description: VLAN 0014
Name: VLAN 0014
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
VLAN ID: 15
VLAN type: Static
Route interface: Not configured
Description: VLAN 0015
Name: VLAN 0015
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
VLAN ID: 16
VLAN type: Static
Route interface: Not configured
Description: VLAN 0016
Name: VLAN 0016
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
VLAN ID: 17
VLAN type: Static
Route interface: Not configured
Description: VLAN 0017
Name: VLAN 0017
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
VLAN ID: 18
VLAN type: Static
Route interface: Not configured
Description: VLAN 0018
Name: VLAN 0018
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
VLAN ID: 19
VLAN type: Static
Route interface: Not configured
Description: VLAN 0019
Name: VLAN 0019
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
VLAN ID: 20
VLAN type: Static
Route interface: Not configured
Description: VLAN 0020
Name: VLAN 0020
Tagged ports:
GigabitEthernet1/0/1 GigabitEthernet1/0/5
GigabitEthernet1/0/6
Untagged ports: None
[SW1-B]