KVM Question: How devices on network access virtual machine?

Post Reply
doug
Member
Member
Posts: 3
Joined: May 30th, 2013, 4:49 am

KVM Question: How devices on network access virtual machine?

Post 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
User avatar
Ian
Moderator
Posts: 752
Joined: January 1st, 2011, 7:00 am

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

Post 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.
doug
Member
Member
Posts: 3
Joined: May 30th, 2013, 4:49 am

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

Post 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)
ricksebak
Member
Member
Posts: 33
Joined: February 10th, 2013, 9:34 pm

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

Post 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.
doug
Member
Member
Posts: 3
Joined: May 30th, 2013, 4:49 am

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

Post 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.
Fulhair
Member
Member
Posts: 1
Joined: August 16th, 2013, 5:13 pm

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

Post 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
Post Reply