使用 netctl 创建桥接

出自 ArchWiki

本条目或章节可能需要与网络桥接合并。

提示: 我建议将本文中关于 netctl 的部分移动到“网络桥接”的子章节中(在 Talk:Bridge with netctl 中讨论)

确保 netctl 已安装。

复制 /etc/netctl/examples/bridge/etc/netctl/bridge

在本例中,我们创建一个名为 br0 的桥接,它连接了真实的以太网适配器 eth0 和(可选的) tap 设备 tap0。当然,根据您的需要编辑 br0eth0tap0

/etc/netctl/bridge
Description="Example Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(eth0 tap0)
IP=dhcp

此示例创建一个名为 br0 的静态分配桥接,它连接了真实的以太网适配器 eth0。根据您的需要编辑 InterfaceBindsToInterfacesMACAddressAddressGateway

 /etc/netctl/bridge
Description="Example Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(eth0)
MACAddress='12:34:56:78:90'
IP=static
Address='192.168.10.20/24'
Gateway='192.168.10.200'
## Ignore (R)STP and immediately activate the bridge
SkipForwardingDelay=yes
提示: 如果您使用静态 IP,请参阅 netctl(1),并在必要时编辑 /etc/resolv.conf

您可以通过编辑 BindsToInterfaces 选项来桥接任何网络设备的组合。

如果任何桥接设备(例如 eth0tap0)启用了 dhcpcd,请停止并禁用 dhcpcd@eth0.service 守护进程。或者在 netctl 配置文件中设置 IP=no

最后,启动并启用您的 /etc/netctl/bridge