FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
163 views 2 comments
by anonymous
Hi everyone, I've set up a little flask server on the router, it basically serves as the Data to Server function but for incoming http messages: a message arrives, and it routes the message to another address.

i'm doing a script because if the target address is temporarily unreachable, it stores the data and sends it when he can.

I'm facing a problem tough: the router doesnt accept incoming http calls on flask's port: how do i solve it? how do i "open" the port?

And there's a built-in (or easy to code) way to do the same?

1 Answer

0 votes
by anonymous

Hello,

If I understand correctly, you'd like to access this server from the internet/outside (WAN zone)? If so, a port forward will be necessary because, by default, all of our devices block any incoming connections on any interface that has WAN zone assigned.

I'm leaving links to relevant articles down below:

https://wiki.teltonika-networks.com/view/Port_Forwarding

https://wiki.teltonika-networks.com/view/RUTX11_Firewall#Add_New_Port_Forward

Due to security reasons, I would highly recommend specifying the external IP address (RUTX11's WAN interface IP) as well as changing the default listening port if possible. In addition, if possible, it's recommended to specify incoming IPs (source IP address) so that only trusted/authorized devices can reach your router via WAN and specified external port. 

Note: exposing any sort of port, no matter whether it's TCP or UDP, can be a security risk, especially if it's a common port such as port 80 (HTTP), port 443 (HTTPS). Full list of well known ports can be found here: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers  

Let me know if this solves your issue!

Best regards,

Tomas.

by anonymous
Thanks for replying,

It helped a little bit, but unfortunately i wasn't able to solve the problem.

Since it's still a developing phase, im still trying to make it work and so everything is being tested in LAN.

The router has 10.0.0.1 as ip address while the pc has 10.0.0.249. The actual goal is to send a call to the router, let flask handle it (port 5000), and send it back to my pc (port 3002).

flask now does not receive any message at all, and i get a generic request time out as error

Thanks for your help
by anonymous

Thanks for clarifying. Could you just confirm that there should be some custom port open on the router itself and it should be listening for any incoming connections on specified IP address (either LAN IP, WAN IP or *any* a.k.a. 0.0.0.0)?

If that's the case then it seems like the port itself is not open (listening). Could you double-check whether the port is, in fact, active and bound on any IP address? You can do it via CLI in the WebUI at System>CLI or using third party tools (most commonly PuTTY) to connect to router via SSH. [https://wiki.teltonika-networks.com/view/RUTX11_CLI]. Once logged in, execute the following command:

netstat -a | grep PortNumber

If there is some output from executing this command, please post it here. Generally, when not specified, the default bound IP should be the loopback address 127.0.0.1 which would also explain why the address is unreachable from any other device.

If there is no output then I'm afraid there is not much that can be done from our side as that would indicate that the service which is supposed to open the port is not running or is not programmed to do that. I did try to take a quick look into this problem online and it seems like this page in particular might be useful: https://stackoverflow.com/questions/7023052/configure-flask-dev-server-to-be-visible-across-the-network

If I misunderstood some part in particular, please correct me.

Best regards,

Tomas.