Skip to content

Instantly share code, notes, and snippets.

@GuoJing
Created June 10, 2014 15:24
Show Gist options
  • Save GuoJing/0ff59e34025abde96097 to your computer and use it in GitHub Desktop.
Save GuoJing/0ff59e34025abde96097 to your computer and use it in GitHub Desktop.
br.sh
#!/bin/bash
set -e
device=$1
vlanid=$2
interface=vlan$vlanid
bridge="docker0"
modprobe 8021q
vconfig set_name_type VLAN_PLUS_VID_NO_PAD
vconfig add $device $vlanid
ifconfig $interface up
brctl addbr $bridge
brctl setfd $bridge 0
brctl stp $bridge off
brctl addif $bridge $interface
ifconfig $bridge up
trap - EXIT
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment