# 交换机

交换机是最重要的信息交换网络设备，主要功能包括

* 学习设备MAC地址
* 二层转发
* 三层转发
* ACL
* QoS
* 消除回路

随着SDN和NFV的发展，现在已经有越来越多的功能都放到了虚拟交换机上来。最常见的虚拟交换机是[Open vSwitch](broken://pages/-LDZS1UK1O1Uh1-OProR)。

## 三层交换机与路由器

三层交换机也支持三层转发（即路由），解决了路由器带宽和性能受限的问题：交换机通过交换芯片转发数据，而路由器则是通过CPU转发的。那么它与路由器相比有什么不同呢

* 三层交换机同时支持二层和三层转发，而路由器则仅支持三层转发
* 交换机针对以太网研发，对其他网络类型支持较少；而路由器则支持较多的网络类型，更适合用在网络复杂的场景下

## 白牌交换机

随着SDN的兴起，白牌交换机（WhiteBox Switch）逐渐兴起。白牌交换机是指不贴标签的交换机，并且像PC一样，硬件和软件分离。用户从厂商拿到硬件后，可以安装自定义的软件（如OpenSwitch、OPX、Sonic等）。比如，用户可以选择

* 硬件使用Broadcom、Cavium、盛科等
* 而软件使用Cumulus、BigSwitch、Pica8、Snaproute、OPX、OpenSwitch等

白牌交换机的优势

* 成本低，白牌交换机的总体成本低于品牌设备
* 更大的灵活性，软件可以自定义，方便针对特定需求和场景做定制开发
* 避免厂商绑定

当然了，并不是所有的软件都适用于所有的硬件，这还有待软硬件厂商进一步协作提升开放性。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sdn.feisky.xyz/wang-luo-ji-chu/index/switch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
