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
595 views 8 comments
by anonymous

Hi, I received a new modem RUT240 and it came with RUT2_R_00.07.01.6.

JSON-RPC was not working on that FW version, or I could not find how to enable it.

So after reading around the community, some suggested updating to v7.2.

I am not exactly sure what is meant by v7.2 so I updated it to the latest: RUT2_R_00.07.02.7 (perhaps this is v7.2? still unsure)

JSON-RPC still not working, or I did not find how to enable it.

I downgraded the modem to RUT2XX_R_00.01.14.6, and JSON-RPC works.

Can someone clarify if this RUT2_R_00.07.02.7 is supposed to support JSON-RPC?

What is the RUTOS 7.2 some people mention fixes this issue?

Thanks!

Other posts:

https://community.teltonika-networks.com/35979/rut955-json-rpc-ubus-no-data?show=35979#q35979

https://community.teltonika-networks.com/35884/rut955-configure-via-json-rpc-ubus?show=35884#q35884

by anonymous
Hi,

do you know if the RUT240 supports the range header? this way my arduino could only request the first 1Kb of the response.

source:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range

I've tried and failed, but maybe you have inside info which can help shed light on this.

Thanks

1 Answer

0 votes
by anonymous

Hello,

Thank you for contacting us! Could you clarify how you're testing JSON-PRC? Are you using Postman for testing? I tested it on 07.02.7, and it seems to respond to all of the requests.

Did you try this configuration manual for Windows, or this for Linux?

Also, when using JSON on RUTOS, the username should be admin, not root (in the legacy versions root was used).

Regarding the so-called v7.2, you're correct, this is referring to RutOS versions RUT2_R_00.07.02.x.

One last note, when upgrading from the older version, could you try unselecting the option "Keep settings"? Configuration files from the legacy versions might be causing some issues.

Awaiting your response,

DaumantasG

by anonymous

Hi, thank you for your response.

I am sending the json-rpc requests in two ways:

1- using curl in a Windows laptop connected to the RUT240 via Wi-Fi.

2- using an Arduino microcontroller to send json-rpc over HTTP requests via lan (ethernet, internal connection).

I updated the firmware again to RUT2_R_00.07.02.x and did not check the "keep settings" to avoid trouble, as you suggested.

I can see option 1 working now, using admin user (instead of root). I can see I get an ubus_rpc_session in the response message.

Option 2, however, does not seem to work. This is working ok with the root user on the legacy firmware.

I will try to switch networks and connect the modem to my computer's ethernet so I can check the behavior with curl (not trivial, since this is a remote setup I'm using), but in the meantime, I'll ask some questions:

- Can you confirm that json-rpc is working on the ethernet internal interface on your side? I can see it working on Wi-Fi,  but not ethernet (both internal).

- Is there a setting to enable json-rpc on the webUI or is it on by default? I remember on the legacy webUI there was a checkbox to enable it, but I can't seem to find it in the newer version.

- Is there updated documentation for the new webUI and firmware? what I found shows the legacy interface.

Thank you,

Gustavo.

by anonymous

Hello,

- Can you confirm that json-rpc is working on the ethernet internal interface on your side? I can see it working on Wi-Fi, but not ethernet (both internal).

  • Yes, I've tested it on Ethernet and everything seems to be working fine.

- Is there a setting to enable json-rpc on the webUI or is it on by default? I remember on the legacy webUI there was a checkbox to enable it, but I can't seem to find it in the newer version.

  • There is not, it's on by default in version 7 of RutOS.

- Is there updated documentation for the new webUI and firmware? what I found shows the legacy interface.

  • This is the updated guide, sorry for not double-checking the links.

Some additional questions:

  • Could you please also tell me what response the Arduino gives? Is it not able to access the URL at all, or does it not get authorized?
  • Is the Arduino connecting to the router via its private IP, or is it reaching it remotely? (both of these options are valid, just asking for troubleshooting)
  • If you're not able to see the connection result, please try connecting to the router via SSH or CLI via the methods described here, login (username always root), and run this command:

                ubus monitor | grep "admin"

  • Then run your script on Arduino, you should be able to see a lot of text showing up in the CLI/SSH window. If it shows up, that means that Arduino successfully initiated a connection and sent a command to the router. If not, maybe something has changed in the response and that's why you're not getting any results.
  • If any further troubleshooting fails, please replicate the issue (try to send a command from Arduino) and then attach a troubleshoot file to your original post (it will only be visible to moderators of Teltonika). You can generate the troubleshoot file by going to System -> Administration -> Troubleshoot.
  • Also, if possible, please attach the results from the command that I mentioned above (simply paste them to the .txt file and attach it with troubleshoot file).

Awaiting your response.

Best regards,

DaumantasG

by anonymous

Ok, I think I know why my Arduino script is working on the legacy Router Firmware and not on the new one.

The poor Arduino is exploding because the response of the login is around 13Kb long. The internal buffer the httpclient library uses has 1Kb of ram allocated to this. Even when I increased this to 20Kb it timed out. Even increasing the timeout to 5 minutes, the library is exploding somewhere else (I did not code this library, so I'm not 100% familiar with it). 

My next question is:

- Is there a way to limit the info the rut240 adds in the login response? Maybe I can create another user and that would limit the huge amount of info returned?

This is the response I receive from the modem:

< HTTP/1.0 200 OK

< Connection: close

< Strict-Transport-Security: max-age=63072000; includeSubDomains; preload

< X-Frame-Options: SAMEORIGIN

< X-Content-Type-Options: nosniff

< Content-Security-Policy: default-src 'self'; frame-src * 'self';

img-src * 'self'; script-src https://cdn.jsdelivr.net 'unsafe-eval' 'self' 'sha256-8yE2w7Bv8/Il8SvtEkB35j3QNRei9CKtdX8HgqblU04=' 'nonce-pbfMmwrsnzqz1rg86SUDb6A+NvckQ8U3s4almwle63M' 'sha256-3/SyFyEV0Y/9yrhH8vNQqUrPTjxumNcaYo5gRtJvm2c='; style-src https://cdn.jsdelivr.net 'unsafe-hashes' 'sha256-4Su6mBWzEIFnH4pAGMOuaeBrstwJN4Z3pq/s1Kn4/KQ=' 'sha256-kwpt3lQZ21rs4cld7/uEm9qI5yAbjYzx+9FGm/XmwNU=' 'self'

< Access-Control-Allow-Origin: *

< Content-Type: application/json

<

{"jsonrpc":"2.0","id":1,"result":[0,{"ubus_rpc_session":"fafe385bc152f09c750798fc14357b70","timeout":300,"expires":299,"acls":{"access-group":{"core":["read","write"],"network/dns":["read","write"],"network/firewall/attack_prevention":["read","write"],"network/firewall/custom":["read","write"],"network/firewall/forwards":["read","write"],"network/firewall/nat_rules":["read","write"],"network/firewall/rules":["read","write"],"network/firewall/zones":["read","write"],"network/interfaces":["read","write"],"network/lan":["read","write"],"network/mobile/general":["write","read"],"network/mobile/operators/list":["write","read"],"network/mobile/operators/scan":["read","write"],"network/mobile/sim_switch":["read","write"],"network/mwan":["read","write"],"network/network":["read","write"],"network/routes/advanced_routing":["read","write"],"network/routes/dynamic_routes/proto_bgp":["read","write"],"network/routes/dynamic_routes/proto_eigrp":["read","write"],"network/routes/dynamic_routes/proto_nhrp":["read","write"],"network/routes/dynamic_routes/proto_ospf":["read","write"],"network/routes/dynamic_routes/proto_rip":["read","write"],"network/routes/static_routes":["read","write"],"network/vlan/interface_based":["read","write"],"network/vlan/port_based":["read","write"],"network/wireless":["read","write"],"network/wireless/scan":["read","write"],"services/auto-reboot/ping-reboot":["read","write"],"services/auto-reboot/reboot-scheduler":["read","write"],"services/cloud_solutions/rms":["read","write"],"services/events_reporting":["read","write"],"services/io/general":["read","write"],"services/io/juggler/action":["read","write"],"services/io/juggler/condition":["read","write"],"services/io/juggler/input":["read","write"],"services/io/post_get":["read","write"],"services/io/scheduler":["read","write"],"services/mobile_utilities/call-utilities":["read","write"],"services/mobile_utilities/sms/read":["read","write"],"services/mobile_utilities/sms/send":["read","write"],"services/mobile_utilities/sms/storage":["read","write"],"services/mobile_utilities/sms_gateway/auto_reply":["read","write"],"services/mobile_utilities/sms_gateway/email_to_sms":["read","write"],"services/mobile_utilities/sms_gateway/post_get":["read","write"],"services/mobile_utilities/sms_gateway/sms_forwarding":["read","write"],"services/mobile_utilities/sms_utilities":["read","write"],"services/ntpc/general":["read","write"],"services/ntpc/ntp":["read","write"],"services/packages/packages":["read","write"],"services/

(edited so I can post this, post limited to 12k chars)

Thanks for your help.

by anonymous

Ok, I think I know why my Arduino script is working on the legacy Router Firmware and not on the new one.

The poor Arduino is exploding because the response of the login is around 13Kb long. The internal buffer the httpclient library uses has 1Kb of ram allocated to this. Even when I increased this to 20Kb it timed out. Even increasing the timeout to 5 minutes, the library is exploding somewhere else (I did not code this library, so I'm not 100% familiar with it). 

My next question is:

- Is there a way to limit the info the rut240 adds in the login response? Maybe I can create another user and that would limit the huge amount of info returned?

This is the response I receive from the modem:

< HTTP/1.0 200 OK

< Connection: close

< Strict-Transport-Security: max-age=63072000; includeSubDomains; preload

< X-Frame-Options: SAMEORIGIN

< X-Content-Type-Options: nosniff

< Content-Security-Policy: default-src 'self'; frame-src * 'self';

img-src * 'self'; script-src https://cdn.jsdelivr.net 'unsafe-eval' 'self' 'sha256-8yE2w7Bv8/Il8SvtEkB35j3QNRei9CKtdX8HgqblU04=' 'nonce-pbfMmwrsnzqz1rg86SUDb6A+NvckQ8U3s4almwle63M' 'sha256-3/SyFyEV0Y/9yrhH8vNQqUrPTjxumNcaYo5gRtJvm2c='; style-src https://cdn.jsdelivr.net 'unsafe-hashes' 'sha256-4Su6mBWzEIFnH4pAGMOuaeBrstwJN4Z3pq/s1Kn4/KQ=' 'sha256-kwpt3lQZ21rs4cld7/uEm9qI5yAbjYzx+9FGm/XmwNU=' 'self'

< Access-Control-Allow-Origin: *

< Content-Type: application/json

<

{"jsonrpc":"2.0","id":1,"result":[0,{"ubus_rpc_session":"fafe385bc152f09c750798fc14357b70","timeout":300,"expires":299,"acls":{"access-group":{"core":["read","write"],"network/dns":["read","write"],"network/firewall/attack_prevention":["read","write"],"network/firewall/custom":["read","write"],"network/firewall/forwards":["read","write"],"network/firewall/nat_rules":["read","write"],"network/firewall/rules":["read","write"],"network/firewall/zones":["read","write"],"network/interfaces":["read","write"],"network/lan":["read","write"],"network/mobile/general":["write","read"],"network/mobile/operators/list":["write","read"],"network/mobile/operators/scan":["read","write"],"network/mobile/sim_switch":["read","write"],"network/mwan":["read","write"],"network/network":["read","write"],"network/routes/advanced_routing":["read","write"],"network/routes/dynamic_routes/proto_bgp":["read","write"],"network/routes/dynamic_routes/proto_eigrp":["read","write"],"network/routes/dynamic_routes/proto_nhrp":["read","w

(edited so I can post this, post limited to 12k chars)

Thanks for your help.

by anonymous

Hello,

   I'm sorry for the inconvenience caused by this issue.

   I dug into this issue a little deeper and found that, unfortunately, this is not something that can be changed by the user. Our RnD team is informed, and this issue is planned to be fixed in future updates, but I am afraid that currently, we do not have a set date for this.
    The only solution I could come up with is editing the library used on Arduino only to save the first few lines of the response. But if that's not possible, I'm afraid reverting to an older firmware version is the only possibility. If you can get around the length of the session ID response, other requests and responses should be much shorter.

Let me know if there is anything else I can help with!
Best regards,
Daumantas G.

by anonymous
alright, thank you for your help.

I will try my chances at the library fix or will revert to the previous (legacy) version of the Rut240 modem.

Thanks again,

Gustavo.
by anonymous
No problem, let me know if this works out for you!

Best regards,

DaumantasG