Since Hairpin NAT was kind of a pain in the a** to set up, I decided to go for DNS route in the end.
The following solution made it possible to connect to the domains/containers that are hosted on the same machine.
-
Create a file in the /etc/unbound/unbound.conf.d/ directory e.g. randomfilename.conf
-
Add a line for every domain that you want to resolve internally with the internal VM IP (e.g. 192.168.1.1)
server:
local-data: "domain1.xx.com. IN A INTERNAL_VM_IP"
local-data: "domain2.xx.com. IN A INTERNAL_VM_IP"
local-data: "domain3.xx.com. IN A INTERNAL_VM_IP"
- Restart Unbound DNS Server via "systemctl restart unbound"
Hopefully this helps someone who runs into the same problem.
@girish Thanks for your help!