I am using ESP32 with modbus tcp to connect from ESP32 as a slave to a master running on a device behind a router.
I am getting an error on the router with line icmp time exceeded when ESP32 is replying to the master. The packet routes just fine to the ESP32 and to the master but it gets dropped on the router in between on the way back. Is there any way to increase TTL for modbus ? It does not seem that the packet loops around because the destination ip is correct and the interface too. I am attaching the logs of the router in between the ESP32 and the modbus master. I am also running a websocket to a destination server which connects just fine.
Code: Select all
ip4_input: packet not for us.
ip4_forward: forwarding packet to 10.0.0.2
ip_input: iphdr->dest 0x46bea28b netif->ip_addr 0x100000a (0xa28b, 0xa, 0x46be0000)
ip_input: iphdr->dest 0x46bea28b netif->ip_addr 0x401a8c0 (0xbea28b, 0x1a8c0, 0x46000000)
ip_input: iphdr->dest 0x46bea28b netif->ip_addr 0x100007f (0x8b, 0x7f, 0x46bea200)
ip4_input: packet not for us.
ip4_forward: forwarding packet to 139.162.190.70
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 46 | (v, hl, tos, len)
+-------------------------------+
| 1315 |000| 0 | (id, flags, offset)
+-------------------------------+
| 255 | 6 | 0xab11 | (ttl, proto, chksum)
+-------------------------------+
| 192 | 168 | 1 | 4 | (src)
+-------------------------------+
| 139 | 162 | 190 | 70 | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
151852 3 mongoose.c:4250:write_conn 1 0x38 snd 6/2048 rcv 0/2048 n=6 err=119
ip_input: iphdr->dest 0x401a8c0 netif->ip_addr 0x401a8c0 (0x1a8c0, 0x1a8c0, 0x4000000)
ip4_input: packet accepted on interface st
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 42 | (v, hl, tos, len)
+-------------------------------+
| 4204 |010| 0 | (id, flags, offset)
+-------------------------------+
| 53 | 6 | 0x29cd | (ttl, proto, chksum)
+-------------------------------+
| 139 | 162 | 190 | 70 | (src)
+-------------------------------+
| 192 | 168 | 1 | 4 | (dest)
+-------------------------------+
ip4_input: p->len 42 p->tot_len 42
tcp_recved: received 2 bytes, wnd 5744 (0).
151894 3 mongoose.c:4239:read_conn 1 0x38 snd 0/2048 rcv 0/2048 n=2 err=119
tcp_fasttmr: delayed ACK
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 40 | (v, hl, tos, len)
+-------------------------------+
| 1316 |000| 0 | (id, flags, offset)
+-------------------------------+
| 255 | 6 | 0xab16 | (ttl, proto, chksum)
+-------------------------------+
| 192 | 168 | 1 | 4 | (src)
+-------------------------------+
| 139 | 162 | 190 | 70 | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
ip_input: iphdr->dest 0x200000a netif->ip_addr 0x401a8c0 (0xa, 0x1a8c0, 0x2000000)
ip_input: iphdr->dest 0x200000a netif->ip_addr 0x100000a (0xa, 0xa, 0x2000000)
ip_input: iphdr->dest 0x200000a netif->ip_addr 0x100007f (0xa, 0x7f, 0x2000000)
ip4_input: packet not for us.
ip4_forward: forwarding packet to 10.0.0.2
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x100000a (0xa8c0, 0xa, 0x1010000)
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x401a8c0 (0x1a8c0, 0x1a8c0, 0x1000000)
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x100007f (0xc0, 0x7f, 0x101a800)
ip4_input: packet not for us.
icmp_time_exceeded from 10.0.0.2 to 192.168.1.1
ip4_output_if: ap2
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 56 | (v, hl, tos, len)
+-------------------------------+
| 1317 |000| 0 | (id, flags, offset)
+-------------------------------+
| 255 | 1 | 0xa29d | (ttl, proto, chksum)
+-------------------------------+
| 10 | 0 | 0 | 1 | (src)
+-------------------------------+
| 10 | 0 | 0 | 2 | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x100000a (0xa8c0, 0xa, 0x1010000)
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x401a8c0 (0x1a8c0, 0x1a8c0, 0x1000000)
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x100007f (0xc0, 0x7f, 0x101a800)
ip4_input: packet not for us.
icmp_time_exceeded from 10.0.0.2 to 192.168.1.1
ip4_output_if: ap2
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 56 | (v, hl, tos, len)
+-------------------------------+
| 1318 |000| 0 | (id, flags, offset)
+-------------------------------+
| 255 | 1 | 0xa29c | (ttl, proto, chksum)
+-------------------------------+
| 10 | 0 | 0 | 1 | (src)
+-------------------------------+
| 10 | 0 | 0 | 2 | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x100000a (0xa8c0, 0xa, 0x1010000)
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x401a8c0 (0x1a8c0, 0x1a8c0, 0x1000000)
ip_input: iphdr->dest 0x101a8c0 netif->ip_addr 0x100007f (0xc0, 0x7f, 0x101a800)
ip4_input: packet not for us.
icmp_time_exceeded from 10.0.0.2 to 192.168.1.1
ip4_output_if: ap2
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 56 | (v, hl, tos, len)
+-------------------------------+
| 1319 |000| 0 | (id, flags, offset)
+-------------------------------+
| 255 | 1 | 0xa29b | (ttl, proto, chksum)
+-------------------------------+
| 10 | 0 | 0 | 1 | (src)
+-------------------------------+
| 10 | 0 | 0 | 2 | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
ip_input: iphdr->dest 0x46bea28b netif->ip_addr 0x100000a (0xa28b, 0xa, 0x46be0000)
ip_input: iphdr->dest 0x46bea28b netif->ip_addr 0x401a8c0 (0xbea28b, 0x1a8c0, 0x46000000)
ip_input: iphdr->dest 0x46bea28b netif->ip_addr 0x100007f (0x8b, 0x7f, 0x46bea200)
ip4_input: packet not for us.
[code]
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application
tcp_slowtmr: processing active pcb
tcp_slowtmr: polling application