Difference between revisions of "Bridge with netctl"

From ArchWiki
Jump to: navigation, search
(added merge template)
(stuff moved to Network bridge)
Line 5: Line 5:
  
 
{{Merge|Network bridge|I suggest to move the netctl-specific parts of this article into a subsection of "Network bridge"}}
 
{{Merge|Network bridge|I suggest to move the netctl-specific parts of this article into a subsection of "Network bridge"}}
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. {{ic|eth0}}) and virtual devices (e.g. {{ic|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.
 
  
 
== Installation ==
 
== Installation ==
  
 
[[pacman|Install]] the {{Pkg|netctl}} package from the [[official repositories]].
 
[[pacman|Install]] the {{Pkg|netctl}} package from the [[official repositories]].
 
[[pacman|Install]] the {{Pkg|bridge-utils}} package from the [[official repositories]].
 
  
 
== Configuration ==
 
== Configuration ==
Line 33: Line 28:
 
* If any of the bridged devices (e.g. {{ic|eth0}}, {{ic|tap0}}) had [[dhcpcd]] enabled, [[systemd#Using units|stop and disable]] the {{ic|dhcpcd@eth0.service}} daemon. Or set {{ic|1=IP=no}} to the netctl profiles.
 
* If any of the bridged devices (e.g. {{ic|eth0}}, {{ic|tap0}}) had [[dhcpcd]] enabled, [[systemd#Using units|stop and disable]] the {{ic|dhcpcd@eth0.service}} daemon. Or set {{ic|1=IP=no}} to the netctl profiles.
 
* Finally, [[netctl#Just one profile|start and enable]] your {{ic|/etc/netctl/bridge}}.
 
* Finally, [[netctl#Just one profile|start and enable]] your {{ic|/etc/netctl/bridge}}.
 
== Tips and tricks ==
 
 
=== Manually adding/removing network devices ===
 
 
The {{Pkg|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 {{ic|brctl(8)}}
 
 
=== 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.
 

Revision as of 16:38, 8 July 2014

Merge-arrows-2.pngThis article or section is a candidate for merging with Network bridge.Merge-arrows-2.png

Notes: I suggest to move the netctl-specific parts of this article into a subsection of "Network bridge" (Discuss in Talk:Bridge with netctl#)

Installation

Install the netctl package from the official repositories.

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 (optionally) a tap device tap0 connected to it. Of course, edit br0, eth0 and tap0 to your needs.
/etc/netctl/bridge
Description="Example Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(eth0 tap0)
IP=dhcp
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, stop and disable the dhcpcd@eth0.service daemon. Or set IP=no to the netctl profiles.
  • Finally, start and enable your /etc/netctl/bridge.