Recently I hired a Kimsufi server to host certain websites and services.
I had constant problems to configure the networking interfaces and the port forwarding.
The system is configured using a Proxmox (5.4-11) as a host and a Debian as the VM guest. I created a virtual interface (vmbr1), which the Debian 9.9 with a static IP configuration (192.168.x.55) is connected to.
I tried to forward ports without luck. I searched lots of help topics on this forum/stackoverflow/OVH forums, and nothing:
pveversion:
This is my /etc/network/interfaces configuration:
auto lo
iface lo inet loopback
iface enp4s0 inet manual
iface enp5s0 inet manual
auto vmbr0
iface vmbr0 inet static
address <public_ip>
netmask 24
gateway <public_gateway>
bridge-ports enp4s0
bridge-stp off
bridge-fd 0
auto vmbr1
iface vmbr1 inet static
address 192.168.x.xx
netmask 24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.x.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.x.0/24' -o vmbr0 -j MASQUERADE
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.x.55:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.x.55:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.x.55:80
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 192.168.x.55:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 192.168.x.55:22
Where 192.168.x.xx is the IP of vmbr1, and 192.168.x.55 is the IP of Debian.
The thing is that when I do ifdown vmbr1; ifup vmbr1 to restart said config, it seems that everything works well:
This message is prompted:
Waiting for vmbr1 to get ready (MAXWAIT is 2 seconds).
If I ping the VM (192.168.x.55) it answers, if I ping 8.8.8.8 from the VM internet is fine, even if I download a package using apt-get install xxx
But if I try to connect to the SSH behind this machine using my public IP + 2222 (example: 1.2.3.144:2222) it doesn't work, I don't have any way to check what is failing... This worked before, but for some reason, I broke up something...
I also changed some of the parameters of the Network Device, but to make sure this wasn't the fact to make it fail, I installed another virtual machine (using Ubuntu this time). The same thing happens the Internet/ping are fine, but I can't connect to SSH.
I would like to check more things on my Proxmox setup, but I don't know where to start.
Any guidance would be very appreciated!
I had constant problems to configure the networking interfaces and the port forwarding.
The system is configured using a Proxmox (5.4-11) as a host and a Debian as the VM guest. I created a virtual interface (vmbr1), which the Debian 9.9 with a static IP configuration (192.168.x.55) is connected to.
I tried to forward ports without luck. I searched lots of help topics on this forum/stackoverflow/OVH forums, and nothing:
- https://forum.proxmox.com/threads/h...on-5-3-6-old-tutorials-are-not-working.50392/ (this guy has the same trouble)
- https://forum.proxmox.com/threads/issue-with-nat-configuration-proxmox-5-2-ovh.48101/
- https://serverfault.com/questions/888309/forwarding-traffic-with-one-ip-proxmox
- https://serverfault.com/questions/761748/proxmox-ve-routing-and-port-fowarding-issue
- etc, etc...
pveversion:
Code:
pve-manager/5.4-11/6df3d8d0 (running kernel: 4.15.18-18-pve)
This is my /etc/network/interfaces configuration:
auto lo
iface lo inet loopback
iface enp4s0 inet manual
iface enp5s0 inet manual
auto vmbr0
iface vmbr0 inet static
address <public_ip>
netmask 24
gateway <public_gateway>
bridge-ports enp4s0
bridge-stp off
bridge-fd 0
auto vmbr1
iface vmbr1 inet static
address 192.168.x.xx
netmask 24
bridge-ports none
bridge-stp off
bridge-fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.x.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.x.0/24' -o vmbr0 -j MASQUERADE
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.x.55:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.x.55:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 80 -j DNAT --to 192.168.x.55:80
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 192.168.x.55:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 192.168.x.55:22
Where 192.168.x.xx is the IP of vmbr1, and 192.168.x.55 is the IP of Debian.
The thing is that when I do ifdown vmbr1; ifup vmbr1 to restart said config, it seems that everything works well:
This message is prompted:
Waiting for vmbr1 to get ready (MAXWAIT is 2 seconds).
If I ping the VM (192.168.x.55) it answers, if I ping 8.8.8.8 from the VM internet is fine, even if I download a package using apt-get install xxx
But if I try to connect to the SSH behind this machine using my public IP + 2222 (example: 1.2.3.144:2222) it doesn't work, I don't have any way to check what is failing... This worked before, but for some reason, I broke up something...
I also changed some of the parameters of the Network Device, but to make sure this wasn't the fact to make it fail, I installed another virtual machine (using Ubuntu this time). The same thing happens the Internet/ping are fine, but I can't connect to SSH.
I would like to check more things on my Proxmox setup, but I don't know where to start.
Any guidance would be very appreciated!