Bridge with netctl

From ParabolaWiki
Jump to: navigation, search

A bridge is a piece of software used to unite two or more network segments. A bridge behaves like a virtual network switch, working transparently (the other machines don't need to know or care about its existence). Any real devices (e.g. eth0) and virtual devices (e.g. tap0) can be connected to it.

This article explains how to create a bridge that contains at least an ethernet device. This is useful for things like the bridge mode of QEMU, setting a software based access point, etc.

1 Installation

Install the netctl package from the official repositories.

Install the bridge-utils package from the official repositories.

2 Configuration

  • Copy /etc/netctl/examples/bridge to /etc/netctl/bridge.
  • In this example, we create a bridge called br0 which has real Ethernet adapter eth0 and a tap device tap0 connected to it. Of course, edit br0, eth0 and tap0 to your needs.
Description="Example Bridge connection"
BindsToInterfaces=(eth0 tap0)
## sets forward delay time
## sets max age of hello message
Tip: If you are using static IP, see man pages of netctl, and also edit /etc/resolv.conf if necessary.
  • You can bridge any combination of network devices editing BindsToInterfaces option.
  • If any of the bridged devices (e.g. eth0, tap0) had dhcpcd enabled, disable and stop the dhcpcd@eth0.service daemon. Or set IP=no to the netctl profiles.
  • Finally, enable and start your /etc/netctl/bridge.

3 Tips and tricks

3.1 Manually adding/removing network devices

The bridge-utils package provides tool brctl to manipulate bridges. You can use it to manually add or remove a device from a bridge:

# brctl addif br0 eth1
# brctl delif br0 eth0

See brctl(8)

3.2 Wireless interface on a bridge

To add a wireless interface to a bridge, you first have to assign the wireless interface to an access point or start an access point with hostapd. Otherwise the wireless interface won't be added to the bridge.

4 Acknowledgement

This wiki article is based on ArchWiki. We may have removed non-FSDG bits from it.