Page 1 of 1

KVM Question: How devices on network access virtual machine?

Posted: May 30th, 2013, 6:47 pm
by doug
Hi,

Thanks for the guides! They helped me get a media server running and I know very little about linux. One of the guides mentions setting up a few KVMs for a live server and testing server. I've set up a virtual machine and network bridge and my virtual machine has internet access, but I'm not sure how I can access it from my LAN or how other devices on my LAN can access it.

My main server is on 192.168.0.100 (br0). I use DHCP on my LAN and reserve IP addresses on my router. The IP address set up for my virtual machine is 192.168.122.1. Should my virtual machine also be addressed like 192.168.0.xxx? If so, I can't figure out how to do it. I've tried changing it from within the Virtual Machine Manager (Edit->Connection Details->Virtual Network->Add Network) but that didn't work for me.

Thanks for any help,
Doug

Re: KVM Question: How devices on network access virtual mach

Posted: May 30th, 2013, 11:10 pm
by Ian
Hi Doug and welcome to the forums :thumbup:

Yeah, your guest should be in the range 192.168.0.xxx and it should be accessible on your network just like your host machine. It has somehow ended up on a different subnet which is not the intended result.

From your virtual machine can you issue the following command and send me the output please:

Code: Select all

sudo cat /etc/network/interfaces
Thanks,

Ian.

Re: KVM Question: How devices on network access virtual mach

Posted: May 31st, 2013, 7:50 pm
by doug
Hi, Ian.

Here is what I get:

Code: Select all

sudo cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp
(edit: initially provided the output from the host; now it's from the guest)

Re: KVM Question: How devices on network access virtual mach

Posted: June 10th, 2013, 1:48 am
by ricksebak
I don't personally use KVM, but I know how to answer this question if you were using VirtualBox. I suspect that the solution in KVM will be similar to what it is in VirtualBox, but YMMV.

So in VirtualBox, you need to enable Bridge Networking for the guest VM. This causes the rest of your LAN to view the VM no differently than if it was a physical machine, and it will request an IP from your DHCP server (your router) the same way any other machine would. You might want to see if KVM has some option for Bridge Networking.

Re: KVM Question: How devices on network access virtual mach

Posted: June 11th, 2013, 2:01 am
by doug
Thanks for your reply....

I used this guide and created a network bridge. But I just can't get it working. I've now deleted my guest and will try again from scratch...later.

Re: KVM Question: How devices on network access virtual mach

Posted: August 16th, 2013, 5:19 pm
by Fulhair
I've got exactly the same issue where the IP address of the VM isn't in the IP normal range listed on my router, and I can't reach it from any other machines.
On DHCP, my host is at 192.168.0.14 but the VM shows up 192.168.122.14 when I query it via the virtual machine manager. I've tried following the guide and also making it a static IP but that just make the host unreachable.
Any ideas?

Update: I've got the static IP to work but the server can't use DNS look ups :!: . Been googling :crazy: and there doesn't seem to be an easy remedy for that. And even with the static ip, the VM still show with different ip range. I.e. 192.168.122.xx