0

i want to create a Gameserver in a Windows VM on my Ubuntu 16.04 Server with KVM.

I have already installed the vm and it is running properly. I deactivated the Windows Firewall directly in the VM.

The Windows VM communicates via a network bridge with the Internet that also works.

For my server I have released these ports in the Ubuntu Firewall ( Iptables ):

TCP: 2302,27015-27030,27036-27037
UDP: 2302,4380,27000-27031,27036

I realized the port forwarding according to these instructions: https://www.cyberciti.biz/faq/kvm-forward-ports-to-guests-vm-with-ufw-on-linux/

an iptables -L FORWARD -nv --line-number retun this:

root@s1 ~ # iptables -L FORWARD -nv --line-number
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num   pkts bytes target     prot opt in     out     source               destination
1     2532  201K ACCEPT     all  --  *      virbr0  0.0.0.0/0            192.168.122.0/24     ctstate RELATED,ESTABLISHED
2     5720  842K ACCEPT     all  --  virbr0 *       192.168.122.0/24     0.0.0.0/0
3        0     0 ACCEPT     all  --  virbr0 virbr0  0.0.0.0/0            0.0.0.0/0
4        0     0 REJECT     all  --  *      virbr0  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
5        0     0 REJECT     all  --  virbr0 *       0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
6        0     0 ACCEPT     all  --  *      virbr0  192.168.2.0/24       192.168.122.0/24     state NEW,RELATED,ESTABLISHED

an iptables-save -t filter | grep FORWARD retun this:

root@s1 ~ # iptables-save -t filter | grep FORWARD
:FORWARD ACCEPT [0:0]
-A FORWARD -d 192.168.122.0/24 -o virbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 192.168.122.0/24 -i virbr0 -j ACCEPT
-A FORWARD -i virbr0 -o virbr0 -j ACCEPT
-A FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -s 192.168.2.0/24 -d 192.168.122.0/24 -o virbr0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT

My networ interface looks like this:

### Hetzner Online GmbH installimage

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback
iface lo inet6 loopback

auto br0
iface br0 inet static
  address <My Address>
  netmask 255.255.255.192
  gateway <Another Address>
  # route <Another Address> via <Another Address>
  up route add -net <Another Address> netmask 255.255.255.192 gw <Another Address> dev eth0
  bridge_ports eth0
  bridge_stp off
  bridge_fd 0
  bridge_maxwait 0
iface br0 inet6 auto

iface eth0 inet6 static
  address <Another Address>
  netmask 64
  gateway <Another Address>

It actually looks good for me, but I don't have that much experience with kvm yet, because when I try to connect to the game server, the client doesn't... I guess there is still a problem with port forwarding.

Is there anyone who can give me a hint? Thank you :)

--- EDIT ---

The Ip address of my Windows VM: 192.168.122.191

  • are you launching a game's server on you ubuntu server on which you are also launching a windows vm which should connect to the game server? – tatsu Jul 15 at 12:39
  • @tatsu thx for reply i start a dayz Server, dayz only run on windows, so i have create a vm via kvm on my ubuntu server, and now i want to connect to my running game server via my pc – Rudi Jul 15 at 12:51
  • yeah it seems normal to me that you can't connect to a server that shares the same IP as your client. also running this from a VM is precarious at best. I strongly recommend you buy a small NAS and run your dayz server on that. it'll be better for you and for your friends. – tatsu Jul 15 at 13:05
  • @tatsu its not the same server, i have a ubuntu server, on this mashine runs a windows vm with the server. I want to connect with my private pc not the ubuntu server, to the server in the vm – Rudi Jul 15 at 13:07
  • ok then the problem is the whole vm aspect. I don't know what is causing the issue then. – tatsu Jul 15 at 13:11
0

after days of searching, i found out that my server running in the windows VM needed more ports than i released - i released all the ones i found in the docu... -.

If you start with KVM VM´s and want to connect to VM´s from the internet, then configure a bridged network in which you combine your network interface. After that the VM´s will be managed as devices in a NAT network.

Then these instructions can be used to realize the port forwarding from the Internet to the port of the Vm:

https://aboullaite.me/kvm-qemo-forward-ports-with-iptables/

The VM is created in this way:

https://www.cyberciti.biz/faq/installing-kvm-on-ubuntu-16-04-lts-server/ 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.