Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I make virtual environment with Ubuntu+KVM.

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

router/dhcpd - ubuntu01(host) 192.168.1.100
             - ubuntu02(kvm)  192.168.1.2
             - ubuntu03(kvm)  192.168.1.2?

What's wrong?

ubuntu01:/etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
  address 192.168.1.100
  network 192.168.1.0
  netmask 255.255.255.0
  broadcast 192.168.1.255
  gateway 192.168.1.1
  bridge_ports eth0
  bridge_fd 9
  bridge_hello 2
  bridge_maxage 12
  bridge_stp off

ubuntu0[23]:/etc/network/interfaces

# 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

/etc/qemu-ifup

#!/bin/sh
#sudo -p "Password for $0:" /sbin/ifconfig $1 172.20.0.1
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
sudo /usr/sbin/brctl addif br0 $1
sleep 2
share|improve this question

2 Answers 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 ...

#!/bin/bash

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
share|improve this answer

Are they sharing MAC addresses?

Check the results of ifconfig in both vm's.

share|improve this answer

Your Answer

 
discard

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.