Difference between revisions of "Bridge with netctl"

From ArchWiki
Jump to: navigation, search
(Manually adding/removing network devices: Move brctl package to Installation section)
(Installation: Added bridge-utils)
Line 6: Line 6:
 
==Installation==
 
==Installation==
 
[[pacman|Install]] the {{Pkg|netctl}} package from the [[Official Repositories|official repositories]].
 
[[pacman|Install]] the {{Pkg|netctl}} package from the [[Official Repositories|official repositories]].
 +
[[pacman|Install]] the {{Pkg|bridge-utils}} package from the [[Official Repositories|official repositories]].
  
 
==Configuration==
 
==Configuration==

Revision as of 08:08, 11 June 2013

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 existance). Real devices (like eth ones) and virtual devices (like tap ones) can be connected to it.

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

Installation

Install the netctl package from the official repositories. Install the bridge-utils package from the official repositories.

Configuration

  • Copy /etc/netctl/examples/bridge to /etc/netctl/bridge.
  • Create a bridge called br0 to have, at least, your real Ethernet adapter (assuming eth0) and optionally a tap device (assuming tap0):
/etc/netctl/bridge
Description="Example Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(eth0 tap0)
IP=dhcp
## sets forward delay time
#FwdDelay=0
## sets max age of hello message
#MaxAge=10

If you are using an static ip see man pages of netctl, also edit /etc/resolv.conf as necessary.
  • You can bridge any combination of network devices editing "BindsToInterfaces" option.
  • If any of the bridged devices (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.

Tips and Tricks

Manually adding/removing network devices

The bridge-utils package provides brctl, to manipulate bridges. You can use it to add a device, like this:

# brctl addif br0 eth1

Read the manual for more info: man brctl