Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved]Bridging not working across qemu guests.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Fri May 08, 2015 8:00 am    Post subject: [solved]Bridging not working across qemu guests. Reply with quote

This is what I'm doing --

Code:
modprobe tun;ip tuntap add mode tap veth;ip a add fc00::1001/124 dev veth;ip link set dev veth up

qemu-system-x86_64 -machine accel=kvm,kernel_irqchip=on,mem-merge=on -drive file=centos7.qcow,id=centos,if=ide,media=disk,cache=unsafe,aio=native,index=0 -vnc :2 -no-acpi -device e1000,id=ethnet,vlan=0 -net tap,ifname=veth,script=no,downscript=no,vlan=0 -m 512

modprobe tun;ip tuntap add mode tap veth0;ip a add fc00::1003/124 dev veth0;ip link set dev veth0 up

qemu-system-x86_64 -machine accel=kvm,kernel_irqchip=on,mem-merge=on -drive file=centos7_2.qcow,id=centos,if=ide,media=disk,cache=unsafe,aio=native,index=0 -vnc :2 -no-acpi -device e1000,id=ethnet,vlan=0 -net tap,ifname=veth0,script=no,downscript=no,vlan=0 -m 512
ensure to change default IP in VM2.

ip a del fc00::1003/124 dev veth0
ip a del fc00::1001/124 dev veth
ip link set dev veth down
ip link set dev veth0 down
brctl addbr br
brctl stp br off
brctl addif br veth veth0
ip link set dev veth up
ip link set dev veth0 up
ip link set promisc on dev veth0
ip link set promisc on dev veth
ip link set dev br up
ip a add fc00::1001/124 dev br


The host can connect to both the VMs, and the VMs can ping it back, BUT the VMs cannot connect to each other. They claim "destination unreachable"; that means routes are present.

I've tried with both CentOS and system rescue CD.
_________________
My blog


Last edited by dE_logics on Sat May 09, 2015 4:24 am; edited 1 time in total
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1717

PostPosted: Fri May 08, 2015 9:55 pm    Post subject: Reply with quote

I'm using stuff like this:
configure bridge during boot (a snippet from my netifrc config). You can do that manually, but I didn't want it bothering me:
Quote:
config_vn0="10.0.1.1/24"
brctl_vn0="setfd 0
sethello 10
stp off"
rc_net_vn0_provide="lan !net"


and launch each vm with a script containing this:
Quote:
add_ifaces ()
{
i=1
USER=$(whoami)
while [ ${#1} -gt 0 ]
do sudo /usr/bin/tunctl -u $USER -t "${name}-${i}" > /dev/null
sudo /sbin/brctl addif $1 "${name}-${i}" > /dev/null
sudo /bin/ifconfig "${name}-${i}" up promisc > /dev/null
params="${params} -net nic,macaddr=$( printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) ),vlan=$i -net tap,ifname=$name-$i,script=no,downscript=no,vlan=$i"
shift
i=$(($i+1))
done
echo $params
}

run it as:
name=<machine name> add_interfaces <bridge1> [brigde2] [bridge3....]
It creates interfaces, attaches them to the bridges and generates a string to be appended to qemu's command line

You can add options for virtio drivers as well. And it's not going to be any different for ipv6
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Sat May 09, 2015 3:30 am    Post subject: Reply with quote

$2 is not used anywhere.

Code:
sudo /sbin/brctl addif $1


no bridge interface named "name=<machine name>" exists.
_________________
My blog
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Sat May 09, 2015 4:24 am    Post subject: Reply with quote

The 2 VMs had the same IP address.
_________________
My blog
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum