Hi,
I´m a newbe and try to get my internal SMTP server working
The server has an nat address 192.168.88.233 and use port 25 for incoming and outgoing email
In my router OS I defined the rules below, so incoming E-mail is received on my server.
Outgoing email is not working, I think I need to configure something in the firewall , but I don´t know what.
Nat rule: chain=dstnat, protocol=tcp, dst.port=25, action=dst-nat, to address=192.168.88.233, to ports=25
Remove all your current rules from Firewall and NAT and use these. Study them to get an idea of what it is doing. Change ether-LAN and ether-WAN to match yours (probably ether2 ~ ether1). #Router and internal network protection, internal servers, LAN is friendly
/ip firewall filter
add chain=input action=drop connection-state=invalid comment=“Disallow weird packets”
add chain=input action=accept connection-state=new in-interface=ether-LAN comment=“Allow LAN access to the router itself”
add chain=input action=accept connection-state=established comment=" ^^ that originated from LAN"
add chain=input action=accept connection-state=related comment=" ^^ that originated from LAN"
add chain=input action=accept protocol=icmp comment=“Allow ping ICMP from anywhere”
add chain=input action=drop comment=“Disallow anything from anywhere on any interface”
add chain=forward action=drop connection-state=invalid comment=“Disallow weird packets”
add chain=forward action=accept connection-state=new in-interface=ether-LAN comment=“Allow LAN access to move through the router”
add chain=forward action=accept connection-state=established comment=" ^^ that originated from LAN"
add chain=forward action=accept connection-state=related comment=" ^^ that originated from LAN"
add chain=forward action=accept protocol=tcp dst-port=25 comment=“Add a filter exception for port mapped server”
add chain=forward action=drop comment=“Disallow anything from anywhere on any interface”
Port Forward (map) to an internal LAN server.
/ip firewall nat add chain=srcnat action=masquerade out-interface=ether-WAN comment=“Turn on masquerading”
/ip firewall nat add chain=dstnat action=dst-nat protocol=tcp to-address=192.168.88.233 dst-port=25 to-port=25 comment=“Create an incoming port map rule”
In addition to the DST NAT rule you need to allow the traffic to 192.168.88.233 port 25 in the forwarding chain. Your mail server also typically needs to be using the RouterBoard as its default gateway and the forward chain needs to be allowing NEW outbound connections and RELATED & ESTABLISHED traffic inbound.
pcunit, thanks, I tried your advice but no success.
The drop on line 14 closed my internet connection from my pc, so I disabled that.
Email from internet are receiving on my exchange server at 192.168.88.233, but outgoing mail is not working
see my /export
MMM MMM KKK TTTTTTTTTTT KKK
MMMM MMMM KKK TTTTTTTTTTT KKK
MMM MMMM MMM III KKK KKK RRRRRR OOOOOO TTT III KKK KKK
MMM MM MMM III KKKKK RRR RRR OOO OOO TTT III KKKKK
MMM MMM III KKK KKK RRRRRR OOO OOO TTT III KKK KKK
MMM MMM III KKK KKK RRR RRR OOOOOO TTT III KKK KKK
you wrote - It is because you did not change line 4 and 10 to in-interface=bridge-local … line 17 needs to be out-interface=ether1-gateway
But all these settings was already done as you wrote, but still outgoing mail through port 25 from 192.168.88.233 is not working.
Does outbound email on port 25 work if not from the router? I use telnet to check the connection. From a computer:
telnet gmail-smtp-in.l.google.com 25
You should get a “220 mx.google.com ESMTP blahblahblah” message. If it doesn’t make the connection, your ISP might be blocking the connection to any email server but theirs.
I can do this from behind my router with no special firewall rules. HOWEVER, I had to contact my ISP (Cox Communications) first and have them open port 25 for my static public ips. It is a spam prevention measure they have implemented.
I tried telnet (is in dutch, it says no connection possible to port 25)
If I connect the server utp cable to my old router/modem (no firewall), mail outbound and inbound works.
C:\Users\Administrator>telnet gmail-smtp-in.l.google.com 25
Er wordt verbinding gemaakt met gmail-smtp-in.l.google.com…Kan geen verbinding
met de host maken, op poort 25: Het maken van de verbinding is mislukt
My email server required no special firewall rules in my router to send port 25 email (outbound). The only rule I needed was the dstnat rule you used in your first post, and that was only for receiving (inbound) email.
How do you have your srcnat/masquerade rules set on the router?
Are you certain the network settings on your email server are correct? I would check them again, especially the gateway.
edit: I had my email server set with a static ip. I see yours is issued by dhcp. I just found your masquerade rule in your post above. It looks good also. ??
My RouterOS (Mikrotik) has IP 192.168.88.1
If I connect the UTP cable of my server to the modem of my provider email outbound and inbound works fine
If I connect the UTP cable of the server to my Mikrotik router then only incoming email works, outbound doesn´t
DHCP is on at my server and made static in the Mikrotik router
masquerade rule: chain=srcnat, out.interface=ether1-gateway, action=masquerade
You should either supply you wan IP as dst-address or in-interface pointing your wan interface on your dst-nat rule for port 25.
Now all your traffic is hit, both in and outgoing. But only incoming should be translated