[CentOS] KVM Setup for Win7 Pro on CentOS 5.x

Fri Aug 17 22:06:30 UTC 2012
Bill Campbell <centos at celestial.com>

On Thu, Aug 16, 2012, Theo Band wrote:
>On 08/16/2012 06:36 PM, Bill Campbell wrote:
...
>>     + Set up network bridging on the private LAN so that the Windows system
>>       is accessible via OpenVPN connections from the outside world and by
>>       users on the LAN to run a client/server accounting application.
>>> I have done KVM VLANs but I am not sure if it can be done from the
>>> virt-manager.   Experiment and see how far you can go.
>> I will be digging into this later today.  So far I've found the
>> file /var/lib/libvirt/network/default.xml and see a vibr0
>> interface defined.
>>
>> The documentation I found yesterday described setting up briding,
>> but hopefully virt-manager has a nicer way to do it.

>This I find the most difficult part. I have done it a couple of time and 
>made myself a HOWTO. You need to fill in some IP figures of course. I 
>assume a fixed IP address, but DHCP should work as well. The setup 
>creates a bridge and adds and existing interface (ifcfg-ethx) to that 
>bridge. After that you can use the bridge for the VMs:

I got things installed yesterday, adding a routed network section
using virt-manager linked to the private interface, eth1.  I left
the default NAT interface as-is.

After rebooting the machine, two bridge devices, virbr0 and
virbr1 appear in 'ifconfig' output with the appropriate IP
addresses (192.168.122.1 and 192.168.100.1 respectively).

The 'route -n' command shows reasonable routes for the VMs.

I am thoroughly confused by the documentation I've found so far,
much of which seems to be out of date.

When the Windows VM is active with the network virbr1 defined
with virt-manager and all other things default, a 'vmnet0' device
appears in 'ifconfig' output.  I can ping the IPs on the private
lan (192.168.101.0/24 in this case), but cannot get to the
outside world, nor can hosts on the LAN ping the VM's assigned IP
address 192.168.100.114.

If I shut down the VM, manually run 'brctl addif virbr1 eth1', then start
the VM things change:

   + The IP address assigned to the VM is in the 192.168.101.0/24 block
     instead of 192.168.100.0/24 defined in virt-manager.

   + I can ping the outside world from the VM.

   + I can ping other hosts in 192.168.101.0/24, but *NOT* the Linux boxes
     IP address.

   + I cannot ping anything in 192.168.101.0/24 from the command line on
     the Linux host (logged in with ssh on the public interface).

   + The command 'brctl show' displays vmnet0 and eth1 vir virbr1.

I'm more than a bit confused at this point.

My main goal is to get LAN and OpenVPN access to the Windows VM.
I really don't care about Internet access from the Windows VM,
although Microsoft really wants it to get updates and such.

>KVM
>===
>yum install kvm virt-manager qemu bridge-utils
>#create bridge for virt-machine
>cat > /etc/sysconfig/network-scripts/ifcfg-br0 << _END_
>DEVICE=br0
>TYPE=Bridge
>IPADDR=192.168.48.X
>NETMASK=255.255.255.0
>GATEWAY=192.168.48.1
>BOOTPROTO=none
>ONBOOT=yes
>DELAY=0
>NOZEROCONF=true
>NM_CONTROLLED=no
>_END_
>
>Edit /etc/sysconfig/network-scripts/ifcfg-ethx :
>ONBOOT=yes
>BRIDGE=br0
>NM_CONTROLLED=no
>
>service network restart
>_______________________________________________
>CentOS mailing list
>CentOS at centos.org
>http://lists.centos.org/mailman/listinfo/centos
>

-- 
Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

Lord, the money we do spend on Government and it's not one bit better
than the government we got for one third the money twenty years ago.
    Will Rogers