[CentOS-virt] KVM + bridge + static ip address

Fri Aug 8 16:27:50 UTC 2008
Raymond C. Rodgers <sinful622 at gmail.com>

Hi folks,
 I've been reading through the list a bit, and also looked at the KVM 
How-To on the wiki (http://wiki.centos.org/HowTos/KVM ) but I still have 
a question. I haven't yet begun to set up KVM, so I haven't made any 
mistakes yet. :-)

 My company recently rented a server on which CentOS 5.0 is installed, 
and my goal is to set up a virtualized instance of CentOS for a new 
employee to tinker and learn on before I let him have hands on the real 
server. What I want to do is set up CentOS in KVM, and assign it one of 
the unused IP addresses on the server so that he and I can access it 
without having to first connect to the real server. The wiki didn't 
really give me a good idea of how to accomplish this, and I haven't done 
a bridge before, so I wanted to check with the list to see if I could 
get some advice on how to accomplish this.

 For demonstration purposes, lets say that the external IP address of 
the real server is 10.0.0.1, and I want the virtualized install to be 
found at 10.0.0.2. Can someone show me how to modify the kvm rules found 
on the wiki (and pasted below) to accomplish this?

Thanks!
Raymond

#!/bin/sh
PATH=$PATH:/usr/sbin:/sbin
sudo brctl addbr br0
sudo ifconfig eth0 0.0.0.0
sudo brctl addif br0 eth0
sudo ifconfig br0 192.168.1.120 netmask 255.255.255.0 up
sudo route add -net 192.168.1.0 netmask 255.255.255.0 br0
sudo route add default gw 192.168.1.1 br0
sudo tunctl -b -u john
sudo ifconfig tap0 up
sudo brctl addif br0 tap0
export SDL_VIDEO_X11_DGAMOUSE=0
sudo iptables -I RH-Firewall-1-INPUT -i br0 -j ACCEPT
qemu-kvm ~/win2k.img -m 512 -net nic -net tap,ifname=tap0,script=no