Hi Avi, all,

> I tried it now, it's simple and it even works:
> 
> 1. Add BRIDGE=sw0 to ifcfg-eth0
> 2. Create a new ifcfg-sw0 that has TYPE=Bridge, and any dhcp/ip 
> configuration you previously had in ifcfg-eth0

I've now managed to get several KVM hosts working in a local intranet
based on your help, thanks! Below are finally step-by-step instructions
that work at least on Fedora Core 6, running other FC6 virtual hosts:

- configure networking for virtual hosts:
  - eth0 used for outer/public network connections
  - eth1 used in a local intranet
  - cp ifcfg-eth1 ifcfg-sw1
  - add BRIDGE=sw1 to ifcfg-eth1
  - add TYPE=Bridge to ifcfg-sw1, change DEVICE=sw1
  - ONBOOT=yes probably useful on both, eth1 needs to be up first
  - restart network/boot and verify that eth0/eth1/sw1 are up, eth1 has
no IP
  - optional: enable NAT for KVM hosts:
    - echo 1 > /proc/sys/net/ipv4/ip_forward
    - iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    - make sure no other fw rules are blocking traffic to outer network
  - run dhcpd (if wanted) and name server on interface sw1. dnsmasq as
a name server is a very good choice, needs zero configuration. dhcpd
should provide addresses proper for the local intranet.
  - create executable /etc/qemu-ifup that contains:

#!/bin/sh
switch=sw1
ifconfig $1 0.0.0.0 up
brctl addif ${switch} $1

That's it! To run several KVM hosts, just do:

- download, compile, and install proper kvm version (v12 for 2.6.20,
v15 or newer for 2.6.21 and newer), see
http://kvm.qumranet.com/kvmwiki/HOWTO for details
- create a qcow disk image, see the above HOWTO
- launch FC6 installer (or other OS of your choice), use dhcp or static
addresses depending on your setup, see HOWTO for info to start install
- after installation start the OS (see HOWTO) and configure the virtual
host to the max
- shutdown the host, cp vdisk1.img vdisk2.img, cp vdisk1.img
vdisk3.img, etc as many times as needed
- finally, start virtual hosts with:

qemu-system-x86_64 -hda vdisk1.img -boot c -m 512 -net
nic,macaddr=00:00:00:00:00:11 -net tap,script=/etc/qemu-ifup &
qemu-system-x86_64 -hda vdisk2.img -boot c -m 512 -net
nic,macaddr=00:00:00:00:00:22 -net tap,script=/etc/qemu-ifup &

etc. Double check network settings on virtual hosts and they should be
all set to work as any other host on your local intranet: they can ping
each other, public hosts, you can log in to them, etc.

Cheers!


 
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to