Created
September 25, 2012 03:20
-
-
Save fbettag/3779800 to your computer and use it in GitHub Desktop.
Xen dom0 vif-bridge script for dynamic vlans
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dir=$(dirname "$0") | |
. "$dir/vif-common.sh" | |
netdev=${netdev:-eth1} | |
vlan=${vlan:-0} | |
vlandev=$netdev.$vlan | |
retval=$( ip link show | grep $vlandev | wc -l ) | |
if [ "$retval" == "0" ]; then | |
echo "creating $vlandev" >&2 | |
ip link add link $netdev name $vlandev type vlan id $vlan >&2 | |
ip link set dev $vlandev up >&2 | |
. "$dir/network-bridge" start "netdev=$vlandev" bridge=$vlan | |
fi | |
. "$dir/vif-bridge" "$@" "bridge=$vlan" >&2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment