Port forwarding without restarting the host system

Rootinator

Member
May 1, 2019
23
0
21
54
Hello,

if I create a port forwarding in "/etc/network/interfaces", I have to reboot the entire host system every time, so that the changes take effect.

When I run "/etc/init.d/networking restart", the changes will not be applied live and all VM will be without Internet until the host system is restarted.

Is there a way to take port forwarding live without rebooting the host system?
 
If you show us what you did, we can help better. I assume it's iptables?

Generally, you can just run the commands you added manually on the console.
 
Yes, I use iptables for that.

I edit the "/etc/network/interfaces" and add the port forwarding rule at the end:

Code:
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 5678 -j DNAT --to 10.0.0.13:80
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 5678 -j DNAT --to 10.0.0.13:80

Unfortunately I have to restart the host system after every change.
 
Is not it then that the commands are only temporary and are deleted after a restart of the host system?
At least that's what I thought, that would be the case with iptables (?)
 
Is not it then that the commands are only temporary and are deleted after a restart of the host system?

So? You asked how you can "take portforwarding live without a reboot" and just running the commands you added does exactly this. This is additional to adding port forwards to /etc/network/interfaces.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!