Last active
May 18, 2016 15:59
-
-
Save archerslaw/65a41c942708ec529387 to your computer and use it in GitHub Desktop.
use the bridge-utils tool to setup bridge network for KVM.
This file contains 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
1.install the bridge-utils tool. | |
# yum install bridge-utils | |
2.check the brctl man help. | |
# brctl --help | |
Usage: brctl [commands] | |
commands: | |
addbr <bridge> add bridge | |
delbr <bridge> delete bridge | |
addif <bridge> <device> add interface to bridge | |
delif <bridge> <device> delete interface from bridge | |
show [ <bridge> ] show a list of bridges | |
showmacs <bridge> show a list of mac addrs | |
showstp <bridge> show bridge stp info | |
stp <bridge> {on|off} turn stp on/off | |
3.create a bridge and add the eth0 interface to the bridge. | |
# brctl addbr switch | |
# brctl addif switch eth0 | |
4.clear the eth0 ip addr and specify the ip addr for bridge. | |
# ifconfig eth0 0.0.0.0 | |
# ifconfig switch 10.66.106.12 netmask 255.255.255.0 | |
5.setup guest network up/down script. | |
# cat /etc/qemu-ifup | |
#!/bin/sh | |
switch=switch | |
/sbin/ifconfig $1 0.0.0.0 up | |
/usr/sbin/brctl addif ${switch} $1 | |
6.show a list of bridges and the tap0 is the bridge port which is connected by the VM. | |
# brctl show switch | |
bridge name bridge id STP enabled interfaces | |
switch 8000.a0d3c1fbb474 no eth0 | |
tap0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment