Setting up the networking at every hosting company is a little different. What works at one company may not work at another. At Kimsufi you are only allowed one IP number per server, so the networking on the server must be done differently than if you had multiple IP numbers assigned to your server. We will have to route all the traffic with iptables. To this end I will show you how I set up the networking on a Kimsufi KS-4C 16GB ram, i5-2300, 1x2TB hard drive, server.
I will configure 4 virtual machines on the single ip number. 1. A Windows 10 remote desktop connected with the RDP client found on every windows computer. 2. Plex Media Server, a Netflix like server that streams videos, music and TV shows that can be played on just about any device. 3. An ownCloud server, think Dropbox clone. 4. A Linux Apache, MYSQL and PHP (LAMP) server used to serve websites and handle email.
We will create a subnet used to route all traffic on our server. I like to use 10.0.0.1 thru 10.0.0.255 because it’s easy to remember.
VM #101 Windows 10 RDP IP # 10.0.0.101
VM #102 Plex Media Server with Mate desktop and X2go IP # 10.0.0.102
VM #103 ownCloud server IP # 10.0.0.103
VM #104 Debian LAMP web server IP # 10.0.0.104
So we can see from the table above that virtual machine number 101, a Windows 10 remote desktop server, will have IP number 10.0.0.101 .
First thing we do is start out with a freshly configured Proxmox VE 4.4 (64 bits) server from Kimsufi.
Login to your server via SSh.
Edit /etc/network/interfaces
add the following to the bottom of the document without touching anything above it.
# /etc/network/interfaces
auto vmbr2
iface vmbr2 inet static
address 10.0.0.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up echo 1 > /proc/sys/net/ipv4/conf/vmbr2/proxy_arp
post-up iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s 10.0.0.0/24 -o vmbr0 -j MASQUERADE
#101 windows 10 desktop RDP
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 13389 -j DNAT --to 10.0.0.101:3389
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 13389 -j DNAT --to 10.0.0.101:3389
#102 Debian desktop with Plex Server, Webmin and SSH
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 32400 -j DNAT --to 10.0.0.102:32400
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 32400 -j DNAT --to 10.0.0.102:32400
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 12222 -j DNAT --to 10.0.0.102:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 12222 -j DNAT --to 10.0.0.102:22
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 19999 -j DNAT --to 10.0.0.102:10000
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 19999 -j DNAT --to 10.0.0.102:10000
#103 ownCloud server
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 8000 -j DNAT --to 10.0.0.103:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 8000 -j DNAT --to 10.10.10.103:80
#104 Debian LAMP server SSh, Webmin
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.0.0.104:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 10.10.10.104:80
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 12224 -j DNAT --to 10.0.0.104:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 12224 -j DNAT --to 10.0.0.104:22
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 19996 -j DNAT --to 10.0.0.104:10000
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 19996 -j DNAT --to 10.0.0.104:10000
Now reboot the server /sbin/reboot
When creating new VMs and containers use the following when configuring the networking:
Use vmbr2 for bridge
When creating virtual machines IP: any number in range created, 10.0.0.2-254
Gateway is IP of Machine, same as proxmox IP
Netmask 255.255.255.0
Now we will configure the networking on the 1st virtual machine, our Windows 10 desktop.
Create a Windows 10 virtual machine. I found these instructions helpful for setting up my Windows 10 virtual machine.
Configure the networking on the Windows 10 VM like so:
Now you can RDP into your server on port 13389. , ( your-ip-number:13389 ), the same ip Proxmox uses. Make sure you have enabled remote desktop connections on the virtual machine.
The next 3 virtual machines will all be LXC containers. They are all configured the same way with different IP numbers. Here is a Proxmox networking sample, this is the networking for container 102, our Linux desktop with a Plex Media Server. This is VM # 102 on IP number 10.0.0.102.
The Proxmox server has port 32400 configured to go to the 32400 port on the VM for the Plex Media Server ( http://your_ip_number:32400/ ). It can be reached at port 12222 for SSh (your_ip_number:1222). Webmin can be reached at port 19999 ( https://your_ip_number:19999 ) if you would like to install it.