[virt-tools-list] renaming interface in host machine
Chris Lalancette
clalance at redhat.com
Thu Nov 19 09:02:40 UTC 2009
On 11/19/2009 09:26 AM, dave wrote:
> Hi,
>
> I would like to assign to each interface from a guest-machine a useful
> name so that I can address that interface by name from the host
> machine. The problem is right now I get names like vnetX, where X
> represents the number of the interface created.
> I asked around and I found something like mapping each interface on
> the host machine to a tun-device and give a more significant name to
> the tun-device.
>
> My goal is to have a name like machine1-eth0, machine1-eth1, ...,
> machine-10-eth0, ... so that I can connect them with bridges by hand
> from the host machine.
>
> I tried following command but it didn't change anything:
> virt-install --name=ubuntu-test -r 256 -vcpus=1 -f
> /media/virtualization/virtual_machines/kvm/ubuntu.img --vnc
> --accelerate -v -c ../../images/ubuntu-8.04.3-server-i386.iso
> --os-type=linux --os-variant=ubuntuhardy -net nic,ifname=tap1 -net
> tap,ifname=tap1,script=/etc/kvm/kvm-ifup
This won't do anything; virt-install is a separate program, so sending
qemu arguments to it won't accomplish anything. In fact, I'm surprised
it didn't blow up when you tried this (it should).
>
> of course I created a tap1 device
>
> indepently how I try to setup the network at the beginning I always
> get the following interface:
> <interface type='bridge'>
> <mac address='52:54:00:00:bc:a8'/>
> <source bridge='br0'/>
> <model type='virtio'/>
> </interface>
If you add <target dev='name'/> to that above piece of XML, you can get the
behavior you desire. Note that 'name' *cannot* start with 'vnet', otherwise
libvirt assumes that it is one of the auto-controlled network names. For
more information, see: http://libvirt.org/formatdomain.html#elementsNICS
--
Chris Lalancette
More information about the virt-tools-list
mailing list