The Archlinux wiki has a good article on VLANs that will show you how to set them up for testing.
On CentOS to do this more permanently, use
/etc/sysconfig/network-scripts/ifcfg-eth0.1 could be:
/etc/sysconfig/network-scripts/ifcfg-eth0.2 could be:
You then create br0, your VM bridge,
Assuming you put the appropriate forwarding rules in place, all traffic from your VMs on br0 will be tagged with VLAN id 2 when it hits the switch.