Did not get any response in the CentOS Virt list.
Posting in the CentOS General list hoping that some one here can
provide clarification.
Thx,
-- Arun Khan
---------- Forwarded message ----------
From: Arun Khan
Date: Tue, Jun 12, 2012 at 8:54 PM
Subject: Meaning of "vlan=" and "name=" in Linux KVM
To: CentOS Virt <centos-virt(a)centos.org>
Greetings KVM gurus,
I am trying to understand a "use case" scenario for the "vlan=n"
option and "name=name" for the "-net nic" and "-net tap" directives.
I have done some search but I have not come up with anything that
sheds any light on the above.
<quote from kvm man>
Network options:
-net nic[,vlan=n][,macaddr=mac][,model=type]
[,name=name][,addr=addr][,vectors=v]
Create a new Network Interface Card and connect it to VLAN
n (n = 0 is the default). The NIC is
an e1000 by default on the PC target. Optionally, the MAC
address can be changed to mac, the
device address set to addr (PCI cards only), and a name can
be assigned for use in monitor
commands. Optionally, for PCI cards, you can specify the
number v of MSI-X vectors that the card
should have; this option currently only affects virtio
cards; set v = 0 to disable MSI-X. If no
-net option is specified, a single NIC is created. Qemu
can emulate several different models of
network card. Valid values for type are "virtio",
"i82551", "i82557b", "i82559er", "ne2k_pci",
"ne2k_isa", "pcnet", "rtl8139", "e1000", "smc91c111",
"lance" and "mcf_fec". Not all devices are
supported on all targets.
-net tap[,vlan=n][,name=name][,fd=h][,ifname=name]
[,script=file][,downscript=dfile]
Connect the host TAP network interface name to VLAN n, use
the network script file to configure
it and the network script dfile to deconfigure it. If name
is not provided, the OS automatically
provides one. fd=h can be used to specify the handle of an
already opened host TAP interface. The
default network configure script is /etc/qemu-ifup and the
default network deconfigure script is
/etc/qemu-ifdown. Use script=no or downscript=no to disable
script execution.
</quote from kvm man>
My objective is to create a small "virtual" network using bridges/tap
interfaces on the Host OS and running the Guest OSs (the network
segment separated by vlan=somenumber)
My hypothesis is that with "vlan=X" and "name=somename" the VMs can be
separated into different segments i.e. a set of tap interfaces on
vlan=10 and another set of tap interfaces on vlan=20 connected to the
same bridge br0.
I have two VMs started with "kvm -net tap,vlan=10" and "kvm -net
tap,vlan=20" respectively but with IP numbers in the same subnet
172.16.0.0/24; they are able to ping each other with different "vlan"
numbers.
I would appreciate any clarification on the "vlan=" and "name=" options.
Sample script for my KVM VMs
<script>
#!/bin/bash
kvm \
-vga std \
-m 1024 \
-cpu core2duo \
-smp 2,cores=2 \
-drive file=/home/kvmusr/KVM/vdisks/centos62.img,index=0 \
-net nic,vlan=1,model=e1000,macaddr=${nic_mac_addr0} \
-net tap,vlan=1,ifname=tap0,script=no,downscript=no \
</script>
Thanks,
--
Arun Khan