Difference between revisions of "Manually adding a new bridge"
[unchecked revision] | [unchecked revision] |
(→Create a new bridging device) |
(→Configuration) |
||
Line 127: | Line 127: | ||
/etc/init.d/net.${bridgeName} start | /etc/init.d/net.${bridgeName} start | ||
ip addr show ${bridgeName} && brctl show | ip addr show ${bridgeName} && brctl show | ||
+ | </source> | ||
+ | |||
+ | == Delete a bridging device == | ||
+ | Tear the bridge down but check if it would also stop all network services: | ||
+ | <source lang="bash"> | ||
+ | # Set your bridge name | ||
+ | bridgeName=<NAME OF YOUR BRIDGE> # e.g.: vmbr4 | ||
+ | |||
+ | # Check if it excludes the net services | ||
+ | grep rc_net_${bridgeName}_provide /etc/conf.d/net | ||
+ | </source> | ||
+ | If grep produces output you might consider running the initscript with the ''-D'' options (otherwise network services, like sshd, might get stopped). | ||
+ | |||
+ | Otherwise just stop the bridge and remove the initscript: | ||
+ | <source lang="bash"> | ||
+ | /etc/init.d/net.vmbr4 start | ||
+ | |||
+ | rc-update add net.vmbr4 default | ||
+ | |||
+ | ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4 | ||
+ | </source> | ||
+ | |||
+ | Remove the bridge from the network configuration: | ||
+ | <source lang="bash"> | ||
+ | $EDITOR /etc/conf.d/net | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
+ | # [...] | ||
+ | |||
+ | ### Remove the options for the bridge you want to delete | ||
+ | #bridge_vmbr4="vlan141" | ||
+ | #bridge_add_vlan141="vmbr4" | ||
+ | #config_vmbr4="192.0.2.13/24 brd 192.0.2.255" | ||
+ | #rc_net_vmbr4_provide="!net" # Otherwise stopping or restarting the bridge, will bring all net-services down. | ||
+ | |||
+ | # [...] | ||
+ | </source> | ||
+ | |||
+ | == Remove a VLAN on a bonding interface == | ||
+ | Delete the VLAN from the interface bond0: | ||
+ | <source lang="bash"> | ||
+ | # Set your vlan id | ||
+ | vlanId=<VLAN ID> # e.g. 141 | ||
+ | |||
+ | # Shut the vlan down | ||
+ | ip link set vlan${vlanId} down | ||
+ | |||
+ | # Remove it from the interface bond0 | ||
+ | ip link delete link bond0 name vlan${vlanId} type vlan id ${vlanId} | ||
+ | </source> | ||
+ | |||
+ | Edit <code>/etc/conf.d/net</code> and remove your VLAN: | ||
+ | <source lang="bash"> | ||
+ | $EDITOR /etc/conf.d/net | ||
+ | </source> | ||
+ | |||
+ | <source lang="bash"> | ||
+ | # [...] | ||
+ | |||
+ | ### Remove your vlan options | ||
+ | # pub2 VLAN | ||
+ | # vlan141_name="vlan141" | ||
+ | # config_vlan141="null" | ||
+ | |||
+ | # [...] | ||
</source> | </source> | ||
Revision as of 15:18, 12 February 2014
Contents
Overview
The following page describes the steps to manually add a new Ethernet 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 the new VLAN on all 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" ### Add your new vlan at the end of the VLAN section # 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" ### Add your new bridge at the end of the bridge section bridge_vmbr4="vlan141" bridge_add_vlan141="vmbr4" config_vmbr4="192.0.2.13/24 brd 192.0.2.255" rc_net_vmbr4_provide="!net" # Otherwise stopping or restarting the bridge, will bring all net-services down.
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
* Caching service dependencies ... [ ok ] * Bringing up interface vmbr4 * Creating bridge vmbr4 ... * Adding ports to vmbr4 * vlan141 ... [ ok ] * 192.0.2.13/24 ... [ ok ]
Check if everything looks fine:
ip addr show vmbr4 && brctl show
72: vmbr4: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP link/ether XX:XX:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff inet 192.0.2.13/24 brd 192.0.2.255 scope global vmbr4 valid_lft forever preferred_lft forever bridge name bridge id STP enabled interfaces vmbr4 8000.3860779c9840 no vlan141
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_vlan${vlanId}="${bridgeName}" config_${bridgeName}="${nodeIp}/${prefixLength} brd ${broadcast}" rc_net_${bridgeName}_provide="!net" EOF ln -s /etc/init.d/net.lo /etc/init.d/net.${bridgeName} rc-update add net.${bridgeName} default /etc/init.d/net.${bridgeName} start ip addr show ${bridgeName} && brctl show
Delete a bridging device
Tear the bridge down but check if it would also stop all network services:
# Set your bridge name bridgeName=<NAME OF YOUR BRIDGE> # e.g.: vmbr4 # Check if it excludes the net services grep rc_net_${bridgeName}_provide /etc/conf.d/net
If grep produces output you might consider running the initscript with the -D options (otherwise network services, like sshd, might get stopped).
Otherwise just stop the bridge and remove the initscript:
/etc/init.d/net.vmbr4 start rc-update add net.vmbr4 default ln -s /etc/init.d/net.lo /etc/init.d/net.vmbr4
Remove the bridge from the network configuration:
$EDITOR /etc/conf.d/net
# [...] ### Remove the options for the bridge you want to delete #bridge_vmbr4="vlan141" #bridge_add_vlan141="vmbr4" #config_vmbr4="192.0.2.13/24 brd 192.0.2.255" #rc_net_vmbr4_provide="!net" # Otherwise stopping or restarting the bridge, will bring all net-services down. # [...]
Remove a VLAN on a bonding interface
Delete the VLAN from the interface bond0:
# Set your vlan id vlanId=<VLAN ID> # e.g. 141 # Shut the vlan down ip link set vlan${vlanId} down # Remove it from the interface bond0 ip link delete link bond0 name vlan${vlanId} type vlan id ${vlanId}
Edit /etc/conf.d/net
and remove your VLAN:
$EDITOR /etc/conf.d/net
# [...] ### Remove your vlan options # pub2 VLAN # vlan141_name="vlan141" # config_vlan141="null" # [...]