Kvm + nat

BrusE

New Member
Nov 5, 2008
17
0
1
Hi

I want to install Windows Small Business Server 2008, but I dont know how config the network. I want to use NAT and I cant get it working. Enyone?
 
I use following solution for my Vista64 as KVM VM:
create a new bridge, say vmbr1, with a private IP-address, say 10.0.1.254, and a netmask of 255.255.255.0.
Make it autostarting and don't add any ports.
select a static IP-adress for you VM, say 10.0.1.2
Add the nat entry in your IPTABLES-setup:
Code:
iptables -t nat -A POSTROUTING -s 10.0.1.0/24 -o eth0 -j SNAT --to x1.x2.x3.x4
where x1.x2.x3.x4 is you external public IP - by default the address of vmbr0 -
forward any ports you want to your VM. In this example I connect port 4321 the remote desktop port on the VM.
Code:
iptables -t nat -A PREROUTING -p tcp -d x1.x2.x3.x4 --dport 4321 -i eth0 -j DNAT --to-destination 10.0.1.2:3389
Boot up you VM and connect via VNC to setup the static ip address -
Check if the IP-forwarding is enabled on the host - somehow it isn't always...

BTW I don't have eth0 added in vmbr0. I use vmbr0 as a gateway to my supplemental external adresses.