WAN behind a NAT

NethServer Version: 7.9.2009
Module: email

Hello, I am trying to setup a Nethserver box that is - unfortunately - behind a firewall/NAT on the WAN part (i.e. eth1). Local LAN is 192.168.111.0/24 and WAN IP is 192.168.9.2 (192.168.9.1 is the default gateway). I am also locked behind an IPv4-only network.

I can forward any port from my public IP to the Nethserver machine, but I can’t get rid of this NAT for non-tech reasons (not in my authority).

Most of the stuff works as expected i.e. http/https, interface, yum updates … I can reach the 9090 port on the WAN also if I want.

I have set up my own DNS servers to use the machine as a mail server, everything seems fine, the records are ok and port 25 is correctly forwarded, and the online checks are ok, DKIM & all. But the box says “port 25 unreachable” even if it’s forwarded correctly (from PUBLIC IP to 192.168.9.2)

I can receive email, but, for reasons I do not comprehend, I can’t connect to any MX exchange on port 25, the email module keeps the messages into the queue and “can’t connect”. Even with raw telnet on port 25, I can’t contact any MTA (timeout).

This happens even with firewall completely disabled (shorewall clear).

All the other services are ok, I can connect with other service BUT not port 25. This is puzzling me.

Strangely, when the machine (is a virtual machine) reboots, the messages are sent. Then immediately port 25 gets “sealed” for output again.

Tried many many things but can’t come up with a solution, and the logs are simply silent.

Any help would be greatly appreciated.

This is my routing table:

Clipboard02g

It seems it was much simpler than I expected: I simply had to DELETE the default GW on the LAN/GREEN interface, i.e. leave it empty.

It was pointing to 192.168.9.1 (the WAN GW, and the default GW for the whole machine), but it seems I was making the wrong assumptions about it…

This way the system behaves correctly and packets flow correctly.

1 Like