Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have follow this guide (Virtualization With KVM On Ubuntu 11.10) to setup my KVM (Virtual Machines Software) on my Ubuntu 11.10 Server. However, I didn't setup my VM's IP address when creating the VM, instead of using:

vmbuilder kvm ubuntu --suite=oneiric --flavour=virtual --arch=amd64 --mirror=http://de.archive.ubuntu.com/ubuntu -o --libvirt=qemu:///system --ip= --gw= --part=vmbuilder.partition --templates=mytemplates --user=administrator --name=Administrator --pass=howtoforge --addpkg=vim-nox --addpkg=unattended-upgrades --addpkg=acpid --firstboot=/var/lib/libvirt/images/vm1/boot.sh --mem=256 --hostname=vm1 --bridge=br0

I used: (I deleted "--ip= --gw=" from the command line)

vmbuilder kvm ubuntu --suite=oneiric --flavour=virtual --arch=amd64 --mirror=http://de.archive.ubuntu.com/ubuntu -o --libvirt=qemu:///system --part=vmbuilder.partition --templates=mytemplates --user=administrator --name=Administrator --pass=howtoforge --addpkg=vim-nox --addpkg=unattended-upgrades --addpkg=acpid --firstboot=/var/lib/libvirt/images/vm1/boot.sh --mem=256 --hostname=vm1 --bridge=br0

I have set up the network bridge as the guide instructed and the new VM's interface is connected to the network bridge.

I assume the KVM will assign my VM via DHCP but I don't have information on my new VM's IP address, where can I find the VM's IP address and SSH to the new VM? Thanks.

[Notes: I have managed to login the VM without knowing the IP address of the VM. Using "Xming + SSH with X Graphic Forwarding" But there is no DHCP ip address assigned to my VM, Besides the above question, I have another question here: How to enable the DCHP on my VM so when I use Xming to login via "virt viewer" I can at least see my IP address is there.]

share|improve this question
I have figured out the problem and solved it. In the /etc/network/interfaces I deleted "network" and "broadcast" information and the DHCP worked on my guest VMs. Now I can ssh into my Guest VM. I guess my "network XXX.XXX.XXX.XXX" or "broadcast XXX.XXX.XXX.XXX" is wrong. the guide is still working well for this kind of setup, just be careful when set up your own network environment. The problem is solved!!! – Xianlin Mar 9 '12 at 5:25
libvirt has two commands now: domifaddr and net-dhcp-leases – Nehal J. Wani Mar 18 '15 at 0:04
please refer this link, you will find a answer: – user169994 May 12 at 3:38
up vote 6 down vote accepted

See the blog below for more details. Simply put, you can run arp -n to see what IP your virtual machine pick up. In that way, you don't have to login guest vm and type ifconfig.

Tip: Find the IP address of a virtual machine

share|improve this answer

If you have console access to the VM then just run ifconfig -a on the guest. While you are there, check to make sure that the guest does have network connectivity and that sshd is running.

If you have not console access, then chances are the IP address was assigned by DHCP. Look for another machine that is also getting a DHCP assignment, maybe the host server, and then add 1 to the address and try it. In fact, try the next 5 or 6 addresses. If that doesn't work, then you either have a large active network and will need to try every IP address in the subnet, or there is a lower level network problem like no route to host or two hosts with the same MAC address. Or maybe you just didn't get sshd running.

Using the console is the easiest way to solve this problem.

share|improve this answer
I actually managed to connect to my VM via Xming Server + "virt-viewr" command. I found there is no IP assigned to the guest while I am in the VM. How to make DHCP works? Any XML file I need to change? – Xianlin Mar 2 '12 at 6:21
Hi Michael, do you think you can help me if I give you access to my server? I tried DHCP and Static IP but the guest VMs are not getting any IP, my host server still can access the internet though. thanks. – Xianlin Mar 5 '12 at 3:21

It's possible to connect through builtin VNC with virt-manager, and you do tty login, find the ip address with ifconfig eth0. Normally eth0, unless you've specified otherwise.

share|improve this answer

Try this:

virsh net list
virsh net-dhcp-leases <net-name>   <--- net-name from above command
share|improve this answer
This is the correct answer. Works without any hacking. Thanks a lot. – chmac Jun 24 at 13:46

(While you seem too advanced for such a simple answer)


$ ifconfig


share|improve this answer
also, be careful, if you have duplicate instances of the same machine, as the machine will have issues with the fake MAC address etc... there are ways to manually edit that (and I think run a command for that as well) – David Mar 2 '12 at 3:58
I only have one VM "vm1" on my ubuntu server host and the "ifconfig" command output shows no ip address assigned to my "eth0" network adapter. – Xianlin Mar 2 '12 at 4:59
yeah, you have no ip... Did you try "dhclient eth0" --might need sudo – David Mar 3 '12 at 23:21
I tried but still not getting dhcp ip from my host server to my guest VMs. My host server is assigned a fixed IP and it can access the internet. – Xianlin Mar 5 '12 at 3:22
if you want an ip not on the parent network, you want to select NAT in your vm settings instead of bridged. – David Mar 5 '12 at 18:57

If you have QEMU(VM emulator) go to "i" button and check the network card associated with "Br0" network. Take a note of the mac address of the NIC. Now Login to your VM -> Open Terminal -> type: "ifconfig" command in the terminal -> take a note of IP address associated with the the Mac address that you have noted earlier.

You can login to your VM using Putty or any ssh client using the IP you have noted in the last step.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.