My public server accepts traffic and relays them to other machines on the network with iptables PREROUTING rules. I recently added a mail server at 192.168.1.10 and made its iptables rules to accept port 25 traffic.
-A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT
With netstat -nat
on the mail server I see it listens to :25
On my public machine, I added a
-A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT
-A PREROUTING -i eth1 -p tcp -m tcp --dport 25 -j DNAT --to-destination 192.168.1.10:25
rule, yet it does not listen to :25. My university does not allow traffic into its network through :25, so when I telnet locally I get a connection refused error. The university's relay mail server is supposed to relay e-mails to user@site.uni.tld to my mail server (at :25), yet the connection fails
----- Transcript of session follows -----
<user@site.uni.tld>... Deferred: Connection refused by site.uni.tld.
Warning: message still undelivered after 4 hours
Will keep trying until message is 2 weeks old
Final-Recipient: RFC822; user@site.uni.tld
Action: delayed
Status: 4.4.1
Remote-MTA: DNS; site.uni.tld
Any ideas why? The DNS records are fine and have been transferred to the uni relay servers.
iptables
rules is the virtualisation host on which the new mail server image is running. Is that right? If so, you will need aFORWARD
rule to ACCEPT the traffic, not anINPUT
one.iptables -L -nv
which shows hit counts next to each rule andtcpdump -n port 25
which shows packets arriving on port 25 before they are processed by the firewall.