先决条件 – 网络设备
交换机是在本地网络中发送数据包的设备。与集线器相比有什么优势?集线器用数据包淹没网络,只有目标系统接收该数据包,而其他系统只是丢弃,因此流量增加了很多。为了解决这个问题,开关出现了。交换机首先通过像集线器一样泛洪网络以填充 MAC 地址表来了解特定设备连接在哪个端口上。学习后,它仅将数据包发送到该特定主机。
第 2 层交换机在 OSI 模型的第 2 层(即数据链路层)上工作,并使用存储与该端口关联的设备的 MAC 地址的 MAC 地址表将“帧”发送到目标端口。第 3 层交换机工作在 OSI 模型的第 3 层,即网络层,它使用 IP 地址路由数据包,广泛用于 VLAN。
Layer 2 Switch | Layer 3 Swicth |
---|---|
Operate on layer 2 (Data link) of OSI model. | Operate on layer 3 (Network Layer) of OSI model. |
Send “frames” to destination on the basis of MAC address. | Route Packet with help of IP address |
Work with MAC address only | Can perform functioning of both 2 layer and 3 layer switch |
Used to reduce traffic on local network. | Mostly Used to implement VLAN (Virtual Local area network) |
Quite fast as they do not look at the Layer 3 portion of the data packets. | Takes time to examine data packets before sending them to their destination |
It has single broadcast domain | It has multiple broadcast domain. |
Can communicate within a network only. | Can communicate within or outside network. |