Skip to content

Instantly share code, notes, and snippets.

@ngsw
Created May 14, 2012 18:40
Show Gist options
  • Select an option

  • Save ngsw/2695581 to your computer and use it in GitHub Desktop.

Select an option

Save ngsw/2695581 to your computer and use it in GitHub Desktop.
KVM_Setup_Bridge_br0
#! /bin/sh
# :Scientific Linux 6 - KVM - インストール : Server World http://www.server-world.info/query?os=Scientific_Linux_6&p=kvm&f=1
cp -a /etc/sysconfig/network-scripts/ifcfg-{eth0,br0}
echo 'DEVICE=eth0' > /etc/sysconfig/network-scripts/ifcfg-eth0
grep HWADDR /etc/sysconfig/network-scripts/ifcfg-br0 >> /etc/sysconfig/network-scripts/ifcfg-eth0
cat >> /etc/sysconfig/network-scripts/ifcfg-eth0 <<'KVMeth0'
ONBOOT=yes
TYPE=Ethernet
BRIDGE=br0
KVMeth0
cp -a /etc/sysconfig/network-scripts/ifcfg-br0 /tmp/br0.org
cat > /etc/sysconfig/network-scripts/ifcfg-br0 <<'KVMbr0'
DEVICE=br0
BOOTPROTO=static
IPV6INIT=no
IPV6_AUTOCONF=yes
NM_CONTROLLED=no
ONBOOT=yes
TYPE=Bridge
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
KVMbr0
for i in BROADCAST DNS1 GATEWAY IPADDR NETMASK
do
grep ${i} /tmp/br0.org >> /etc/sysconfig/network-scripts/ifcfg-br0
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment