Community discussions

MikroTik App
 
kspr
just joined
Topic Author
Posts: 8
Joined: Fri Mar 07, 2025 10:17 am

Simple question about port forwarding

Sun Mar 30, 2025 6:49 pm

I defined port forwarding as below

add action=dst-nat chain=dstnat comment=PS5-TCP dst-address-list=WAN dst-port=987,8572,9295-9308 protocol=tcp to-addresses=192.168.81.108

Does this configuration mean that whatever comes to port 987 will go to address 192.168.81.108 ALWAYS on port 987 and e.g. whatever comes to port 9297 will go to address 192.168.81.108 ALWAYS on port 9297, and so on? Or do I need to create each mapping separately like below

add action=dst-nat chain=dstnat comment=PS5-TCP-987 dst-address-list=WAN dst-port=987 protocol=tcp to-addresses=192.168.81.108 to-ports=987
add action=dst-nat chain=dstnat comment=PS5-TCP-8572 dst-address-list=WAN dst-port=8572 protocol=tcp to-addresses=192.168.81.108 to-ports=8572
add action=dst-nat chain=dstnat comment=PS5-TCP-9295 dst-address-list=WAN dst-port=9295 protocol=tcp to-addresses=192.168.81.108 to-ports=9295
add action=dst-nat chain=dstnat comment=PS5-TCP-9296 dst-address-list=WAN dst-port=9296 protocol=tcp to-addresses=192.168.81.108 to-ports=9296
add action=dst-nat chain=dstnat comment=PS5-TCP-9296 dst-address-list=WAN dst-port=9297 protocol=tcp to-addresses=192.168.81.108 to-ports=9297
etc...
 
User avatar
Larsa
Forum Guru
Forum Guru
Posts: 1839
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa's Workshop

Re: Simple question about port forwarding

Sun Mar 30, 2025 8:21 pm

Yeah, your first rule is enough i.e. you don’t need to create each port mapping separately.

When you omit the to-ports parameter, Mikrotik ROS automatically assumes that the destination port on the internal IP (in your case, 192.168.81.108) should be the same as the one on the external request. So:

- Port 987 from WAN -> LAN 192.168.81.108:987
- Port 9297 from WAN -> LAN 192.168.81.108:9297
- And so on...

So your initial configuration does exactly what you're expecting. You only need separate rules if the external and internal port numbers differ.