correct conf behind NAT?

rohan_sirohi

New Member
Oct 30, 2023
9
0
1
I am experiencing an issue with my Nginx setup on Proxmox. All services work fine for the external network—if I try to visit abc.mydomain.com, which is pointed to my Proxmox server, it works as expected. However, when I try to access the site from the internal network, it does not work. I am unable to curl or visit the site from the internal network. This issue persists whether I try from a container or a VM. While I know we can modify the /etc/hosts file as a workaround, I would prefer not to use that method. I want to resolve this issue within the network configurations of the host. Below is the current configuration for this setup.


Code:
auto enp6s0.4000
iface enp6s0.4000 inet static
    address 192.168.31.3/24
    mtu 1400

auto vmbr0
iface vmbr0 inet static
    address 192.168.13.1/24
    bridge-ports none
    bridge-stp off
    bridge-fd 0


        post-up   echo 1 > /proc/sys/net/ipv4/ip_forward
        post-down echo 0 > /proc/sys/net/ipv4/ip_forward
        post-up   iptables -t nat -A POSTROUTING -s '192.168.13.0/24' -o enp6s0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.13.0/24' -o enp6s0 -j MASQUERADE
        post-up   iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
        post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
# Below conf is for nginx
        post-up   iptables -t nat -A PREROUTING -i enp6s0 -p tcp --dport 80 -j DNAT --to-destination 192.168.13.107:80
        post-down iptables -t nat -D PREROUTING -i enp6s0 -p tcp --dport 80 -j DNAT --to-destination 192.168.13.107:80
        post-up   iptables -t nat -A PREROUTING -i enp6s0 -p tcp --dport 443 -j DNAT --to-destination 192.168.13.107:443
        post-down iptables -t nat -D PREROUTING -i enp6s0 -p tcp --dport 443 -j DNAT --to-destination 192.158.13.107:443

Is any way to work around this issue?? If yes then let me know and if you know additional information about this one let me know I will provide.