0

Running a windows 2008 r2 virtual on KVM via this guide. https://wiki.centos.org/HowTos/KVM#head-8424c473b52c407c62d08e8a37406821d05f5862

Using the interface provided by: virt-manager &

With settings:

enter image description here

Windows network adapter info:

enter image description here

First you will need bridge-utils, available from the base repo:


yum install bridge-utils
You'll also need tunctl.

This is now available from the RPMForge repository, so, once the repo is enabled, can easily be installed with


yum install tunctl
You will also want to edit your /etc/udev/rules.d/90-kvm-rules. When you installed the rpm, the created file reads:


KERNEL=="kvm",          NAME="%k", GROUP="kvm", MODE="0660" 
In theory, adding the line:


KERNEL=="tun",          NAME="net/%k", GROUP="kvm", MODE="0660" 
should give /dev/net/tun proper permissions. In practice, this doesn't seem to be the case, and though it is a kludge, one can simply add lines like


chown root:kvm /dev/net/tun
chmod 0660 /dev/net/tun 
to /etc/rc.local. This will definitely work. If the reader only uses kvm on occasion, they can simply make a little script with those lines, save it as something like tunperms.sh (or a better name) and just run it, either as root or with root permissions, when you want to use bridged networking.

For the impatient, here is our simple script. We'll explain it afterwards. This is assuming that you're on a 192.168.1.0/24 network with no DHCP server.


#!/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

From the above guide I did everything until

sudo ifconfig br0 192.168.1.120 netmask 255.255.255.0 up

Which turns off my remote connection and does not do anything for a long time. until I reboot server. It seems to only be successful at disconnecting the server's connectivity.

Unable to get internet connectivity.

Not sure how to set up the connectivity. Also viewed:

https://unix.stackexchange.com/questions/158077/no-internet-connection-for-a-kvm-guest-what-could-be-wrong

And ran the following commands:

iptables -t nat -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p tcp -j MASQUERADE --to-ports 1024-65535
iptables -t nat -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -p udp -j MASQUERADE --to-ports 1024-65535
iptables -t nat -A POSTROUTING -s 192.168.122.0/24 ! -d 192.168.122.0/24 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 192.168.122.0/24 -o eth0 -j SNAT --to-source <my server 19 here>
iptables -t filters -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -t filters -A FORWARD -s 192.168.122.0/24 -i br0 -j ACCEPT
iptables -t filters -A INPUT -s 192.168.122.0/24 -i br0 -j ACCEPT
8
  • 1
    Please tell us what you did. Just linking to an external site and expecting us to to read it and somehow guess what you did wrong is not a valid way to ask a question on Server Fault.
    – Sven
    Aug 7, 2016 at 17:47
  • @Sven Ok. Edited please remove hold or let me post new question.
    – Ya Wang
    Aug 7, 2016 at 19:50
  • Most of those screenshots are completely irrelevant. You need to describe how you have set up virtual networking on the KVM host, and how you tried to set up networking in the guest. Aug 7, 2016 at 19:50
  • @Michael Hampton Assume none. no other congifuration
    – Ya Wang
    Aug 7, 2016 at 19:51
  • If you have not set up the host for networking, how do you expect networking to work? Aug 7, 2016 at 19:54

1 Answer 1

0

I reimaged my centos.

Then reinstalled windows. It worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .