Bridging

From openSUSE

Contents

Introduction to Bridge Networking with OpenSuSE 10.3

This information may be applicable to other versions of OpenSuSE as well, but is focused upon OpenSuSE 10.3 because at the time of writing it is the latest version.

What you need to get started

You will need to make sure that bridge-utils are installed. To do this, go to YaST -> Update Software and search for this package.

Simple model of a Bridge

When you bridge an Ethernet device, you create an informational link that is somewhat like a physical Ethernet cable, in that it directs the information to another "place." If a bridge is added to an Ethernet device, that device can no longer be used in the same way it was before... it is "plugged into" the bridge now. For example, when using virtualization environments such as Xen or VirtualBox, bridged ethernet cards will not be usable by the main system any longer. If you are interested in running Xen or VirtualBox with a bridged connection, consider adding another ethernet device to your system for use by the virtual machine so that you can continue to use your host system online.

Setting up a Bridge in OpenSuSE 10.3

The overview of OpenSuSE networking is covered fairly well by the SuSE Linux Enterprise Edition documentation (SLED):

It is not recommended to manually configure the interface, since NetworkManager is the "official" way to configure network cards, etc. However, this may prove difficult/impossible to do bridging. Also, mixing commands such as brctl, ifconfig, ifup, ifdown, etc., can interfere with NetworkManager operation (not always in a bad way) but will often be disregarded upon reboot. The following sections of this article will show how to make configuration changes after configuring the YaST Network Settings dialog.

YaST Network Settings Configuration

When you have a system working with NetworkManager, you can surf the www, check email, etc. However, to get bridging up and running, you should change from NetworkManager to "Traditional method with ifup." This is found in YaST -> Network Card which opens up the Network Settings dialog. Then use Global Options -> Network Setup Method to select "Traditional method with ifup" from the options. If the rest of your attempts fail and you just want to restore basic network functionality, you can always go back to using NetworkManager and things will probably work they way they did before.

Simple Manual Configuration

As mentioned in the SLED documentation, manual configuration is not recommended for configuration, probably because inexperienced users will have problems: [1]

The way the network setup is configured uses the scripts and files found in

/etc/sysconfig/network

When the system boots, initialization is performed through the initialization daemons. Networking is initialized through

/etc/rc.d/network

or

/etc/init.d/network

So, at any time, as configuration is altered, you can use these commands to re-read any configuration files that are changed to change the network configuration:

/etc/rc.d/network stop
/etc/rc.d/network start
/etc/rc.d/network restart

It can be very confusing to a user to have NetworkManager, if commands (i.e. ifup, ifdown, ifconfig, etc.) be changing the network setup, then reboot and have everything broken again. Therefore, this article recommends that when configuration files are changed, that /etc/rc.d/network restart be used to test the changes.

As mentioned in the SLED documentation, the network initialization scripts read specific files and start during different times in the booting process. It is not necessary to completely understand this process to configure the network. For bridging, the files that are relevant are found in the directory

/etc/sysconfig/network/

Likely, there is already a file ifcfg-eth0 which contains the information for configuring your main Ethernet card (network settings, dhcp, etc). Use the file ifcfg.template as the template for any manual generating of new configuration files.

OpenSuSE Firewall Issues

OpenSuSE firewall can interfere with bridging. To solve this, edit:

/etc/sysconfig/SuSEfirewall2

by adding a line to the end (where "br0" if the identifier of the bridge device)

FW_FORWARD_ALWAYS_INOUT_DEV="br0"

You may also just disable the firewall through YaST -> Firewall

Configuration Files

  • Note: To make changes to the network configuration, you must either be superuser through su or use the sudo command before each command.
  • Note: The names of configuration files need to follow the ifcfg-[deviceIdent] pattern. So, ifcfg.eth0 is not the same as ifcfg-eth0.
  • Note: Some text editors like gedit may be used to edit the files, but sometimes they write a temp file as a backup. For example, if gedit ifcfg-eth0 is used, a temp file is created as ifcfg-eth0~ and this will also be interpreted by the network initialization script as a device. Be sure to remove these temp files.

To create the bridge file As root, go to

/etc/sysconfig/network
cp ifcfg.template ifcfg-br0

Using KWrite, gedit, vi, or with another editer

vi ifcfg-br0 

Once you have the configuration file complete use

/etc/rc.d/network restart

Check the new configuration of the network devices

ifconfig -a

Using this method of changing network settings will allow for the system to do the same on boot.

Sample of a Bridge Config File

# bridge (br2) configuration

IPADDR=192.168.2.1
NETMASK=255.255.255.0
NETWORK=
BROADCAST=
STARTMODE=auto
USERCONTROL=no
BRIDGE='yes'
BRIDGE_PORTS='eth1 ath1'
BRIDGE_AGEINGTIME='300'
BRIDGE_FORWARDDELAY='0'
BRIDGE_HELLOTIME='2'
BRIDGE_MAXAGE='20'
BRIDGE_PATHCOSTS='19'
BRIDGE_PORTPRIORITIES=
BRIDGE_PRIORITY=
BRIDGE_STP='on'

Sciencedada 17:22, 27 December 2007 (UTC)