I am having an issue where I cannot connect to an external OpenVPN server on UDP port 1194 from inside my network. Outside my network I can connect just fine, and can also connect to my own internal OpenVPN server from outside my network. The only explanation I can think of is that my Mikrotik is blocking/dropping my outgoing connection somehow. Any ideas how I can investigate this?
Start with Tools->Torch on WAN interface to see if udp/1194 packets are going out. If not, it’s most likely something in your firewall. If they do and none is coming back, they must get eaten somewhere else. Etc..
Turns out it was due to the NAT rule I had for my own internal OpenVPN server. Apparently you can’t connect to an external VPN if you have an incoming NAT rule for a VPN server using the same port? Using a different port for each resolves the issue.
I do have an IP address there. I was sanitizing my example out of habit. Probably unnecessary, I know. Or I could have just put a different address there. In any case I never said the rule itself didn’t work. I was just giving details in case someone with the same problem comes across this. My problem is fixed if I didn’t make that clear enough already.
Try reading it again. I was trying to explain that there’s absolutely no problem using same port for outgoing and incoming VPN at the same time, and the only requirement is correct dstnat rule. Which yours - unless you “sanitized out” whole dst-address parameter - wasn’t.
From this older post.. This is one of the bug i have. Like an android phone with a vpn provider work fine everywhere, but when connect in the mikrotik… vpn traffic is blocked.
so is it just adding this ?
Your rule suffers from same problem. If you take it apart:
action=dst-nat chain=dstnat - where it is and what it should do
to-addresses=192.168.0.146 to-ports=1196 - new destination
dst-port=1196 protocol=tcp - what packets it should apply to (original destination)
So in other words, it will take packets to :1196 and redirect them to 192.168.0.146:1196. Incoming, outgoing, it doesn’t matter, as long as destination port is 1196, everything will be sent to your internal server. Putting aside that 1196 is not standard VPN port, so it won’t matter for most services, you do want to specify original destination address. Either using dst-address= or dst-address-type=local could be good enough too.
Please be careful about wording I know what you wanted to say (incoming = received on WAN, outgoing = received elsewhere and intended to be transmitted via WAN), but less seasoned gents might misunderstand this as an information that dst-nat works in postrouting/output.
Well, indeed it look to be the case. I wasn’t sure to get it right. But at same time not much port look to work, but it should be quite standard as per all i find. Here’s what i got currently :
So it now says “redirect to 192.168.0.146 any TCP packet with dst port between 1197 and 1200 which goes to any other address than one of the Mikrotik’s own ones”.
So remove the exclamation mark to make the rule work only for packets meeting the other criteria but originally coming to one of Mikrotik’s own addresses, and you may be good.
The above is a solution if your problem is that you have one VPN server at home, for access to which this rule is intended, and another VPN server somewhere else and your VPN client at home cannot connect to that external server. If your actual problem is that the VPN client can connect to the VPN server at home from any other network than the one at home, the solution is different.
BTW, you don’t need the second rule in chain=forward of /ip firewall filter - it is shadowed by the first one which matches the same packets as the second one (plus some other ones too).
So i’ve spend the day on this again and so far i see it work for about 2 min, then drop… Like i remove all nat Same for the ipphone.. if plug on an old router it work, unplug old router and put on the rb4011, now ipphone do work and after like 10-20min it stop. And the vpn don’t work. For the vpn : purchase a vpn key 5$/month from nordvpn, somethingvpn.com… go to Starbuck cofee and lunch the softvpn : All work fine. Connect to the mikrotik and it cannot connect. Basically can i just open a port on the ipfilter and do nothing in the nat ? As currently having this :
should it be put in foward ? I have hard time to understand properly and not sure the rb4011 unit is working properly either. Or to better specify the wan as interface as the only foward .. or all in foward.. :