交换机广播域:所有接口都在一个广播域中。
虚拟局域网:vlan
好处/功能: 1.划分广播域
2.管理方便
3.安全
ethernet 10M
fastethernet 100M
Gethernet 1000M
交换机根据连接对象不同,接口模式:1.access 接入模式 电脑 一个接口只能划分进一个vlan
2.trunk 主干链路模式 交换机 默认只允许vlan1通过,其他vlan流量需要手动放行
3.hybrid 混合模式 电脑或交换机
SW1
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]user-interface console 0
[SW1-ui-console0]idle-timeout 0 0
[SW1-ui-console0]quit
[SW1]vlan bat 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]interface Ethernet0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 2
[SW1-Ethernet0/0/1]quit
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 3
[SW1-Ethernet0/0/2]quit
PC1
PC>ping 192.168.1.20
Ping 192.168.1.20: 32 data bytes, Press Ctrl_C to break
From 192.168.1.10: Destination host unreachable
From 192.168.1.10: Destination host unreachable
From 192.168.1.10: Destination host unreachable
From 192.168.1.10: Destination host unreachable
From 192.168.1.10: Destination host unreachable
--- 192.168.1.20 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
交换机只做相同vlan之间的数据通信
路由器可以实现不同网段之间的通信
SW1
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]user-interface console 0
[SW1-ui-console0]idle-timeout 0 0
[SW1-ui-console0]quit
[SW1]vlan bat 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]interface Ethernet0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 2
[SW1-Ethernet0/0/1]quit
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 3
[SW1-Ethernet0/0/2]quit
[SW1]int e0/0/22
[SW1-Ethernet0/0/22]port link-type trunk
[SW1-Ethernet0/0/22]port trunk allow-pass vlan all
[SW1-Ethernet0/0/22]q
SW2
The device is running!
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW2
[SW2]user-interface console 0
[SW2-ui-console0]idle-timeout 0 0
[SW2-ui-console0]quit
[SW2]vlan bat 2 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]int e0/0/1
[SW2-Ethernet0/0/1]port link-type access
[SW2-Ethernet0/0/1]port default vlan 2
[SW2-Ethernet0/0/1]int e0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 3
[SW2-Ethernet0/0/2]int e0/0/22
[SW2-Ethernet0/0/22]port link-type trunk
[SW2-Ethernet0/0/22]port trunk allow-pass vlan all
[SW2-Ethernet0/0/22]q
PC1
PC>ping 192.168.1.30
Ping 192.168.1.30: 32 data bytes, Press Ctrl_C to break
From 192.168.1.30: bytes=32 seq=1 ttl=128 time=78 ms
From 192.168.1.30: bytes=32 seq=2 ttl=128 time=79 ms
From 192.168.1.30: bytes=32 seq=3 ttl=128 time=78 ms
From 192.168.1.30: bytes=32 seq=4 ttl=128 time=109 ms
From 192.168.1.30: bytes=32 seq=5 ttl=128 time=109 ms
--- 192.168.1.30 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/90/109 ms
PC2
Welcome to use PC Simulator!
PC>ping 192.168.1.40
Ping 192.168.1.40: 32 data bytes, Press Ctrl_C to break
From 192.168.1.40: bytes=32 seq=1 ttl=128 time=78 ms
From 192.168.1.40: bytes=32 seq=2 ttl=128 time=78 ms
From 192.168.1.40: bytes=32 seq=3 ttl=128 time=78 ms
From 192.168.1.40: bytes=32 seq=4 ttl=128 time=78 ms
From 192.168.1.40: bytes=32 seq=5 ttl=128 time=78 ms
--- 192.168.1.40 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/78/78 ms