Change default port in proxmox

14 Oct
October 14, 2019

There is no direct method to change default port in proxmox so we use iptables to redirect to desire port instead.

1. Find network interface to apply iptables rule in proxmox. In this case VM bridge 0 is the interface we should apply our iptables rule.

root@proxmox:/# more /etc/network/interfaces
auto lo
iface lo inet loopback

iface enp5s0 inet manual

auto vmbr0
iface vmbr0 inet static
	address 192.168.1.5
	netmask 255.255.255.0
	gateway 192.168.1.1
	bridge_ports enp5s0
	bridge_stp off
	bridge_fd 0

iface eno1 inet manual

iface wlp0s20u4 inet manual
root@proxmox:/#

2. Apply iptables rule to incoming network interface. We will change proxmox default port 8006 to 41568.

root@proxmox:/#iptables -t nat -I PREROUTING -i vmbr0 --dst 192.168.1.5  -p tcp --dport 41568 -j REDIRECT --to-ports 8006

3. Save iptables rules.

root@proxmox:/#apt-get install iptables-persistent
root@proxmox:/#/usr/sbin/netfilter-persistent save
Tags: , , , ,
© Copyright - HHGG It's 42