NAT hairpinning/loopback/reflection problem: solved but looking for input

jeanpluzo

New Member
Jun 14, 2023
1
0
1
Hi everyone,

I've kind of solved my problem, but would like more input because I'm doing it in a "hacky" way.
Setup:
- Proxmox 8.2.5 running single VM.
- Said VM has Mail-in-a-box (MIAB) as well as a Wordpress (Wp) instance (very simple setup, just 1-2 pages).
- Enough CPUs, RAM and HDD space

Problem:
Since MIAB wants to take control of everything, I created the VM with Ubuntu 22.04, configured DNS according to MIAB docs, installed MIAB and as a last step installed Wp. MIAB runs under the assumption that it's facing directly "outside", that is, to the internet. Since this is not the case as Proxmox is the one controlling all traffic through the bridge interface (vmbr0), I had to add some NAT rules to said interface. I thought this would work but alas it was not the case. Investigating a bit more I found out you have to configure/enable NAT loopback/hairpinning/reflection in Proxmox so that MIAB is able to see itself having a public IP address instead of Proxmox's IP address. I tried this hairpinning stuff for some days on different virtual interfaces but no luck (I even discovered that you can turn hairpinning on/off with the bridge command in the Proxmox host).
In the end I used a form of DNS splitting: I "tricked" MIAB to think it was able to access itself through a public IP address by modifying the /etc/hosts file in the VM and pointing the DNS address to the private IP address of MIAB. This finally kind of worked since e-mails are being sent and received and the Wp site is working. But I still get some errors from MIAB like when I try the "Status Checks" in the admin GUI ("Something went wrong, sorry") or when I try to add a user through the admin GUI (I get an error but the user was added. This I can verify through the API).
I'm not a network specialist but I know my stuff. If anybody has successfully configured this setup or something similar I would love to hear your input.
Also, if more details are needed I will gladly post the setup and perhaps a diagram.

Regards,
J.
 

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!