Port forwarding - problem

I only need to realize port forward from WAN to internal IP address 192.168.88.247; port 44158. I red all topics about problem, but nothing helps me…Here is my iconfig.
Can someone help me and sad where Im doing wrong ?

/ip firewall filter
add action=accept chain=forward connection-nat-state=dstnat connection-state=new in-interface=lte1
add action=accept chain=input connection-state=established,related
add action=drop chain=input connection-state=invalid
/ip firewall nat
add action=dst-nat chain=dstnat comment=Hel dst-port=44158 in-interface-list=WAN protocol=tcp to-addresses=192.168.88.247 to-ports=44158
add action=masquerade chain=srcnat out-interface=lte1 out-interface-list=WAN

Obviously you have more config than that. Please post your complete config. To export and paste your configuration (and I’m assuming you are using WebFig or Winbox), open a terminal window, and type (without the quotes) “/export hide-sensitive file=any-filename-you-wish”. Then open the files section and right click on the filename you created and select download in order to download the file to your computer. It will be a text file with whatever name you saved to with an extension of .rsc. Then in your message here, click the code display icon in the toolbar above the text entry (the code display icon is the 7th one from the left and looks like a square with a blob in the middle). Then paste the text from the file in between the two code words in brackets.

Agreed, its clear you need help with rules in general.
Please post config
/export hide-sensitive file=anynameyouwish

Q1. Are you only providing the server for EXTERNAL USERS/
Q2. Are there users on your LAN using the server, and if so how are they connecting to it (by LANIP?)
Q3. If by WANIP are they on the same subnet as the server?

First, thanks for help. Here is my code.
I provide this server only for external users. But when I check it on LAN (via telnet and LANIP) I saw the port is open.



# feb/24/2022 05:28:40 by RouterOS 7.1
# software id = 005S-1G8Z
#
# model = D53G-5HacD2HnD
# serial number = D7B10E08BA10
/interface bridge
add name=local
/interface wireless
set [ find default-name=wlan1 ] country=croatia disabled=no mode=ap-bridge \
    ssid=Grlica wireless-protocol=802.11
set [ find default-name=wlan2 ] country=croatia disabled=no frequency=5200 \
    mode=ap-bridge ssid="Grlica 5G" wireless-protocol=802.11
/interface list
add name=WAN
add name=LAN
/interface lte apn
add apn=internet.ht.hr default-route-distance=1 use-network-apn=no
/interface lte
set [ find ] allow-roaming=no apn-profiles=internet.ht.hr band=3 name=lte1
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa-psk,wpa2-psk eap-methods="" \
    mode=dynamic-keys supplicant-identity=MikroTik
/ip pool
add name=dhcp ranges=192.168.88.2-192.168.88.254
/ip dhcp-server
add address-pool=dhcp interface=local name=dhcp1
/interface bridge port
add bridge=local interface=ether2
add bridge=local interface=wlan1
add bridge=local interface=ether1
add bridge=local interface=ether3
add bridge=local interface=ether4
add bridge=local interface=ether5
add bridge=local interface=wlan2
/interface list member
add interface=lte1 list=WAN
add interface=local list=LAN
/ip address
add address=192.168.88.1/24 interface=local network=192.168.88.0
/ip cloud
set update-time=no
/ip dhcp-client
add disabled=yes
/ip dhcp-server lease
add address=192.168.88.247 client-id=1:e2:e1:a9:a:e1:73 mac-address=\
    E2:E1:A9:0A:E1:73 server=dhcp1
/ip dhcp-server network
add address=192.168.88.0/24 dns-server=192.168.88.1 gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes servers=192.168.88.1
/ip firewall filter
add action=accept chain=forward connection-nat-state=dstnat connection-state=\
    new in-interface=lte1
add action=accept chain=input connection-state=established,related
add action=drop chain=input connection-state=invalid
/ip firewall nat
add action=dst-nat chain=dstnat comment=Hel dst-port=44158 in-interface-list=\
    WAN protocol=tcp to-addresses=192.168.88.247 to-ports=44158
add action=masquerade chain=srcnat out-interface=lte1 out-interface-list=WAN
/ip service
set ftp disabled=yes
set ssh port=2222
set api disabled=yes
set winbox address=192.168.88.0/24
/ip ssh
set strong-crypto=yes
/system clock
set time-zone-name=Europe/Zagreb
/system identity
set name=Test_Router
/system routerboard settings
set cpu-frequency=auto
/tool bandwidth-server
set enabled=no

There is no error I can see in your config..

For this line you have duplication. ( you can use either ) but you dont need to use both… redundant.
add action=masquerade chain=srcnat out-interface=lte1 out-interface-list=WAN

add action=masquerade chain=srcnat out-interface=lte1
add action=masquerade chain=srcnat out-interface-list=WAN

Now it is normal for any port being DST-NATTED on mikrotik to show the port as EXISTING on a scan but it should show up CLOSED. So open is weird??
Try using an external port checker, the one I use is Gibsons. - https://www.grc.com/x/ne.dll?bh0bkyd2

Much better is to put a further limitation on the dst-nat rule by adding source address or source address list.
In other words, assuming you know who is using your server, they should provide you with their public IP or their dyndns type name so that you can create a source address list.
THen the port should not even show up on any scans.

Also your firewall rules are not very robust and not secure enough in general and should be fixed up.
Take a look at item B. from here - https://forum.mikrotik.com/viewtopic.php?t=182373

First of alll, thanks for you advice…I will remove dublicate line when I come home…

Then; the server is actually some blockchain miner, which needs to comunicate with whole blockchain users…so I havent source address and its no exist…
And I was doing testing with online port checker…
I will look to check firewall rules but first I must solve this problem…

[quote=thevayne post_id=915284 time=1645685133 user_id=198130]
[size=85]Hello,

I have 2 routers.

one with the <public_ip_5.x.x.x>

second one connects via a LAN cable to first one with the local ip: 192.168.1.150

the second one connected to a mikrotik vpn (the vpn local ip is: 192.168.73.150 and public_ip_141.x.x.x)

the second router/device is running a service on port tcp/44158

without the vpn connected, if I check the open port from <public_ip>:44158(first router which 44158 port forwarded) it says it’s open, but when the vpn is connected, if I check the mikrotik public_ip:44158 it says the port is closed and same for router one.

I’ve set the bellowing rule for Firewall/NAT on mikrotik:

action=dst-nat, chain=dstnat, protocol=tcp, dst port=44158, in-interface=eth1, to address=192.168.73.150, port=44158[/size]



do you have any suggestions?

Thank you
[/quote]
@thevayne - Yes start your own thread …

I try link wha 404 post…The post from anav…I do what he suggest (I think) (https://forum.mikrotik.com/viewtopic.php?t=179343)…via rule 6

a. Firewall Rule: add chain=forward action=accept connection-nat-state=dstnat
b. Source Nat Rule:

case1: Dynamic WANIP add chain=srcnat action=masquerade out-interface-list=WAN { will also work for fixed/static WANIPs but not as technically correct }
c. Destination Nat Rule:

case1: Dynamic WANIP add chain=dstnat action=dst-nat dst-port=xxxx protocol=yyy in-interface-list=WAN
to-addresses=IPof Server { to ports not required if same as dst-ports }

and get (I know maybe is some double…the last, but I try everything)…but nothing :frowning:

/ip firewall filter
add action=accept chain=forward connection-nat-state=dstnat
add action=accept chain=input connection-state=established,related
add action=drop chain=input connection-state=invalid
/ip firewall nat
add action=masquerade chain=srcnat out-interface-list=WAN
add action=dst-nat chain=dstnat dst-port=44158 in-interface-list=WAN protocol=tcp to-addresses=192.168.88.247
add action=masquerade chain=srcnat out-interface=lte1 out-interface-list=WAN

…and one strange thing what I notice…
whenn I start type orders/rules via terminal

add action… /action become red like it is invalid !?!

and the same when I try like anav suggest

add chain…

and that orders I cant implement throw terminal cos I got syntax error…That orders pass throw GUI inputs, but cant pass via terminal

Try using winbox as perhaps my syntax is not good enough/accurate for CLI

In terms of firewall rules, unplug the WAN Side ethernet cable and then delete all the firewall rules and start fresh!!!
Start with the first one and work your way down the list - https://forum.mikrotik.com/viewtopic.php?t=180838

Starting with …
add action=accept chain=input comment=“defconf: accept established,related,untracked” connection-state=established,related,untracked

and ending with …
add action=drop chain=forward

Keep the current SRCNAT AND DSTNAT RULES>

404Network…I tried what anav post…I wrote all…but I must remove the last drop cos with it I havent got internet…
But with all this nothing change…port is still closed

Hi Zulle, your talking to anav, :slight_smile: Was forced to use a temp nick for a week or so.

The only reason you are not getting internet is that you are missing a rule in the deafult setup I linked…

/ip firewall filter
{Input Chain}
add action=accept chain=input comment=“defconf: accept established,related,untracked” connection-state=established,related,untracked
add action=drop chain=input comment=“defconf: drop invalid” connection-state=invalid
add action=accept chain=input comment=“defconf: accept ICMP” protocol=icmp
add action=accept chain=input in-interface-list=LAN
add action=drop chain=input comment=“drop all else” *****
{forward chain}
add action=fasttrack-connection chain=forward comment=“defconf: fasttrack” connection-state=established,related
add action=accept chain=forward comment=“defconf: accept established,related, untracked” connection-state=established,related,untracked
add action=drop chain=forward comment=“defconf: drop invalid” connection-state=invalid

add action=accept chain=forward comment=“allow internet traffic” in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment=“allow port forwarding” connection-nat-state=dstnat
add action=drop chain=forward
/ip firewall nat
add action=masquerade chain=srcnat comment=“defconf: masquerade” out-interface-list=WAN

404Network…I do exactly what you post…There was only one little difference…
In

add action=fasttrack-connection chain=forward connection-state=
established,related hw-offload=yes GUI add that

and when I add that order on top of all order GUI comment “…special dummy rule to show fasttrack counters”
And below that GUI add
add chain=forward action=passthrough

Thats fine, if the gui is adding that… The order is important.
When ready to post config please do so.

# feb/24/2022 19:46:46 by RouterOS 7.1
# software id = 005S-1G8Z
#
# model = D53G-5HacD2HnD
# serial number = D7B10E08BA10
/interface bridge
add name=local
/interface wireless
set [ find default-name=wlan1 ] country=croatia disabled=no mode=ap-bridge \
    ssid=Grlica wireless-protocol=802.11
set [ find default-name=wlan2 ] band=5ghz-onlyac channel-width=20/40mhz-Ce \
    country=croatia disabled=no frequency=5200 mode=ap-bridge ssid=\
    "Grlica 5G" wireless-protocol=802.11
/interface list
add name=WAN
add name=LAN
/interface lte apn
add apn=internet.ht.hr default-route-distance=1 use-network-apn=no
/interface lte
set [ find ] allow-roaming=no apn-profiles=internet.ht.hr band=3 name=lte1
/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa-psk,wpa2-psk eap-methods="" \
    mode=dynamic-keys supplicant-identity=MikroTik
/ip pool
add name=dhcp ranges=192.168.88.2-192.168.88.254
/ip dhcp-server
add address-pool=dhcp interface=local name=dhcp1
/interface bridge port
add bridge=local interface=ether2
add bridge=local interface=wlan1
add bridge=local interface=ether1
add bridge=local interface=ether3
add bridge=local interface=ether4
add bridge=local interface=ether5
add bridge=local interface=wlan2
/interface list member
add interface=lte1 list=WAN
add interface=local list=LAN
/ip address
add address=192.168.88.1/24 interface=local network=192.168.88.0
/ip cloud
set update-time=no
/ip dhcp-client
add disabled=yes
/ip dhcp-server lease
add address=192.168.88.247 client-id=1:e2:e1:a9:a:e1:73 mac-address=\
    E2:E1:A9:0A:E1:73 server=dhcp1
/ip dhcp-server network
add address=192.168.88.0/24 dns-server=192.168.88.1 gateway=192.168.88.1
/ip dns
set allow-remote-requests=yes servers=192.168.88.1
/ip firewall filter
add action=accept chain=forward connection-nat-state=dstnat disabled=yes
add action=accept chain=input connection-state=established,related disabled=\
    yes
add action=drop chain=input connection-state=invalid disabled=yes
add action=accept chain=input connection-state=established,related,untracked
add action=drop chain=input connection-state=invalid
add action=accept chain=input protocol=icmp
add action=accept chain=input in-interface-list=LAN
add action=drop chain=input
add action=fasttrack-connection chain=forward connection-state=\
    established,related hw-offload=yes
add action=accept chain=forward connection-state=\
    established,related,untracked
add action=drop chain=forward connection-state=invalid
add action=accept chain=forward in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward connection-nat-state=dstnat
add action=drop chain=forward disabled=yes
/ip firewall nat
add action=dst-nat chain=dstnat disabled=yes dst-port=44158 \
    in-interface-list=WAN protocol=tcp to-addresses=192.168.88.247
add action=masquerade chain=srcnat out-interface=lte1 out-interface-list=WAN
add action=dst-nat chain=dstnat dst-port=44158 in-interface-list=WAN \
    protocol=tcp to-addresses=192.168.88.247
/ip service
set ftp disabled=yes
set ssh port=2222
set api disabled=yes
set winbox address=192.168.88.0/24
/ip ssh
set strong-crypto=yes
/system clock
set time-zone-name=Europe/Zagreb
/system identity
set name=Test_Router
/system routerboard settings
set cpu-frequency=auto
/tool bandwidth-server
set enabled=no

Dont see anything that is of concern.

I would add some servers, and no need to add the 192.168.88.1 as its already noted in your ip dhcp network
/ip dns
from
set allow-remote-requests=yes servers=192.168.88.1
to
set allow-remote-requests=yes servers=1.1.1.1,9.9.9.9

Cleaned up a bit, correct order, enabled some, removed some duplicates etc…

/ip firewall filter
add action=accept chain=input connection-state=established,related,untracked
add action=drop chain=input connection-state=invalid
add action=accept chain=input protocol=icmp
add action=accept chain=input in-interface-list=LAN
add action=drop chain=input
add action=fasttrack-connection chain=forward connection-state=\
    established,related hw-offload=yes
add action=accept chain=forward connection-state=\
    established,related,untracked
add action=drop chain=forward connection-state=invalid
add action=accept chain=forward in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward connection-nat-state=dstnat
add action=drop chain=forward
/ip firewall nat
add action=masquerade chain=srcnat  out-interface-list=WAN
add action=dst-nat chain=dstnat dst-port=44158 in-interface-list=WAN \
    protocol=tcp to-addresses=192.168.88.247

Nothing with changing DNS :frowning:

I am starting to suspect you are not getting a public IP on your connection.
Can you read this section below and attempt to find out - https://forum.mikrotik.com/viewtopic.php?t=179343

5. PUBLIC IP

$04Network…I dont understand…how can I surf on internet without public IP ?

Hey, I red that…
I look at my public IP in browser. On port checker. But it isnt the same with one in Address list…In that list is some kind of private address…some like 10.x,y,z
I cant see now cos Im not home…but I will post

404Network…I red my local forums and see that my mobile operater uses CGNAT…Im now know why this cant work…Many people on forum call ISP provider to give possibility to implement port forwarding but nothing…Is there some solution vai VPN ?