LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   QEMU KVM bridged networking? (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/qemu-kvm-bridged-networking-943180/)

iwanttolickazunyan 05-03-2012 09:01 PM

QEMU KVM bridged networking?
 
Host is Debian 6.0.4 Kernel 3.3.4
QEMU-KVM 1.0.1

I'm trying to make a network bridge for the guest so it can be directly accessed by everything else in LAN, I think I did everything alright but I just cant make the guest get a static IP.
Guest is Windows 2008 R2 Server.
Host have multiple NICs, eth0 that is connected to the network directly and eth1 that is part of bridge br0.

What I want :
Getting guest a static IP.

Guest network will not work if :
- br0 static, guest static at same IP/netmask/subnet/etc.
- br0 static, guest static at different IP with same netmask/subnet/etc
- br0 DHCP, guest static
- br0 DHCP or static, guest getting static IP from DHCP server

Guest network working with :
- br0 DHCP or static, guest DHCP

Below is a picture for br0 DHCP, guest DHCP configuration (working)
http://www.dropmocks.com/mBik49
Below is what I had when host was a Windows 2008 server and what I am aiming to have with current configuration.
http://www.dropmocks.com/mBidFd


I assume I have to do someting with iptables? If yes then how.
Any help would be appreciated.

/etc/network/interfaces for bridge is as follow
eth1 at manual

iface br0 inet dhcp
pre-up ip tuntap add dev tap0 mode tap user root
pre-up ip link set tap0 up
bridge_ports eth1 tap0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
post-down ip link set tap0 down
post-down ip tuntap del dev tap0 mode tap


Guest is running with
-net nic,model=virtio,vlan=1,macaddr=[some random mac]
-net tap,vlan=1,ifname=tap0 plus both the noscript thingy i can't exactly remember so it wont execute qemu-ifup/down script

dyasny 05-04-2012 01:24 AM

does the NIC br0 is built on have an IP?

and no, you cannot have the same IP on the host and the guest

iwanttolickazunyan 05-04-2012 01:39 AM

eth1 have no IP

I just want the Windows 2008 VM to have static IP that can be accessed by other machines on the network. So anything is fine as long as I can get it to use a static IP.
BTW host have multiple NICs, one is eth0 which gets IP normally and one is eth1 that is used in bridge br0.

dyasny 05-04-2012 03:47 AM

eth1 connected to the same network as eth0?

The windows VM should have it's own IP, in the same subnet as everything else, consider the bridge a virtual switch, one cable of which is eth1, and the other is the VMs attached to the bridge

iwanttolickazunyan 05-04-2012 04:12 AM

I have only one network. br0(which have eth1 in it) is connected to the same network as eth0.

Basically my network is 192.168.20.x
eth0 which is not bridged to anything is getting 192.168.20.150
eth1 have no IP
br0 have 192.168.20.171
and the VM have 192.168.20.186 (when using DHCP)

Other computers in the network can ping .150, .171 and .186 fine

I want the VM to have a static IP of 192.168.20.200

dyasny 05-04-2012 04:26 AM

then change the vm's ip in windows

iwanttolickazunyan 05-04-2012 04:28 AM

I did that but it just make networking in windows stopped working completely.

Changing IP in VM with this
http://www.dropmocks.com/mBi0eL
results in broken networking for the VM and getting 169.254.x.x IP

dyasny 05-04-2012 11:13 AM

sounds like you have a problem in the guest os

iwanttolickazunyan 05-04-2012 11:21 AM

The VMs are migrated from Hyper-V.
I'll try doing fresh installs and post results.


All times are GMT -5. The time now is 04:49 AM.