[libvirt-users] How to start guset os with specified IP address

Cyrill von Wattenwyl cyrill.vonwattenwyl at adfinis-sygroup.ch
Tue Dec 15 10:03:52 UTC 2015


Hello

Am 08.12.2015 um 16:49 schrieb 落痕:
>     What should I do if I hope to start my guest os with specified
> IP address and guest os can be accessed by external computers?
>     I tried to use route mode to configure my virbr0, but it cannot
> assign an IP to my guest os!
>     If virbr0 are set NAT mode and act as a switch with dhcp, then the
> guest os cannot be accessed by external computer.

You need to do this on network-level, i dont think that's possible with
libvirt only.

One solution would be to specify an custom mac-address in the xml-file,
which your dhcp resolves to a fixed ip. It should be possibe to script this.

Another way would be to use plain preseed and run a script inside which
tells an server (http with an simple script) which ip adress your new vm
has. Then you could query this server for the ip.

But there are allready tools for such user cases, i would suggest you to
look into foreman [1], this may solves your problem more elegant than a
custom solution.


Best Regards,
Cyrill


[1] http://theforeman.org/

-- 
Adfinis SyGroup AG
Cyrill von Wattenwyl, System Engineer

Keltenstrasse 98 | CH-3018 Bern
Tel. +41 31 550 31 11 | Direkt +41 31 550 31 17

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20151215/591fa52e/attachment.sig>


More information about the libvirt-users mailing list