Skip to content

Instantly share code, notes, and snippets.

@archerslaw
Last active December 23, 2015 02:29
Show Gist options
  • Save archerslaw/6567396 to your computer and use it in GitHub Desktop.
Save archerslaw/6567396 to your computer and use it in GitHub Desktop.
network-bridge-scripts.sh
# cat network-bridge-scripts.sh
#!/bin/bash
#ifcfg-eth0
sed -i 's/^BOOTPROTO=dhcp$/BOOTPROTO=none/g' /etc/sysconfig/network-scripts/ifcfg-eth0
echo "BRIDGE=switch">>/etc/sysconfig/network-scripts/ifcfg-eth0
#ifcfg-br0
echo "DEVICE=switch
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Bridge">>/etc/sysconfig/network-scripts/ifcfg-br0
#/etc/qemu-ifup
echo "#!/bin/sh
switch=switch
/sbin/ifconfig \$1 0.0.0.0 up
/usr/sbin/brctl addif \${switch} \$1">>/etc/qemu-ifup
chmod 777 /etc/qemu-ifup
/etc/init.d/network restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment