CT from other CT via NAT and public IP not reachable

tommie

Member
Oct 6, 2014
2
0
21
Hi,

one CT works as a mailserver, reachable via NAT from external network with the following iptables-roules:

IP="xxx.xxx.xxx.xxx"
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp -d $IP --dport 25 -i eth0 -j DNAT --to-destination 192.168.0.105:25

Is there a way to connect to the mailserver-CT from internal network via public IP?

telnet xxx.xxx.xxx.xxx 25
Trying xxx.xxx.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused


telnet via internal IP works.


Thanks, proxmox mit openvz rocks!
 
OK, after trying for hours I found the solution - sorry for posting.

First I enabled iptables-logging to see in which way the CT tries to connect to mailserver-CT. And so I found out, that from internal-network it's over venet0 instead of eth0 - no matter, that it tried to connect via public IP.
So I only had to add the following rule:

iptables -t nat -A PREROUTING -p tcp -d $IP --dport 25 -i venet -j DNAT --to-destination 192.168.0.105:25
 

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!