Network bridge

= Setting up a network bridge =

Installation
To check if the tools are already installed for configuring and modifying a bridge, use the portage preview command...


 * 1) emerge -pv net-misc/bridge-utils

These are the packages that would be merged, in order:

Calculating dependencies... done! [ebuild N    ] net-misc/bridge-utils-1.4  32 kB

Total: 1 package (1 new), Size of downloads: 32 kB

If you see this, the tools are not installed yet. Go ahead and install with...

Host Configuration
First, we need to add the bridge device to the /etc/conf.d/net file. As an example, bridge configuration with DHCP:

More documentation can be found in /usr/share/doc/openrc-0.9.9.3/net.example.

Next, create the init script and start the interface as follows:

Finally, to make sure the bridge is automatically set up on subsequent boots, run:

To grant the guest access to the internet, you will need to use iptables. If it's not installed, first emerge it.

Allow ip forwarding in your or with the following command:

Add the iptables rules to grand masqueraded access to the internet. For example (substitute 'eth0' with your external facing physical interface):

This is equivalent to: EXTIF=eth0 # external facing physical interface IP=`ifconfig $EXTIF|grep 'inet addr'|cut -d ':' -f2|cut -d ' ' -f1` iptables -t nat -A POSTROUTING -o $EXTIF -j SNAT --to-source $IP

Save the configuration and ensure it is restored at boot: