This has two problems -Hello
i think if you use dst-nat for you local clients to access your wan ip address you problem will be solved.check it..
Why not? Windows' RRAS could do it, my old asus router could do it.You cannot forward back to the same interface connection came into router.
But you create separate local network for server, with different IP range and connected to separate interface, and then forward there.
Wiki article was written by user "Fewi", and since I do not know for any other way to acknowledge his contribution I will do it here!@Andys
Follow this example:
http://wiki.mikrotik.com/wiki/Hairpin_NAT,
and use your DynDNS script to change '1.1.1.1' from above example to resolved 'myserv.dyndns.org'.
HTH,
/ip firewall address-list
add address=sam9s.synology.me list=host_synology
OK Done.You don't need a script, you can simply do:Unless you have some very old RouterOS version, in that case upgrade.Code: Select all/ip firewall address-list add address=sam9s.synology.me list=host_synology
Understood. Would open a new thread from here on and link it to any relevant old one if needed. Apologies for this time.And don't dig up such old threads. You know how many people will open it, start reading it from the beginning, think about the problem ... only to realize several minutes later that it's all just history? If you think the old thread is relevant, it's better to just link to it from yours.
/ip firewall address-list
add address=sam9s.synology.me list=host_synology
OK and what constitues to correct DNS. I have not changed anything there so whatever entry is there is there by default ...You should add address list entry exactly as said, using DNS name not IP addressIf router have correct DNS entries (IP -> DNS), it will resolve IP address and add them to this entry.Code: Select all/ip firewall address-list add address=sam9s.synology.me list=host_synology
Then address_list will work correctly.
No there was no specific reason, if there was another way to do it, which someone had suggested before I ran in this thread I would have opted the same, none the less, that issue was resolved. However that was part one of the entire problem. (if you read my posts)Hello,
Is there a specific reason you want to approach this with a hairpin NAT?
Personally, I have entries in my local DNS servers to resolve the respective FQDN to their LAN address.
/ip firewall nat
add action=dst-nat chain=dstnat dst-address-type=local dst-address=!192.168.88.1 dst-port=80 protocol=tcp to-addresses=192.168.88.100
/ip firewall nat
add action=masquerade chain=srcnat dst-address=192.168.88.0/24 out-interface=<LAN> src-address=192.168.88.0/24
/ip firewall filter
add action=accept chain=forward connection-nat-state=dstnat
/ip dns static
add address=192.168.88.100 name=sam9s.synology.me
So if you don't enter dst-address=<WAN IP> at all, but instead use the above, the rule will always work, no matter how ofter will WAN address change.local - if dst-address is assigned to one of router's interfaces
Code: Select all
{
:local PublicIP [/ip cloud get public-address];
/ip firewall nat set 1,4,6,8 dst-address=$PublicIP
:log info "dst-address set to $PublicIP for NAT rules 1,4,6,8"
/ip firewall address-list add list=host_synology address=$PublicIP
:log info "Public address: $PublicIP added to host_synology list"
}
ok cool , are you sure it should be 1,4,6,8 and NOT 2,3,5,7, coz that where the dist-address needs to be updated to public IP, other than that, I get the script and might give it a try.The below script will update your firewall rules (1,4,6,8) to the Mikrotik Cloud public-address
It will also add it to your host_synology address list, as what was something you were looking to do earlier. You can remove bits and you see fit.
If you move the order of your NAT's, the script would have to be updated.
Also, I see you possibly have multiple rules for multiple ports, if the ports are the only difference, you can separate them by commas; 80,443,5000,5001
Code: Select all
{
:local PublicIP [/ip cloud get public-address];
/ip firewall nat set 1,4,6,8 dst-address=$PublicIP
:log info "dst-address set to $PublicIP for NAT rules 1,4,6,8"
/ip firewall address-list add list=host_synology address=$PublicIP
:log info "Public address: $PublicIP added to host_synology list"
}
dst-address=192.168.1.2 protocol=tcp dst-port=80
dst-address=192.168.1.0/24
Ok first of all it works!! , disabled all my previous rules and applied the ones you suggested and I was able to open web page using sam9s.synology.me from both LAN and WAN.What exactly you don't understand?
It's almost the same, the only difference is that article's masquerade rule has:while mine has:Code: Select alldst-address=192.168.1.2 protocol=tcp dst-port=80
So if you'd forward another port (e.g. 25 to 192.168.1.10:25), in first case you'd need to add another masquerade rule, because the first one is limited only to target 192.168.1.2:80. Mine covers everything in whole subnet.Code: Select alldst-address=192.168.1.0/24
Or if you mean dst-address-type=local vs. dst-address=WAN address in dstnat rule, I think it's simple and obvious. I'd gladly explain it better, but I'm not sure how.
Apologies, yes.ok cool , are you sure it should be 1,4,6,8 and NOT 2,3,5,7, coz that where the dist-address needs to be updated to public IP, other than that, I get the script and might give it a try.