[libvirt] networking static ip address

Charles Duffy Charles_Duffy at messageone.com
Mon Feb 23 22:27:42 UTC 2009


Francisco José Martín wrote:
> Then, I suppose there's no way to assign the IP on boot without DHCP, 
> there is?

Plenty of ways, but they aren't things libvirt (or physical hardware) 
has control over. Two approaches I use (in situations which call from 
them respectively):

Build the VM image from a kickstart file with the static IP substituted in.

Boot (using -kernel, -initrd and -append) into a custom initrd which 
rewrites /etc/sysconfig/network-scripts/ifcfg-* (and friends) for the 
desired configuration within a given guest.

I suppose you could also use an expect script to log into a booted guest 
at its console (via a serial console redirected to a VT or socket or 
such -- libvirt has plenty of options in this respect) and modify its 
network configuration that way.




More information about the libvir-list mailing list