I make virtual environment with Ubuntu+KVM.

It is the following constitution, but it is lent IP ( ubuntu02 by DHCPD, and the same IP seems to be lent to ubuntu03

router/dhcpd - ubuntu01(host)
             - ubuntu02(kvm)
             - ubuntu03(kvm)

What's wrong?


auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
  bridge_ports eth0
  bridge_fd 9
  bridge_hello 2
  bridge_maxage 12
  bridge_stp off


# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

I usually execute this shell command sudo kvm -hda ubuntu.img -m 512 -localtime -net nic,model=pcnet -net tap,script=/etc/qemu-ifup -daemonize -nographic


#sudo -p "Password for $0:" /sbin/ifconfig $1
sudo /sbin/ifconfig $1 promisc up
sudo /usr/sbin/brctl addif br0 $1
sleep 2

LapTop006 is correct. Both of your VMs have the same MAC address causing your DHCP server to assign the same IP address to both VMs.

When you start each virtual machine, you will need to add the command line option

-net nic,macaddr=aa:bb:cc:dd:ee:ff

so that each VM receives a unique MAC address. Substitute aa:bb:cc:dd:ee:ff for any valid MAC address that's not being used in your network. I just use 00:00:00:00:00:01 for the first VM, 00:00:00:00:00:02 for the second VM and so on.

I ended up creating a separate shell script to start each VM. For example, to start my OpenSolaris VM I use ...


vdeq kvm \
    -localtime \
    -hda /data/kvm/opensolaris_hda.raw \
    -hdb /data/kvm/opensolaris_hdb.raw \
    -hdd /data/kvm/opensolaris_hdd.raw \
    -m 1024 \
    -no-acpi \
    -usb \
    -usbdevice tablet \
    -net nic,macaddr=00:00:00:00:00:04 \
    -net tap,script=/etc/kvm/kvm-ifup \
    -cdrom /usr/local/src/CD/osol-0811.iso \
    -boot c

Are they sharing MAC addresses?

Check the results of ifconfig in both vm's.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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