[Libguestfs] Libguestfs tools to modify network configuration of windows guest image?

Richard W.M. Jones rjones at redhat.com
Fri Jul 29 10:49:13 UTC 2011


On Fri, Jul 29, 2011 at 11:20:20AM +0100, Richard W.M. Jones wrote:
> On Fri, Jul 29, 2011 at 06:10:36PM +0800, Yufang Zhang wrote:
> > Hi all,
> > 
> > Could I ask if libguestfs provide some kind of tools via which we could
> > modify network configuration of Windows guest image? It really makes sense
> > if such tools exist, so that we could deploy several Windows guests from the
> > same template image in a batch way automatically. Or do you have any hints
> > to achieve this?  Thanks.
> 
> virt-win-reg --merge WindowsGuest < changes.reg
> 
> http://libguestfs.org/virt-win-reg.1.html
> 
> However you need to know which registry entries you want to modify.  I
> don't know, off hand, but I'm sure it's easy to find out with some web
> searching.

Probably you want to look at

  HKEY_LOCAL_MACHINE\System\ControlSet001\Services\Tcpip

(note that ControlSet001 might be different for your template.  See:
http://libguestfs.org/virt-win-reg.1.html#currentcontrolset_etc_ )

The guest's Hostname is stored directly as the "Hostname" entry in:

  HKEY_LOCAL_MACHINE\System\ControlSet001\Services\Tcpip\Parameters

I only have Windows guests that get their configuration through DHCP,
so I am seeing lots of DHCP configuration entries in
...\Tcpip\Parameters\Interfaces\{...}  I bet that if you had a
template with a static address, then that would appear somewhere under
there too.

If you let us know which exact bits of the network configuration you
are interested in modifying, I can probably help further.

Try using the virt-win-reg --unsafe-printable-strings option when
looking at the registry.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list