Hello,
I have a simple routeros setup that I’m using to forward some services to an internal host; everything works fine but some times per day the connection to the services are refused.
I’m using an RB 1100Hx2 with routeros 6.36.2 and I am currently testing the setup with an ftp server.
The only other firewall rule is a drop on UDP 53.
The firewall nat rules are the following.
0 chain=srcnat action=netmap to-addresses=1.1.1.1 src-address=2.2.2.2
1 chain=dstnat action=dst-nat to-addresses=2.2.2.2 to-ports=21 protocol=tcp dst-address=1.1.1.1 dst-port=21
2 ;;; Default masquerade for internal network
chain=srcnat action=masquerade out-interface=Wan-1
I have done a packet capture both on the router and the host and it seems that when the connection is refused the router does not forward the packets correctly to the host.
The times are not syncronized so ignore them.
Source IP (zabbix server): 5.5.5.5
Router IP: 1.1.1.1
Host IP (on the internal network): 2.2.2.2
Dump of a failed connection on the router
23015 2016-09-07 00:19:31.617002 5.5.5.5 1.1.1.1 TCP 74 39022 → 21 [SYN] Seq=0 Win=14600 Len=0 MSS=1402 SACK_PERM=1 TSval=117085500 TSecr=0 WS=64
23016 2016-09-07 00:19:31.617059 1.1.1.1 5.5.5.5 TCP 74 21 → 39022 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=30545209 TSecr=117085500 WS=128
23017 2016-09-07 00:19:31.623477 5.5.5.5 1.1.1.1 TCP 66 39022 → 21 [ACK] Seq=1 Ack=1 Win=14656 Len=0 TSval=117085507 TSecr=30545209
23018 2016-09-07 00:19:31.623502 5.5.5.5 2.2.2.2 TCP 66 39022 → 21 [ACK] Seq=1 Ack=1 Win=229 Len=0 TSval=117085507 TSecr=30545209
23019 2016-09-07 00:19:31.623854 2.2.2.2 5.5.5.5 TCP 60 21 → 39022 [RST] Seq=1 Win=0 Len=0
23020 2016-09-07 00:19:31.623875 1.1.1.1 5.5.5.5 TCP 54 21 → 39022 [RST] Seq=1 Win=0 Len=0
23021 2016-09-07 00:19:32.614496 1.1.1.1 5.5.5.5 TCP 74 [TCP Spurious Retransmission] 21 → 39022 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=30545309 TSecr=117085500 WS=128
23022 2016-09-07 00:19:34.814494 1.1.1.1 5.5.5.5 TCP 74 [TCP Spurious Retransmission] 21 → 39022 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=30545529 TSecr=117085500 WS=128
23023 2016-09-07 00:19:39.014495 1.1.1.1 5.5.5.5 TCP 74 [TCP Spurious Retransmission] 21 → 39022 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=30545949 TSecr=117085500 WS=128
23024 2016-09-07 00:19:47.014497 1.1.1.1 5.5.5.5 TCP 74 [TCP Spurious Retransmission] 21 → 39022 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=30546749 TSecr=117085500 WS=128
23025 2016-09-07 00:20:03.014495 1.1.1.1 5.5.5.5 TCP 74 [TCP Spurious Retransmission] 21 → 39022 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=30548349 TSecr=117085500 WS=128
Dump of failed connection on the host
4816 2016-09-07 00:19:28.951912 5.5.5.5 2.2.2.2 TCP 66 39022 → 21 [ACK] Seq=1 Ack=1 Win=229 Len=0 TSval=117085507 TSecr=30545209
4817 2016-09-07 00:19:28.951950 2.2.2.2 5.5.5.5 TCP 54 21 → 39022 [RST] Seq=1 Win=0 Len=0
Dump of succesful connection on the router
22993 2016-09-07 00:18:31.587422 5.5.5.5 1.1.1.1 TCP 74 38994 → 21 [SYN] Seq=0 Win=14600 Len=0 MSS=1402 SACK_PERM=1 TSval=117025471 TSecr=0 WS=64
22994 2016-09-07 00:18:31.587473 5.5.5.5 2.2.2.2 TCP 74 38994 → 21 [SYN] Seq=0 Win=14600 Len=0 MSS=1402 SACK_PERM=1 TSval=117025471 TSecr=0 WS=64
22995 2016-09-07 00:18:31.587677 2.2.2.2 5.5.5.5 TCP 74 21 → 38994 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=383727304 TSecr=117025471 WS=128
22996 2016-09-07 00:18:31.587703 1.1.1.1 5.5.5.5 TCP 74 21 → 38994 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=383727304 TSecr=117025471 WS=128
22997 2016-09-07 00:18:31.593977 5.5.5.5 1.1.1.1 TCP 66 38994 → 21 [ACK] Seq=1 Ack=1 Win=14656 Len=0 TSval=117025479 TSecr=383727304
22998 2016-09-07 00:18:31.593996 5.5.5.5 2.2.2.2 TCP 66 38994 → 21 [ACK] Seq=1 Ack=1 Win=14656 Len=0 TSval=117025479 TSecr=383727304
22999 2016-09-07 00:18:31.596050 2.2.2.2 5.5.5.5 FTP 386 Response: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
23000 2016-09-07 00:18:31.596075 1.1.1.1 5.5.5.5 FTP 386 Response: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
Dump of succesful connection on the host
4805 2016-09-07 00:18:28.915787 5.5.5.5 2.2.2.2 TCP 74 38994 → 21 [SYN] Seq=0 Win=14600 Len=0 MSS=1402 SACK_PERM=1 TSval=117025471 TSecr=0 WS=64
4806 2016-09-07 00:18:28.915824 2.2.2.2 5.5.5.5 TCP 74 21 → 38994 [SYN, ACK] Seq=0 Ack=1 Win=14480 Len=0 MSS=1460 SACK_PERM=1 TSval=383727304 TSecr=117025471 WS=128
4807 2016-09-07 00:18:28.922307 5.5.5.5 2.2.2.2 TCP 66 38994 → 21 [ACK] Seq=1 Ack=1 Win=14656 Len=0 TSval=117025479 TSecr=383727304
4808 2016-09-07 00:18:28.924237 2.2.2.2 5.5.5.5 FTP 386 Response: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
Is someone able to give me some advice on how to fix it ?
Thanks a lot
Daniele