# \[SOLVED\]Can´t reach a port listening vía rmnet0 interface

**URL:** <https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357>\
**Category:** Legato Application Framework\
**Created:** [November 28, 2022, 9:22am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357 "2022-11-28T09:22:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 28, 2022, 9:22am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/1 "2022-11-28T09:22:45Z")

</div>

I have developed a Modbus Server and is listening on port 502.  
I have added the INPUT rule for the tcp protocol, port etc.  
I have also added sometimes an output rule

Then I have put all in ACCEPT policies. INPUT, FORWARD and OUTPUT…like “iptables -P INPUT ACCEPT” and so on. But it still does not work.

I can establish connection with 502 port when I acces vía USB ECM, iptables works fine when is related to usb ecm interface, but it seems that does not take effect when is related to rmnet0 interface

I have tried with almost 3 WP85 different modules.

I have 2 SIM cards with public and static IP, this lines are working fine in a Sierra Wireless OpenAT Q26 module with a similar Modbus/TCP server. So the problem is not the data connection

WP85 are getting the static IP, and I can send and receive data if I start comunication from WP85. But it is imposible to reach 502 port from outside, only via usb ecm

module= WP85; firmware=18.6.4

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 28, 2022, 9:28am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/2 "2022-11-28T09:28:29Z")

</div>

probably your SIM card is not having public IP address  
Or maybe the network operator blocks on this port 502

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 28, 2022, 9:33am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/3 "2022-11-28T09:33:02Z")

</div>

Ye it has. and is comunicating with our servers. I HAve also checked it with “cm data”

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 28, 2022, 9:34am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/4 "2022-11-28T09:34:47Z")

</div>

it is communicating with your server → this is TCP client only.

But you are now holding a TCP server on port 502 on module, so there is chance that the network blocks this port 502, or the IP address is not exposing to public.

BTW, have you tried other port like 80 or 21?  
Can your PC ping the module’s pubic IP address?

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 28, 2022, 9:40am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/5 "2022-11-28T09:40:24Z")

</div>

Our app has several ways of communication. It connects with our severs, but we also can configure a Modbus TCP Server

They do not respond to ping when I PC ping to the public static IP

They only respond ping via USB, when I ping 192.168.2.2

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 28, 2022, 9:42am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/6 "2022-11-28T09:42:23Z")

</div>

then it seems your network does not allow to do so

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 28, 2022, 9:42am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/7 "2022-11-28T09:42:41Z")

</div>

I do not think network is blocking 502 port, becase I checked the same with a SierraWireless OpenAT Q26 and is working fine

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 28, 2022, 9:45am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/8 "2022-11-28T09:45:20Z")

</div>

is it only working on 2G network?

You can capture wireshark log and see if there is any clue.

> [@View pings sent from an external device to mangoh red](https://forum.legato.io/t/view-pings-sent-from-an-external-device-to-mangoh-red/5378/3):
>
> @jyijyi Is there a step by step process you can provide?

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 28, 2022, 9:51am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/9 "2022-11-28T09:51:54Z")

</div>

Thanks!! for your Quick responses…I’m going to try with 2G, trying to use wireshark and read that post

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 28, 2022, 9:53am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/10 "2022-11-28T09:53:39Z")

</div>

BTW, when you work with 2G network with Q26, is that your PC can ping the module with public IP address?

I think the first step is to let outside PC to ping the module with public IP address

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 28, 2022, 10:02am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/11 "2022-11-28T10:02:07Z")

</div>

Yes in that case my PC can ping Q26 with public IP adress.

Yes!! I am going to try to ping WP85 as first step

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 28, 2022, 12:02pm UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/12 "2022-11-28T12:02:06Z")

</div>

I have installed tcpdump and I can see ICMP packets that are arriving

 ![ping](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/0/03017787247b8f67d12b2e4a0738fb50ecf32b31.png)

IPTABLES is ALL enabled

 ![iptables](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/6/64c1589232b8a3eb1c13eea95faa978d7af34a84.png)

But I do not get ping response.  
I have tried to connect to 502 port, and I also have seen the packets. But the app client in my PC couldn´t connect.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 28, 2022, 1:50pm UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/13 "2022-11-28T13:50:33Z")

</div>

You also need to disable the firewall of module:

```auto
iptables -I INPUT -j ACCEPT

```

You can also try this TCP server application:

> [@Networking: TCP server Operation not permitted (errno -1)](https://forum.legato.io/t/networking-tcp-server-operation-not-permitted-errno-1/4650/3):
>
> Hi, Thanks for the response, unfortunately I already tried to implement it via a fdMonitor but it give me the same error(s) when calling the recv functionallity: either: Errno -1: Operation not permitted Errno -11: Unknown error I discovered that when I use the flag MSG\_DONTWAIT in the recv function that I get the errors as described above. But when I just set the flag to 0 than I can receive data without a problem. However I want a non-blocking socket, so I want to use the flag MSG\_DONTWAI…

Or you can download the nc binary here:

> <https://github.com/jakev/android-binaries/blob/master/nc>

Transfer to the WP module, and then type the following for TCP server:  
root@swi-mdm9x28:/tmp# chmod 777 ./nc  
root@swi-mdm9x28:/tmp# ./nc -l -p 1234

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 29, 2022, 10:34am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/14 "2022-11-29T10:34:54Z")

</div>

My TCP Server is running and accepting conncections via USB ECM.  
I´ve compared my code with fwupdate and is almost the same, with identical config FLAGS…etc  
I have put this rule iptables -I INPUT -j ACCEPT, but there is no way.  
I still cannot ping via rmnet0

I´m going to try nc application, it´s pretty interesting

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 29, 2022, 10:42am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/15 "2022-11-29T10:42:57Z")

</div>

if you cannot ping the module’s IP , there is no way the TCP server to work on module

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 29, 2022, 10:58am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/16 "2022-11-29T10:58:23Z")

</div>

yeah, that is true. I think there is something that is blocking rmnet0 data and it has nothing to do whith iptables, but I do not know what could be.

Althoug it seems there is nothing wrong in my code, I cannot discard to do whatever Test, because a small detail in my code could be the problem.

I´m going to uninstall my app and open a port using nc, and I will see

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 29, 2022, 11:01am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/17 "2022-11-29T11:01:42Z")

</div>

BTW, are you trying 2G network which is the same technology as Q26 module?

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 29, 2022, 11:02am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/18 "2022-11-29T11:02:20Z")

</div>

Yes, I tried that yesterday, but with the same results.

I will try later again

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 29, 2022, 11:04am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/19 "2022-11-29T11:04:06Z")

</div>

OK, please try the same 2G network with same APN

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://forum.legato.io/u/Luis)\
**Post date:** [November 29, 2022, 11:39am UTC](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357/20 "2022-11-29T11:39:14Z")

</div>

These are my results with nc

 ![2g](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/e/e4acd5657fec879ddfba3c80ada0dc347335c93a.png)

The client app view

 ![hercules](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/d/dd5a1065ebcd601e72fe218503d1756707bb88ba.png)

and iptables

 ![iptables](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/3/31637a6cb0439e6b09b00180da79b4ae4f1bce2e.png)

NAT tables and other tables of iptables are all in ACCEPT

It is not my application, I think it has nothing to do with iptables either. I´m really lost.

I´m going to upgrade from LEgato R16.1-18.6.4 to R17-18.6.4 and see what happens

[Next page](https://forum.legato.io/t/solved-can-t-reach-a-port-listening-via-rmnet0-interface/6357.md?page=2)
