My blind shot would be to bind the Mikrotik www service to another port than 80 on top/instead of disabling it if the ISP is not the reason.I have disabled the mikrotik web service. I try to disable hotspot. But all are not working.
I've always thought the same but my confidence was shaken recently by some post here. Mabe I've mixed things up and ithe exception was specific to mac-telnet. Anyway, that's why I've called it a blind shotBut you know it doesn't conflict, dstnat "wins" over local service.
I tried to change the rule for 40080 to 88, it worked. However, if I change it to 80, the browser cannot connect to my nginx. The rule counter does increase if I try to connect via browser but the nginx log show nothing.If you successfully forwarded two ports, it's likely that you forwarded third one correctly too. If you take the original rule for 40080, the only change from that is that the new one has dst-port=80. Watch the rule's counter, if you make requests from outside and it doesn't increase, it might be your ISP blocking incoming connections. Luckily I've never met such ISP myself, but some don't like home users to run servers.
I already disable the www service since I only use winbox. Moreover, I already change the www service port to 10080 to be sure, but I still cannot access port 80 from internet.My blind shot would be to bind the Mikrotik www service to another port than 80 on top/instead of disabling it if the ISP is not the reason.I have disabled the mikrotik web service. I try to disable hotspot. But all are not working.
I'm tempted to ask if you are testing this from inside your LAN ?I already disable the www service since I only use winbox. Moreover, I already change the www service port to 10080 to be sure, but I still cannot access port 80 from internet.My blind shot would be to bind the Mikrotik www service to another port than 80 on top/instead of disabling it if the ISP is not the reason.I have disabled the mikrotik web service. I try to disable hotspot. But all are not working.
chain=prerouting action=passthrough protocol=tcp dst-port=80 dst-address=your.pub.lic.ip
/ip firewall raw
Next step where it can fail is router's firewall filter, forward chain. Is there any rule that can block the connection? If not, it should pass and you should see packets leaving towards server. You should be able to see them using Tools->Torch on router's LAN interface, or you can add logging rule to postrouting. If this happens successfully, then normally it would be server's fault if it didn't work. But it shouldn't happen in this case, when you already forwarded another external port to same internal port and it worked.The rule counter does increase if I try to connect via browser but the nginx log show nothing.
No, I test this using LTE on my phone. The Haripin NAT (if I understand correctly, masquerade action on src-nat chain?) on port 80 also not work after I try to set in up. The counter does not go up when I try to connect form LAN with my domain name.I'm tempted to ask if you are testing this from inside your LAN ?I already disable the www service since I only use winbox. Moreover, I already change the www service port to 10080 to be sure, but I still cannot access port 80 from internet.My blind shot would be to bind the Mikrotik www service to another port than 80 on top/instead of disabling it if the ISP is not the reason.I have disabled the mikrotik web service. I try to disable hotspot. But all are not working.
This would mean you have to setup Hairpin NAT.
In the firewall filter, I have only default rules. I tried to disable them one by one, but port 80 still not accessible.Next step where it can fail is router's firewall filter, forward chain. Is there any rule that can block the connection? If not, it should pass and you should see packets leaving towards server. You should be able to see them using Tools->Torch on router's LAN interface, or you can add logging rule to postrouting. If this happens successfully, then normally it would be server's fault if it didn't work. But it shouldn't happen in this case, when you already forwarded another external port to same internal port and it worked.The rule counter does increase if I try to connect via browser but the nginx log show nothing.
export hide-sensitive
my.public.ip.1
filter-interface=your-wan-if,your-lan-if filter-ip-protocol=tcp filter-port=80,40080 filter-operator-between-entries=and
dstnat
filter
/tool torch
dst-port
SYN
SYN.ACK
Hi,I'm afraid you'll have to post the output ofafter replacing each occurrence of any public IP you do not want to reveal by a distinctive pattern likeCode: Select allexport hide-sensitive
Code: Select allmy.public.ip.1
And at this stage I would use packet sniffing at both interfaces simultaneously into a file, with filters set toto reduce the volume of saved data, and use Wireshark to see what actually happens to the packet as it passes through the 'Tik. Because what you wrote so far suggests that theCode: Select allfilter-interface=your-wan-if,your-lan-if filter-ip-protocol=tcp filter-port=80,40080 filter-operator-between-entries=and
andCode: Select alldstnat
do what you want them to (as not only rule counters show the packets to be coming but alsoCode: Select allfilter
shows the packet at the output interface with the correctly modifiedCode: Select all/tool torch
) but possibly something else happens to the packet. Or maybe only theCode: Select alldst-port
packet gets through but not the following ones, because you either filter them directly or they never come from the client because you don't allow theCode: Select allSYN
response back to the client, so the nginx gets no application data as the TCP session is not completely established.Code: Select allSYN.ACK
# may/02/2018 11:20:35 by RouterOS 6.42.1
# software id = M17Z-QURP
#
# model = RouterBOARD 3011UiAS
# serial number = ***
/interface bridge
add admin-mac=*** auto-mac=no comment=defconf fast-forward=no \
name=bridge priority=0x9000
/interface ethernet
set [ find default-name=ether1 ] mac-address=***
set [ find default-name=ether2 ] name=ether2-master
set [ find default-name=ether6 ] name=ether6-master
set [ find default-name=sfp1 ] auto-negotiation=no l2mtu=1598 mac-address=\
*** rx-flow-control=on tx-flow-control=on
/interface pppoe-client
add add-default-route=yes default-route-distance=0 disabled=no interface=ether1 \
keepalive-timeout=disabled max-mru=1492 max-mtu=1492 name=\
pppoe-3bbfttx-ether1 user=***
/interface vlan
add disabled=yes interface=sfp1 name=vlan_33_sfp vlan-id=33
/interface pppoe-client
add add-default-route=yes default-route-distance=0 interface=vlan_33_sfp \
keepalive-timeout=disabled max-mru=1492 max-mtu=1492 name=pppoe-3bbfttx-sfp \
user=***
/interface list
add exclude=dynamic name=discover
add name=mactel
add name=mac-winbox
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
add hotspot-address=192.168.88.100 html-directory="" login-by=\
http-chap,http-pap name=hotspot1 use-radius=yes
/ip hotspot
add disabled=no idle-timeout=none interface=bridge name=hotspot_server profile=\
hotspot1
/ip pool
add name=dhcp ranges=10.200.0.11-10.255.255.254
add name=ippool1 ranges=10.215.0.1-10.215.0.254
/ip dhcp-server
add address-pool=ippool1 authoritative=after-2sec-delay interface=bridge name=\
defconf
add address-pool=ippool1 authoritative=after-2sec-delay disabled=no interface=\
bridge lease-time=3h name=dhcp1 use-radius=yes
/snmp community
set [ find default=yes ] addresses=0.0.0.0/0
/system logging action
set 1 disk-file-count=1000
/interface bridge port
add bridge=bridge comment=defconf interface=ether2-master
add bridge=bridge comment=defconf interface=ether6-master
add bridge=bridge comment=defconf hw=no interface=sfp1
add bridge=bridge disabled=yes interface=ether1
add bridge=bridge interface=ether3
add bridge=bridge interface=ether4
add bridge=bridge interface=ether5
add bridge=bridge interface=ether7
add bridge=bridge interface=ether8
add bridge=bridge interface=ether9
add bridge=bridge interface=ether10
/ip neighbor discovery-settings
set discover-interface-list=none
/interface list member
add interface=ether2-master list=discover
add interface=ether3 list=discover
add interface=ether4 list=discover
add interface=ether5 list=discover
add interface=sfp1 list=discover
add interface=ether6-master list=discover
add interface=ether7 list=discover
add interface=ether8 list=discover
add interface=ether9 list=discover
add interface=ether10 list=discover
add interface=bridge list=discover
add interface=pppoe-3bbfttx-ether1 list=discover
add interface=vlan_33_sfp list=discover
add interface=pppoe-3bbfttx-sfp list=discover
add interface=ether2-master list=mactel
add interface=ether6-master list=mactel
add interface=ether2-master list=mac-winbox
add interface=sfp1 list=mactel
add interface=ether6-master list=mac-winbox
add interface=sfp1 list=mac-winbox
/ip address
add address=my.mikrotik.ip/10 comment=defconf interface=bridge network=10.192.0.0
/ip cloud
set ddns-enabled=yes update-time=no
/ip dhcp-client
add comment=defconf dhcp-options=hostname,clientid disabled=no interface=ether1
/ip dhcp-server network
add address=10.192.0.0/10 comment=defconf dns-server=1.1.1.1,8.8.8.8,8.8.4.4 \
gateway=my.mikrotik.ip
/ip dns
set allow-remote-requests=yes servers=1.1.1.1,8.8.8.8
/ip dns static
add address=my.mikrotik.ip name=router
add address=my.home.server name=mainserver.local
/ip firewall filter
add action=passthrough chain=unused-hs-chain comment="place hotspot rules here" \
disabled=yes
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" \
connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related" \
connection-state=established,related
add action=drop chain=forward comment="defconf: drop invalid" connection-state=\
invalid
add action=drop chain=forward comment=\
"defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat \
connection-state=new in-interface=ether1
add action=accept chain=input protocol=icmp
add action=accept chain=input connection-state=established
add action=accept chain=input connection-state=related
add action=drop chain=input in-interface=pppoe-3bbfttx-ether1
/ip firewall nat
add action=passthrough chain=unused-hs-chain comment="place hotspot rules here" \
disabled=yes
# no interface
add action=masquerade chain=srcnat comment="defconf: masquerade" out-interface=\
*F
add action=masquerade chain=srcnat out-interface=pppoe-3bbfttx-ether1
add action=dst-nat chain=dstnat dst-port=80 in-interface=pppoe-3bbfttx-ether1 \
log=yes log-prefix=TEST protocol=tcp to-addresses=my.home.server to-ports=40080
add action=dst-nat chain=dstnat dst-port=20080 protocol=tcp to-addresses=\
my.home.server to-ports=80
add action=dst-nat chain=dstnat disabled=yes dst-port=11111 log=yes protocol=\
tcp to-addresses=my.home.server to-ports=11111
add action=dst-nat chain=dstnat dst-port=55557 protocol=tcp to-addresses=\
my.home.server to-ports=55557
add action=dst-nat chain=dstnat dst-port=55557 protocol=udp to-addresses=\
my.home.server to-ports=55557
add action=dst-nat chain=dstnat dst-port=8008 protocol=tcp to-addresses=\
my.home.server to-ports=8008
add action=dst-nat chain=dstnat dst-port=8009 protocol=tcp to-addresses=\
my.home.server to-ports=8009
add action=dst-nat chain=dstnat dst-port=9091 protocol=tcp to-addresses=\
my.home.server to-ports=9091
add action=dst-nat chain=dstnat dst-port=*** log=yes protocol=tcp \
to-addresses=my.home.server to-ports=22
add action=dst-nat chain=dstnat dst-port=8443 protocol=tcp to-addresses=\
my.home.server to-ports=8443
add action=dst-nat chain=dstnat dst-port=5201 protocol=tcp to-addresses=\
my.home.server to-ports=5201
add action=dst-nat chain=dstnat dst-port=40080 log-prefix=TEST2 protocol=tcp \
to-addresses=my.home.server to-ports=40080
add action=masquerade chain=srcnat dst-address=my.home.server dst-port=8008 \
protocol=tcp src-address=10.0.0.0/8
add action=masquerade chain=srcnat dst-address=my.onu.modem out-interface=ether1 \
src-address=10.192.0.0/10
add action=masquerade chain=srcnat dst-address=my.home.server dst-port=5201 \
protocol=tcp src-address=10.0.0.0/8
add action=masquerade chain=srcnat dst-address=my.home.server dst-port=8443 \
protocol=tcp src-address=10.0.0.0/8
add action=dst-nat chain=dstnat dst-port=8000 protocol=tcp to-addresses=\
a.device to-ports=8000
add action=masquerade chain=srcnat dst-address=a.device dst-port=8000 \
protocol=tcp src-address=10.0.0.0/8
add action=dst-nat chain=dstnat dst-port=11940 protocol=tcp to-addresses=\
my.home.server to-ports=11940
add action=masquerade chain=srcnat disabled=yes dst-address=my.home.server \
dst-port=80 protocol=tcp src-address=10.192.0.0/10 to-ports=80
/ip hotspot ip-binding
***
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www disabled=yes port=10080
set ssh disabled=yes
set www-ssl port=10443
set api disabled=yes
set winbox address=10.192.0.0/10
set api-ssl disabled=yes
/ip upnp
set allow-disable-external-interface=yes enabled=yes
/ip upnp interfaces
add interface=ether2-master type=internal
add interface=ether6-master type=internal
/lcd
set time-interval=hour
/lcd pin
set pin-number=1379
/radius
add address=my.home.server service=ppp,hotspot,wireless,dhcp
/system clock
set time-zone-name=Asia/Bangkok
/system identity
set name=main-router
/system logging
set 0 action=disk
set 1 action=disk
set 2 action=disk
add action=disk topics=critical
add action=disk disabled=yes topics=dhcp
add action=disk topics=hotspot
add action=disk topics=radius
add action=disk disabled=yes topics=pppoe
add action=disk topics=script
add action=disk topics=firewall
/system ntp client
set enabled=yes primary-ntp=*** server-dns-names=***
/system routerboard settings
set silent-boot=no
/system scheduler
add interval=10m name=noip-updater on-event=noip-nat policy=\
read,write,policy,test,password,sensitive start-date=dec/28/2016 \
start-time=12:38:40
/system script
***
/tool mac-server
set allowed-interface-list=none
/tool mac-server mac-winbox
set allowed-interface-list=mac-winbox
/tool mac-server ping
set enabled=no
/tool traffic-monitor
add disabled=yes interface=ether1 name=tmon1 threshold=0 traffic=receive
TEST dsnnat: in :pppoe-3bbfttx-ether1 out:(unknow 0), proto TCP (SYN), my.lte.ip:xxx->my.public.ip:80, len 60
One thing which is probably unrelated to the topics but should be fixed as I have no idea what it may do is the rule inBelow is my config from export command.
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" out-interface=*F
out-interface
in-interface
ether1
/ip firewall nat print
/ip firewall filter print
/ip firewall mangle print
What may not be obvious at first glance is that theI want to add the NAT rule log for more information. These logs are shown when I try to connect to port 80 using my phone.Code: Select allTEST dsnnat: in :pppoe-3bbfttx-ether1 out:(unknow 0), proto TCP (SYN), my.lte.ip:xxx->my.public.ip:80, len 60
nat
SYN
log=yes
dst-nat
/ip firewall mangle
add chain=postrouting action=log protocol=tcp dst-address=internal.ip.of.the.server dst-port=40080 log-prefix="to server: "
add chain=prerouting action=log protocol=tcp src-address=internal.ip.of.the.server src-port=40080 log-prefix="from server: "
mangle
SYN
dst-nat
18:32:20 firewall,info dst-nat rule 40080: dstnat: in:pppoe-3bbfttx-ether1 out:(unknown 0), proto TCP (SYN), my.lte.ip:46964->mikrotik.public.ip:40080, len 60
18:32:20 firewall,info to server: postrouting: in:(unknown 0) out:bridge, proto TCP (SYN), my.lte.ip:46964->my.home.server:40080, NAT my.lte.ip:46964->(mikrotik.public.ip:40080->my.home.server:40080), len 60
18:32:20 firewall,info from server: prerouting: in:bridge out:(unknown 0), src-mac ***, proto TCP (SYN,ACK), my.home.server:40080->my.lte.ip:46964, NAT (my.home.server:40080->mikrotik.public.ip:40080)->my.lte.ip:46964, len 60
18:32:20 firewall,info to server: postrouting: in:(unknown 0) out:bridge, src-mac ***, proto TCP (ACK), my.lte.ip:46964->my.home.server:40080, NAT my.lte.ip:46964->(mikrotik.public.ip:40080->my.home.server:40080), len 52
18:33:25 firewall,info from server: prerouting: in:bridge out:(unknown 0), src-mac ***, proto TCP (ACK,FIN), my.home.server:40080->my.lte.ip:46964, NAT (my.home.server:40080->mikrotik.public.ip:40080)->my.lte.ip:46964, len 52
18:33:25 firewall,info to server: postrouting: in:(unknown 0) out:bridge, src-mac ***, proto TCP (ACK,FIN), my.lte.ip:46964->my.home.server:40080, NAT my.lte.ip:46964->(mikrotik.public.ip:40080->my.home.server:40080), len 52
18:33:25 firewall,info from server: prerouting: in:bridge out:(unknown 0), src-mac ***, proto TCP (ACK), my.home.server:40080->my.lte.ip:46964, NAT (my.home.server:40080->mikrotik.public.ip:40080)->my.lte.ip:46964, len 52
18:36:44 firewall,info "dst-nat rule 80: " dstnat: in:pppoe-3bbfttx-ether1 out:(unknown 0), proto TCP (SYN), my.lte.ip3:36185->mikrotik.public.ip:80, len 60
18:36:44 firewall,info to server: postrouting: in:(unknown 0) out:bridge, proto TCP (SYN), my.lte.ip3:36185->my.home.server:40080, NAT my.lte.ip:36185->(mikrotik.public.ip:80->my.home.server:40080), len 60
18:36:44 firewall,info from server: prerouting: in:bridge out:(unknown 0), src-mac ***, proto TCP (SYN,ACK), my.home.server:40080->my.lte.ip3:36185, NAT (my.home.server:40080->mikrotik.public.ip:80)->my.lte.ip:36185, len 60
18:36:45 firewall,info from server: prerouting: in:bridge out:(unknown 0), src-mac ***, proto TCP (SYN,ACK), my.home.server:40080->my.lte.ip3:36185, NAT (my.home.server:40080->mikrotik.public.ip:80)->my.lte.ip:36185, len 60
18:36:45 firewall,info to server: postrouting: in:(unknown 0) out:bridge, proto TCP (SYN), my.lte.ip3:36185->my.home.server:40080, NAT my.lte.ip3:36185->(mikrotik.public.ip:80->my.home.server:40080), len 60
18:36:45 firewall,info from server: prerouting: in:bridge out:(unknown 0), src-mac ***, proto TCP (SYN,ACK), my.home.server:40080->my.lte.ip3:36185, NAT (my.home.server:40080->mikrotik.public.ip:80)->my.lte.ip:36185, len 60
18:36:47 firewall,info from server: prerouting: in:bridge out:(unknown 0), src-mac ***, proto TCP (SYN,ACK), my.home.server:40080->my.lte.ip3:36185, NAT (my.home.server:40080->mikrotik.public.ip:80)->my.lte.ip:36185, len 60
18:36:47 firewall,info to server: postrouting: in:(unknown 0) out:bridge, proto TCP (SYN), my.lte.ip3:36185->my.home.server:40080, NAT my.lte.ip:36185->(mikrotik.public.ip:80->my.home.server:40080), len 60
18:36:47 firewall,info from server: prerouting: in:bridge out:(unknown 0), src-mac ***, proto TCP (SYN,ACK), my.home.server:40080->my.lte.ip3:36185, NAT (my.home.server:40080->mikrotik.public.ip:80)->my.lte.ip:36185, len 60
0 D chain=dstnat action=jump jump-target=hotspot hotspot=from-client
1 D chain=hotspot action=jump jump-target=pre-hotspot
2 D chain=hotspot action=redirect to-ports=64872 protocol=udp dst-port=53
3 D chain=hotspot action=redirect to-ports=64872 protocol=tcp dst-port=53
4 D chain=hotspot action=redirect to-ports=64873 protocol=tcp hotspot=local-dst dst-port=80
5 D chain=hotspot action=redirect to-ports=64875 protocol=tcp hotspot=local-dst dst-port=443
6 D chain=hotspot action=jump jump-target=hs-unauth protocol=tcp hotspot=!auth
7 D chain=hotspot action=jump jump-target=hs-auth protocol=tcp hotspot=auth
8 D chain=hs-unauth action=redirect to-ports=64874 protocol=tcp dst-port=80
9 D chain=hs-unauth action=redirect to-ports=64874 protocol=tcp dst-port=3128
10 D chain=hs-unauth action=redirect to-ports=64874 protocol=tcp dst-port=8080
11 D chain=hs-unauth action=redirect to-ports=64875 protocol=tcp dst-port=443
12 D chain=hs-unauth action=jump jump-target=hs-smtp protocol=tcp dst-port=25
13 D chain=hs-auth action=redirect to-ports=64874 protocol=tcp hotspot=http
14 D chain=hs-auth action=jump jump-target=hs-smtp protocol=tcp dst-port=25
15 X ;;; place hotspot rules here
chain=unused-hs-chain action=passthrough
16 chain=srcnat action=masquerade out-interface=pppoe-3bbfttx-ether1 log=no log-prefix=""
17 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=40080 protocol=tcp in-interface=pppoe-3bbfttx-ether1 dst-port=80 log=yes
log-prefix=""dst-nat rule 80: ""
18 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=80 protocol=tcp dst-port=20080 log=no log-prefix=""
19 X chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=11111 protocol=tcp dst-port=11111 log=yes log-prefix=""
20 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=55557 protocol=tcp dst-port=55557 log=no log-prefix=""
21 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=55557 protocol=udp dst-port=55557 log=no log-prefix=""
22 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=8008 protocol=tcp dst-port=8008 log=no log-prefix=""
23 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=8009 protocol=tcp dst-port=8009 log=no log-prefix=""
24 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=9091 protocol=tcp dst-port=9091 log=no log-prefix=""
25 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=22 protocol=tcp src-address-list=!blacklist dst-port=22000 log=yes log-prefix="server-ssh:"
26 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=8443 protocol=tcp dst-port=8443 log=no log-prefix=""
27 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=5201 protocol=tcp dst-port=5201 log=no log-prefix=""
28 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=40080 protocol=tcp dst-port=40080 log=yes log-prefix="dst-nat rule 40080: "
29 chain=srcnat action=masquerade protocol=tcp src-address=10.0.0.0/8 dst-address=my.home.server dst-port=8008 log=no log-prefix=""
30 chain=srcnat action=masquerade src-address=10.192.0.0/10 dst-address=my.onu.ip out-interface=ether1 log=no log-prefix=""
31 chain=srcnat action=masquerade protocol=tcp src-address=10.0.0.0/8 dst-address=my.home.server dst-port=5201 log=no log-prefix=""
32 chain=srcnat action=masquerade protocol=tcp src-address=10.0.0.0/8 dst-address=my.home.server dst-port=8443 log=no log-prefix=""
33 chain=dstnat action=dst-nat to-addresses=my.device to-ports=8000 protocol=tcp dst-port=8000 log=no log-prefix=""
34 chain=srcnat action=masquerade protocol=tcp src-address=10.0.0.0/8 dst-address=my.device dst-port=8000 log=no log-prefix=""
35 chain=dstnat action=dst-nat to-addresses=my.home.server to-ports=11940 protocol=tcp dst-port=11940 log=yes log-prefix="server-pvpn: "
36 X chain=srcnat action=masquerade to-ports=80 protocol=tcp src-address=10.192.0.0/10 dst-address=my.home.server dst-port=80 log=no log-prefix=""
0 D ;;; special dummy rule to show fasttrack counters
chain=forward action=passthrough
1 D chain=forward action=jump jump-target=hs-unauth hotspot=from-client,!auth
2 D chain=forward action=jump jump-target=hs-unauth-to hotspot=to-client,!auth
3 D chain=input action=jump jump-target=hs-input hotspot=from-client
4 D chain=input action=drop protocol=tcp hotspot=!from-client dst-port=64872-64875
5 D chain=hs-input action=jump jump-target=pre-hs-input
6 D chain=hs-input action=accept protocol=udp dst-port=64872
7 D chain=hs-input action=accept protocol=tcp dst-port=64872-64875
8 D chain=hs-input action=jump jump-target=hs-unauth hotspot=!auth
9 D chain=hs-unauth action=reject reject-with=tcp-reset protocol=tcp
10 D chain=hs-unauth action=reject reject-with=icmp-net-prohibited
11 D chain=hs-unauth-to action=reject reject-with=icmp-host-prohibited
12 X ;;; place hotspot rules here
chain=unused-hs-chain action=passthrough
13 ;;; defconf: fasttrack
chain=forward action=fasttrack-connection connection-state=established,related log=no log-prefix=""
14 ;;; defconf: accept established,related
chain=forward action=accept connection-state=established,related log=no log-prefix=""
15 ;;; defconf: drop invalid
chain=forward action=drop connection-state=invalid log=no log-prefix=""
16 chain=input action=drop src-address-list=blacklist log=yes log-prefix="Firewall input blacklist:"
17 ;;; defconf: drop all from WAN not DSTNATed
chain=forward action=drop connection-state=new connection-nat-state=!dstnat in-interface=pppoe-3bbfttx-ether1 log=no log-prefix=""
18 chain=input action=accept protocol=icmp
19 chain=input action=accept connection-state=established
20 chain=input action=accept connection-state=related
21 chain=input action=drop in-interface=pppoe-3bbfttx-ether1
0 D ;;; special dummy rule to show fasttrack counters
chain=prerouting action=passthrough
1 D ;;; special dummy rule to show fasttrack counters
chain=forward action=passthrough
2 D ;;; special dummy rule to show fasttrack counters
chain=postrouting action=passthrough
3 chain=postrouting action=log protocol=tcp dst-address=my.home.server dst-port=40080 log-prefix="to server: "
4 chain=prerouting action=log protocol=tcp src-address=my.home.server src-port=40080 log-prefix="from server: "
SYN
SYN,ACK
bridge
D
print
I have already try disable the hotspot, but unfortunately it does not solve the problem. And the server is already on hotspot's bypass list (I don't know if it relate to the problem or not).In the Mikrotik log you can see retransmissions of thepacket from the client to the server and retransmissions of theCode: Select allSYN
packet from the server to the client. This reveals that the server responds but the response never reaches the client.Code: Select allSYN,ACK
The consequence is that the TCP session never establishes, which explains why there is nothing in the nginx application log - nginx has never received any actual data because the TCP stack only delivers the session payload to the application, and here no payload could be transmitted.
The dynamically added firewall rules don't reveal anything at first glance, but they must be the reason. As I haven't spotted any rules created by upnp, I suspect one of the hotspot rules to interfere in some way as the hotspot interface iswhich is the same one to which the server is connected.Code: Select allbridge
Are you able to disable the hotspot functionality for a while and try again so that we could confirm or deny this suspicion before digging further?
Once you disable the hotspot, the related dynamic rules (those within the leftmost column) should disappear from the output ofCode: Select allD
.Code: Select all
If that helps, re-enabling the hotspot and watching the counters of the dynamically added hotspot rules while attempting to connect should help find the conflicting rule, but placing the server outside the hotspot bridge could be an easier solution.
Are you talking about this?the server is already on hotspot's bypass list (I don't know if it relate to the problem or not).
/ip firewall connection print detail where reply-src-address~":40080"
Are you talking about this?the server is already on hotspot's bypass list (I don't know if it relate to the problem or not).
If so, which variant (regular/bypassed/blocked) have you set for the server? None seems safe to me, unfortunately I have no experience with hotspot. Yet it is not clear to me why that should affect that single redirection selectively, so it is probably not the reason.
When you disable the hotspot, do all the dynamic rules disappear from the firewall tables?
Also, the log you've posted before shows that the connection tracker knows about the unsuccessful attempt, can you try once more and while it keeps trying, doand post the result after obfuscating the IPs?Code: Select all/ip firewall connection print detail where reply-src-address~":40080"
0 S C F d protocol=tcp src-address=my.lte.ip:40444 dst-address=mikrotik.public.ip:80 reply-src-address=my.home.server:40080 reply-dst-address=my.lte.ip:40444
tcp-state=syn-recv timeout=2s orig-packets=1 orig-bytes=60 orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=1 repl-bytes=60
repl-fasttrack-packets=0 repl-fasttrack-bytes=0 orig-rate=0bps repl-rate=0bps
OK, so please add one more rule right below the two ones I've given before, try again to connect to both 80 and 40080 and post the logs. I'd like to be sure that the issue is inside the 'Tik without forcing you to sniff packets:And this is what I got from your suggested command.Code: Select all0 S C F d protocol=tcp src-address=my.lte.ip:40444 dst-address=mikrotik.public.ip:80 reply-src-address=my.home.server:40080 reply-dst-address=my.lte.ip:40444 tcp-state=syn-recv timeout=2s orig-packets=1 orig-bytes=60 orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=1 repl-bytes=60 repl-fasttrack-packets=0 repl-fasttrack-bytes=0 orig-rate=0bps repl-rate=0bps
/ip firewall mangle
add chain=postrouting action=log protocol=tcp dst-address=internal.ip.of.the.server dst-port=40080 log-prefix="to server: "
add chain=prerouting action=log protocol=tcp src-address=internal.ip.of.the.server src-port=40080 log-prefix="from server: "
add chain=postrouting action=log protocol=tcp src-port=80,40080 log-prefix="back to client: "
OK, so please add one more rule right below the two ones I've given before, try again to connect to both 80 and 40080 and post the logs. I'd like to be sure that the issue is inside the 'Tik without forcing you to sniff packets:And this is what I got from your suggested command.Code: Select all0 S C F d protocol=tcp src-address=my.lte.ip:40444 dst-address=mikrotik.public.ip:80 reply-src-address=my.home.server:40080 reply-dst-address=my.lte.ip:40444 tcp-state=syn-recv timeout=2s orig-packets=1 orig-bytes=60 orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=1 repl-bytes=60 repl-fasttrack-packets=0 repl-fasttrack-bytes=0 orig-rate=0bps repl-rate=0bps
Code: Select all/ip firewall mangle add chain=postrouting action=log protocol=tcp dst-address=internal.ip.of.the.server dst-port=40080 log-prefix="to server: " add chain=prerouting action=log protocol=tcp src-address=internal.ip.of.the.server src-port=40080 log-prefix="from server: " add chain=postrouting action=log protocol=tcp src-port=80,40080 log-prefix="back to client: "
may/03 06:32:46 firewall,info back to client: postrouting: in:(unknown 0) out:pppoe-3bbfttx-ether1, src-mac ***, proto TCP (SYN,ACK), my.home.server:40080->my.lte.ip:43102, NAT (my.home.server:40080->mikrotik.public.ip:80)->my.lte.ip:43102, len 60
postrouting
mangle
nat
dst-nat
/tool sniffer set filter-interface=pppoe-3bbfttx-ether1 filter-ip-protocol=tcp filter-operator-between-entries=and filter-port=80,40080
/tool sniffer start
your.pub.lic.ip:80
/tool sniffer stop
/tool sniffer packet print detail
0 time=3.395 num=1 direction=rx interface=pppoe-3bbfttx-ether1 src-address=my.lte.ip:44811 dst-address=mikrotik.public.ip:80 (http) protocol=ip ip-protocol=tcp
size=60 cpu=0 fp=no ip-packet-size=60 ip-header-size=20 dscp=0 identification=54429 fragment-offset=0 ttl=45 tcp-flags=syn
1 time=3.395 num=2 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:80 (http) dst-address=my.lte.ip:44811 protocol=ip ip-protocol=tcp
size=60 cpu=1 fp=no ip-packet-size=60 ip-header-size=20 dscp=0 identification=0 fragment-offset=0 ttl=63 tcp-flags=syn,ack
2 time=3.479 num=3 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:56999 dst-address=unknown.ip.1:80 (http) protocol=ip ip-protocol=tcp
size=40 cpu=1 fp=no ip-packet-size=40 ip-header-size=20 dscp=0 identification=7790 fragment-offset=0 ttl=127 tcp-flags=fin,ack
3 time=3.484 num=4 direction=rx interface=pppoe-3bbfttx-ether1 src-address=unknown.ip.1:80 (http) dst-address=mikrotik.public.ip:56999 protocol=ip ip-protocol=tcp
size=40 cpu=0 fp=no ip-packet-size=40 ip-header-size=20 dscp=0 identification=60505 fragment-offset=0 ttl=60 tcp-flags=fin,ack
4 time=3.484 num=5 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:56999 dst-address=unknown.ip.1:80 (http) protocol=ip ip-protocol=tcp
size=40 cpu=1 fp=no ip-packet-size=40 ip-header-size=20 dscp=0 identification=7791 fragment-offset=0 ttl=127 tcp-flags=ack
5 time=4.392 num=6 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:80 (http) dst-address=my.lte.ip:44811 protocol=ip ip-protocol=tcp
size=60 cpu=1 fp=no ip-packet-size=60 ip-header-size=20 dscp=0 identification=0 fragment-offset=0 ttl=63 tcp-flags=syn,ack
6 time=4.394 num=7 direction=rx interface=pppoe-3bbfttx-ether1 src-address=my.lte.ip:44811 dst-address=mikrotik.public.ip:80 (http) protocol=ip ip-protocol=tcp
size=60 cpu=0 fp=no ip-packet-size=60 ip-header-size=20 dscp=0 identification=54979 fragment-offset=0 ttl=45 tcp-flags=syn
7 time=4.395 num=8 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:80 (http) dst-address=my.lte.ip:44811 protocol=ip ip-protocol=tcp
size=60 cpu=1 fp=no ip-packet-size=60 ip-header-size=20 dscp=0 identification=0 fragment-offset=0 ttl=63 tcp-flags=syn,ack
8 time=6.392 num=9 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:80 (http) dst-address=my.lte.ip:44811 protocol=ip ip-protocol=tcp
size=60 cpu=1 fp=no ip-packet-size=60 ip-header-size=20 dscp=0 identification=0 fragment-offset=0 ttl=63 tcp-flags=syn,ack
9 time=6.394 num=10 direction=rx interface=pppoe-3bbfttx-ether1 src-address=my.lte.ip:44811 dst-address=mikrotik.public.ip:80 (http) protocol=ip ip-protocol=tc>
size=60 cpu=0 fp=no ip-packet-size=60 ip-header-size=20 dscp=0 identification=55902 fragment-offset=0 ttl=45 tcp-flags=syn
10 time=6.395 num=11 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:80 (http) dst-address=my.lte.ip:44811 protocol=ip ip-protocol=tc>
size=60 cpu=1 fp=no ip-packet-size=60 ip-header-size=20 dscp=0 identification=0 fragment-offset=0 ttl=63 tcp-flags=syn,ack
11 time=8.508 num=12 direction=rx interface=pppoe-3bbfttx-ether1 src-address=unknown.ip.2:7745 dst-address=mikrotik.public.ip:80 (http) protocol=ip ip-protocol=tcp
size=52 cpu=0 fp=no ip-packet-size=52 ip-header-size=20 dscp=0 identification=5178 fragment-offset=0 ttl=243 tcp-flags=syn
12 time=8.508 num=13 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:80 (http) dst-address=unknown.ip.2:7745 protocol=ip ip-protocol=tcp
size=52 cpu=1 fp=no ip-packet-size=52 ip-header-size=20 dscp=0 identification=0 fragment-offset=0 ttl=63 tcp-flags=syn,ack
13 time=9.508 num=14 direction=tx interface=pppoe-3bbfttx-ether1 src-address=mikrotik.public.ip:80 (http) dst-address=unknown.ip.2:7745 protocol=ip ip-protocol=tcp
size=52 cpu=1 fp=no ip-packet-size=52 ip-header-size=20 dscp=0 identification=0 fragment-offset=0 ttl=63 tcp-flags=syn,ack
The sniffer filter doesn't support complex expressions so packets both to and from port 80 are captured regardless with which address the port 80 is associated. You can see that in the packets with unknown addresses, port 80 is associated with the unknown address and some other port is associated with your Mikrotik's public address. In another words, these packets belong to TCP connections from some clients on your LAN to http servers on these unknown addresses.There are two unknown ip address here. The unknown.ip.1 is probably one of my fttx isp's server. And unknown.ip.2 is probably my lte carier's server.
Hi, sindy.The sniffer filter doesn't support complex expressions so packets both to and from port 80 are captured regardless with which address the port 80 is associated. You can see that in the packets with unknown addresses, port 80 is associated with the unknown address and some other port is associated with your Mikrotik's public address. In another words, these packets belong to TCP connections from some clients on your LAN to http servers on these unknown addresses.There are two unknown ip address here. The unknown.ip.1 is probably one of my fttx isp's server. And unknown.ip.2 is probably my lte carier's server.
But the packets between my.lte.ip:44811 and mikrotik.public.ip:80 follow the same pattern you could see at the server side, i.e. the client keeps retransmitting the SYN packet and the server keeps retransmitting the SYN,ACK response, and as for the addresses and ports, it is a symmetric flow.
So we can see that the dst-nat and "un-dst-nat" work properly, and the Mikrotik does not filter packets as it does forward the server's responses all the way back to the PPPoE WAN interface.
At this stage, the following possibilities remain:Possibilities 1 and 2 seem so unlikely to me (why would anything of these happen only for packets to/from port 80) that my personal favourite for the culprit is possibiity 3 although it also seems quite unlikely.
- there is something wrong with the TCP headers of the packets - in fact, this could only mean the Seq and Ack values to be corrupt, where the Ack value in the SYN,ACK packet would not match the Seq value in the SYN packet because either the server's TCP stack would have set it incorrectly or because RouterOS would have changed it while forwarding the packet
- there is something wrong with the PPPoE functionality, corrupting the packets' contents or checksum or address information
- there is something rotten in how your ISP treats the responses from port 80
To analyse the Seq and Ack numbers, you would have to sniff to a file and open that file using Wireshark or tcpdump to see this level of packet details, Mikrotik sniffer doesn't show that to you.
Same case is the PPPoE analysis - the PPPoE payload is not encrypted, so Wireshark will dissect it and thus show you whether the encapsulated IP packets are the same like the original ones, but filtering during capture would have to be off and you would have to use display filters of Wireshark to show only the interesting part.
If you could somehow use another Mikrotik connected from outside to sniff packets to and from port 80 of your public address, you could see whether the responses do arrive (which would imply 1 or some kind of 2 to be the problem) or not (which would imply another kind of 2 or 3 to be the problem). In another words, to see whether 2 is a problem or not, you need to capture at your Mikrotik and use Wireshark for analysis in any case, and if you do that, you can also tell whether 1 is the problem.
So suggest the next step. I can analyze the sniff file but obfuscating the IP addresses in that file would be a more complex task for you than to analyze the file yourself. There are tools for that but I'm not sure they can sanitize the payload of the PPPoE packets.
Too bad, the guy who spoke with me was just a technician who has no idea why they block the response instead of incoming packet and who come up with this idea.ISP's admin is evil. If they blocked incoming traffic, it would take you few minutes to find out and be sure about it. When they block only outgoing replies, you waste hours trying to find an error on your side, because you don't expect this. In the end it's pointless, because you ask them eventually anyway. It would be interesting to hear their explanation, why they do it like this.