11.2.6. Network Bridge
ifcfg-brN, replacing N with the number for the interface, such as
DEVICEdirective is given an interface name as its argument in the format
brN, where N is replaced with the number of the interface.
TYPEdirective is given an argument
Bridge. This directive determines the device type and the argument is case sensitive.
- The bridge interface configuration file now has the
IPaddress and the physical interface has only a MAC address.
- An extra directive,
DELAY=0, is added to prevent the bridge from waiting while it monitors traffic, learns where hosts are located, and builds a table of MAC addresses on which to base its filtering decisions. The default delay of 15 seconds is not needed if no routing loops are possible.
NM_CONTROLLED=noshould be added to the Ethernet interface to prevent NetworkManager from altering the file. It can also be added to the bridge configuration file in case future versions of NetworkManager support bridge configuration.
Example 11.4. Sample ifcfg-br0 interface configuration file
DEVICE=br0 TYPE=Bridge IPADDR=192.168.1.1 NETMASK=255.255.255.0 ONBOOT=yes BOOTPROTO=none NM_CONTROLLED=no DELAY=0
/etc/sysconfig/network-scripts/ifcfg-ethX, where X is a unique number corresponding to a specific interface, as follows:
Example 11.5. Sample ifcfg-ethX interface configuration file
DEVICE=ethX TYPE=Ethernet HWADDR=AA:BB:CC:DD:EE:FF BOOTPROTO=none ONBOOT=yes NM_CONTROLLED=no BRIDGE=br0
DEVICEdirective, almost any interface name could be used as it does not determine the device type. Other commonly used names include
TYPE=Ethernetis not strictly required. If the
TYPEdirective is not set, the device is treated as an Ethernet device (unless its name explicitly matches a different interface configuration file.)
service network restart
184.108.40.206. Network Bridge with Bond
DEVICE=ethX TYPE=Ethernet USERCTL=no SLAVE=yes MASTER=bond0 BOOTPROTO=none HWADDR=AA:BB:CC:DD:EE:FF NM_CONTROLLED=no
ethXas the interface name is common practice but almost any name could be used. Names such as
bondare commonly used.
/etc/sysconfig/network-scripts/ifcfg-bond0, as follows:
DEVICE=bond0 ONBOOT=yes BONDING_OPTS='mode=1 miimon=100' BRIDGE=br0 NM_CONTROLLED=noFor further instructions and advice on configuring the bonding module and to view the list of bonding parameters, see Section 31.8.1, “Using Channel Bonding”.
/etc/sysconfig/network-scripts/ifcfg-br0, as follows:
DEVICE=br0 ONBOOT=yes TYPE=Bridge IPADDR=192.168.1.1 NETMASK=255.255.255.0 NM_CONTROLLED=no
Figure 11.1. A network bridge consisting of two bonded Ethernet interfaces.
MASTER=bond0directive. These point to the configuration file named
/etc/sysconfig/network-scripts/ifcfg-bond0, which contains the
ifcfg-bond0in turn points to the
/etc/sysconfig/network-scripts/ifcfg-br0configuration file, which contains the
IPaddress, and acts as an interface to the virtual networks inside the host.
rootin the following format:
service network restart