HOW TO qemu guest in the same host network (bridge mode)

Share your own howto's etc. Not for support questions!

HOW TO qemu guest in the same host network (bridge mode)

Postby networker_ » 2015-10-16 21:33

Hi

It was hard to me figure out this so I want to share briefly how I managed this after read a lot of confusing (to me) documentation.

Let's assume:
- physical host behind a router with eth0
- qemu VM already created

and you want the VM be in the same network than host as if another physical machine.

[HOST]

ifconfig eth0 0.0.0.0
brctl addbr br0
brctl addif br0 eth0

****if you have dhcp: *******
dhclient br0

**** or if you want static IP *******

in interfaces change eth0 by br0
auto br0
iface br0 inet static
address 172.30.50.90/24
dns-nameservers 172.30.50.1
gateway 172.30.50.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0

restart networking service

br0 must be allowed in /etc/qemu/bridge.conf
echo "allow br0" >> bridge.conf

# ls -l /etc/qemu/bridge.conf
-rw-r----- 1 root qemu 10 oct 16 17:49 /etc/qemu/bridge.conf

start vm
# qemu-system-x86_64 -m 256 myVM.raw -net nic -net bridge,br=br0

[GUEST]

edit /etc/network/interfaces with regular static conf
edit resolv.conf if necessary
restart networking service


##########

Cheers
networker_
 
Posts: 12
Joined: 2011-07-03 23:25

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable