KVM - The Linux Kernel-Based Virtual Machine
News, Blogs and Resources on the Linux (KVM) Kernel-Based Virtual Machine

Assign IP to Guest VM in KVM

5 replies [Last post]
kvmnewbie
Offline
Joined: Sep 26 2010
Points: 3

I have a server with 5 Public IPs.
I have installed CentOS as Host and KVM virtualization.
Creating a Guest is simple using virt-manager.

I wanted to know how to give one Public IP out of the 5 to a Guest VM.
In OpenVZ its pretty simple as you can use vzctl 101 --ipadd.

How to do this in KVM ?

joern
Offline
Joined: Sep 14 2008
Points: 12
Re: Assign IP to Guest VM in KVM

Configure the guest vm for bridged networking and then configure
the guest os to use that ip you want... ?

greetings joern

datamove
Offline
Joined: Feb 17 2011
Points: 14
Re: Assign IP to Guest VM in KVM

I wonder if he wants to assign an ip address at the time of creation of the machine? I.e perhaps virt-install to have an option that would configure the built-in dhcp server to bind given ip address to the guest's mac?

--Never forget to thank KVM developers for excellent work

Anonymous (not verified)
Right. Is there a way to

Right. Is there a way to "assign" a static address to the guest (not on the internal/bridged network) but on the "external" network.

I have not come across a way to do that.

Also, once assigned (if possible), how to change it (comes later and may answer itself based on the above)

thanks
-a

snailexe
Offline
Joined: Aug 22 2011
Points: 4
detect the auto assigned ip address

I also have the similar question, I use the open vswitch to create a bridge, and every guest on the host connect the bridge and get a public ip address assigned by DHCP server in the external router.

Is that possible to detect the guest IP address without typing the "ifconfig" in each guest?

I was hoping to use the third party tool, like libvirt, to probe the Ip address, so far I have not found yet. Any people have ideas? Thank you.

snailexe
Offline
Joined: Aug 22 2011
Points: 4
if you can use libvirt, it is

if you can use libvirt, it is a virtualization library, and it has a configuration file, which can configure both mac address or IP address. IP address can be any IP address.

Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.