RDP

Hi all - fairly new to Mirotik so would appreciate your assistance.

I have a Mikrotik router v6.27 running in VM with a public IP on the WAN interface. LAN IP of the fw is 10.254.5.254/24

Inside the LAN I have a windows 2012 server at 10.254.5.1/24

I am trying to configure the firewall to forward RDP traffic to 10.254.5.1 but I have not been able to get it to work. :frowning:

I can ping both sides of the vlan and the windows server is configured for remote access and has its firewall disabled. I can RDP to the same server from inside the LAN so I am confident that there are no issues with the windows machine.

Here is my current NAT config:

ip firewall nat print
Flags: X - disabled, I - invalid, D - dynamic
0 ;;; NAT rule to allow LAN access to Internet
chain=srcnat action=masquerade out-interface=ether1 log=no log-prefix=“”

1 ;;; Inbound Port Forward to 10.254.5.1:3389
chain=dstnat action=dst-nat to-addresses=10.254.5.1 to-ports=3389 protocol=tcp dst-address=xxx.xxx.xxx.xxx in-interface=ether1 dst-port=3389 log=no log-prefix=“”

note: xxx.xxx.xxx.xxx is my public IP.

I have copied this from another working firewall.

When I try to RDP to the public IP the rdp client fails to initiate a connection. A port scan shows that port 3389 is open but I can’t see in Winbox that there are any packets being processed by this rule.

I am wondering if I may have missed another setting in WinBox somewhere.

I would really appreciate any suggestions on how to resolve this or at least troubleshoot to the point I can find out where the problem is.

Cheers

NAT is OK. Post

/ip firewall filter print chain=input

/ip firewall filter print chain=input
Flags: X - disabled, I - invalid, D - dynamic
0 chain=input action=accept log=no log-prefix=“”

Hi, it look like the same issue that i have, and still struggling with if you have find a way to make this work please let me know

Thanks

Do you have the same rule in forward chain?

To be honest I don’t know enough about Mikrotik to give you an answer to that question!

Can you tell me where i should check in Winbox or what code I need to use in the terminal?

Appreciate your support n this!

Cheers

Do you get no connection occurring at all or a black screen? I had to clear the df bit in a mangle rule to get RDP working across a remote VPN subnet. If I didn’t I could ping and portscan but connecting just gave me a black screen. Sounds like you’re not quite getting that far though?

@normalcy - no not even getting a connection in the first place.

copy and paste the NAT and Filter, it will help us a lot.

/ip firewall filter export

and

/ip firewall nat export

here you go…

/ip firewall filter export

jul/24/2015 06:45:54 by RouterOS 6.22

software id = 19IQ-KBRL

/ip firewall filter
add chain=input



/ip firewall nat export

jul/24/2015 06:47:02 by RouterOS 6.22

software id = 19IQ-KBRL

/ip firewall nat
add action=masquerade chain=srcnat comment=“NAT rule to allow LAN access to Internet” out-interface=ether1
add action=dst-nat chain=dstnat comment=“Inbound Port Forward to 10.254.5.1:3389” dst-address=103.225.70.2 dst-port=3389 in-interface=ether1 protocol=tcp to-addresses=10.254.5.1 to-ports=3389

I think your setup, while very insecure, is working. But you just don’t have access from the LAN.

Try this:

/ip firewall nat
add action=masquerade chain=srcnat dst-address=10.254.5.0/24 out-interface=ether2 src-address=10.254.5.0/24 place-before=0

I think that will get you what you are looking for.

@IntrusDave

that looks to be exactly the fix I needed. I can now access the internal host via RDP - many thanks!

I take note of your comment that the current config is very insecure. Since I am only just starting with Mikrotik I am more than happy to hear any recommendations you might like to provide. Or if you can point me in the right direction of anything documenting best practice I’d really appreciate it. I will need to roll out more of these in the near future and want to build a standard config I can basically copy & paste.

Thanks for your help to resolve my initial problem - :slight_smile:

Cheers

First place to learn about RouterOS is Mikrotik Wiki, there are many examples. About firewall here

Head over to this topic. This is my Blacklist and firewall rules. I think just the last two rules in the filter will need to be changed for you, my internet interfaces are called “WAN1” and “WAN2”. Yours is “ether1”. if you adjust them for your situation, it will provide you with a pretty secure unit.

http://forum.mikrotik.com/t/blacklist-filter-update-script/89817/1

But also, read up on the Wiki, so you can understand what the script and rules are doing.

@karlisi, @InrtusDave

Thanks for your great support and pointers! Looks like I have more studying to do.

Cheers

Hey all - just further to my original question if I may…

I have RDP working fine however I have noticed that I am not able to RDP to the host via the public IP when I am on the same public IP. To be honest I don’t have a reason to actually access the server via the public IP when I am inside my network however I figure there is something here that I can learn more about.

My question then is: what do I need to do to allow the fw to process incoming requests from the same IP?

Hoping someone can educate me on this!

Cheers

It sounds like you want to read about hairpin NAT.

@sob - yes I think you are right. thanks for pointing me in the right direction.

Cheers

Thanx also! I was also thinking what haipin nat is about and tonight i just figure out!!!

I am still struggling getting my NAT working. I understand hairpin NAT better now but not able to get it working with my network configuration as per the diagram below
Network Diagram.png
I am trying to get access to the device at 10.254.5.1 from the 10.1.10.0/24 subnet.

My current config is:

0 ;;; NAT rule to allow LAN access to Internet
chain=srcnat action=masquerade out-interface=WAN log=no log-prefix=“”

1 ;;; RDP to dc1
chain=dstnat action=dst-nat to-addresses=10.254.5.1 to-ports=3389 protocol=tcp dst-address=1.1.1.1 dst-address-type=local in-interface=WAN dst-port=3389 connection-type=“” log=no log-prefix=“”

2 ;;; LDAP [389] to dc1
chain=dstnat action=dst-nat to-addresses=10.254.5.1 to-ports=389 protocol=tcp dst-address=1.1.1.1 in-interface=WAN dst-port=389 log=no log-prefix=“”

3 ;;; TFTP to dc1
chain=dstnat action=dst-nat to-addresses=10.254.5.1 to-ports=69 protocol=udp dst-address=1.1.1.1 in-interface=WAN dst-port=69 log=no log-prefix=“”

4 ;;; NAT Internal Traffic
chain=srcnat action=masquerade protocol=tcp src-address=10.254.254.0/29 dst-address=10.254.5.1 out-interface=HIP-DC dst-port=3389 log=no log-prefix=“”



Rules 0 - 3 work fine but I don’t have rule 4 correct (obviously!).

Appreciate any suggestions where I have gone wrong with this.

Cheers