Manually adding a new bridge
Contents
Overview
The following page describes the steps to manually add a new bridge (vmbrX
) to an existing stoney cloud installation.
Prerequisites
To be able to add and configure a new bridge, you need to have the following informations present:
- VLAN ID, such as
141
- IP prefix, such as
192.0.2.0/24
- Default gateway address (if any), such as
192.0.2.1
- IP address for the DHCP server on the VM node, such as
192.0.2.13
- Broadcast address, such as
192.0.2.255
Make sure, that you have configured your additional VLAN on all the involved switches and routers beforehand.
Configuration
Add the new VLAN on top of the bonding interface
Login to the first VM node and manually add the new VLAN to the existing bonding interface (bond0
). In the following example VLAN 141
is added:
ip link add link bond0 name vlan141 type vlan id 141 ip link set vlan141 up ip link show vlan141
71: vlan141@bond0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
In order to bring the newly configured VLAN up after a system reboot, the network configuration needs to be extended. Edit /etc/conf.d/net
and add the following entry:
$EDITOR /etc/conf.d/net
# [...] #----------------------------------------------------------------------------- # VLAN (802.1q support) vlans_bond0="130 120 110 140 141" # pub VLAN vlan140_name="vlan140" config_vlan140="null" # pub2 VLAN vlan141_name="vlan141" config_vlan141="null" # [...]
Create a new bridging device
As the new VLAN interface is now up, an additional bridge can be added.
Again the network configuration needs to be edited. Append the configuration of the new bridge, below the existing vmbr0
bridge configuration. In the following example the bridge vmbr4
is added on top of VLAN 141
with a prefix of 192.0.2.13/24
:
$EDITOR /etc/conf.d/net
# [...] #----------------------------------------------------------------------------- # Bridging (802.1d) interfaces bridge_vmbr0="vlanXXX" bridge_add_vlanXXX="vmbr0" config_vmbr0="XXX.XXX.XXX.XXX/XX brd XXX.XXX.XXX.XXX" routes_vmbr0="default via XXX.XXX.XXX.XXX" bridge_vmbr4="vlan141" bridge_add_vlan141="vmbr4" config_vmbr4="192.0.2.13/24 brd 192.0.2.255"
Or if you would like to copy&paste:
vlanId=141 bridgeName=vmbr4 nodeIp=192.0.2.13 prefixLength=24 broadcast=192.0.2.255 cat << EOF >> /etc/conf.d/net bridge_${bridgeName}="vlan${vlanId}" bridge_add_${vlanId}="${bridgeName}" config_${bridgeName}="${nodeIp}/${prefixLength} brd ${broadcast}" EOF
To bring the bridge up, an init script is required. Simply symlink the net.lo
script to the new bridge name's script, here net.vmbr4
is assumed:
ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4 rc-update add net.vmbr4 default /etc/init.d/net.vmbr4 start