Update TRB140 APN via SSH

I have a number of TRB140 devices for which I need to update the APN details; these devices are only easily accessible via SSH.

Is it possible to update the APN settings via SSH. If yes, how?

Thanks, James

Hello,

You can change the APN configurations via SSH in the /etc/config/ directory within the network file.
Please let me know if you need any assistance with configuring it!

Best Regards,

Yes, please - assistance would be greatly appreciated - I’m not familiar with the process, or the file structures.

Thanks, James

Hi - is there any update on this? Is there any documentation specifying how we can do this?

Thanks, James

Hello,

To change the APN configurations, follow these steps:

  1. Log in to your router via CLI. Use ‘root’ as the username and the same password as in WebUI.
  • To enable/disable Auto APN, execute the following commands:
    uci set network.mob1s1a1.auto_apn='0' - use 0 to disable, and use 1 to enable.
    uci commit - to commit chenges
    /etc/init.d/network restart - to restart the network service to apply the changes.

  • To change the name of the custom APN, execute these commands:
    uci set network.mob1s1a1.apn='bangapro' - replace “bangapro” with the name of the APN you want to set.
    uci commit
    /etc/init.d/network restart

  • To change the authentication type, execute these commands:
    uci set network.mob1s1a1.auth='none' - replace “none” with “pap” or “chap” as needed.
    uci commit
    /etc/init.d/network restart

  • To see all the configurations on the mobile interface, execute the command:
    uci show network.mob1s1a1

I hope this helps. Please let me know if you have any more questions or need further assistance!

Best Regards,

1 Like

Hi - that’s really useful - thanks.

I’ve been updating some of them; I was hoping to make all the changes then perform the commit/restart. However, sometimes it seems that the settings are almost overwritten as I make them? Is this behaviour you would expect - anything I can do to avoid it? Should I make the changes on command at a time with the commit/restart after each?

Thanks, James

I’m glad to hear that these commands are helpful!
It’s not necessary to commit and restart the network service after every change. You can set configurations using uci set. After making your desired changes, you can execute the command uci changes to review what you’ve modified. Then, commit the changes and restart the network service.

Additionally, it’s important to note that if you want to enable auto APN, you should not only change the value from 0 to 1, but you should also delete two lines with ‘uci’:
uci delete network.mob1s1a1.apn
uci delete network.mob1s1a1.auth
These lines are only relevant when configuring a custom APN.

I hope this clarification helps. However, if you still encounter difficulties in setting something up, please share your mobile configuration (output of uci show network.mob1s1a1) here and specify the changes or settings you’d like to apply. I’ll be happy to assist you further!

Best Regards,

Hi Marija,

I’m still having problems with this; as you can see from the transcript below… I have changed the settings and they seem to apply, but within a few minutes they have reset again - any idea why this is happening?

Thanks, James

BusyBox v1.34.1 (2021-08-31 22:20:08 UTC) built-in shell (ash)


| _ \ _ | | / _ / |
| |
) | | | | | | | _
| _ <| |
| | |
| || |) |
|
| _\
,|_|__/|____/


Teltonika TRB1 series 2022

root@Teltonika-TRB140:~#
root@Teltonika-TRB140:~# uci show network.mob1s1a1
network.mob1s1a1=interface
network.mob1s1a1.proto=‘connm’
network.mob1s1a1.modem=‘3-1’
network.mob1s1a1.metric=‘2’
network.mob1s1a1.sim=‘1’
network.mob1s1a1.pdp=‘1’
network.mob1s1a1.dhcpv6=‘0’
network.mob1s1a1.ifname=‘rmnet0’
network.mob1s1a1.auto_apn=‘0’
network.mob1s1a1.auth=‘none’
network.mob1s1a1.apn=‘3iot.com
root@Teltonika-TRB140:~# uci set network.mob1s1a1.apn=‘mm.static’
root@Teltonika-TRB140:~# uci set network.mob1s1a1.auth=‘pap’
root@Teltonika-TRB140:~# uci set network.mob1s1a1.username=‘multinet’
root@Teltonika-TRB140:~# uci set network.mob1s1a1.password=‘multinet’
root@Teltonika-TRB140:~# uci commit
root@Teltonika-TRB140:~# /etc/init.d/network restart
root@Teltonika-TRB140:~# uci show network.mob1s1a1
network.mob1s1a1=interface
network.mob1s1a1.proto=‘connm’
network.mob1s1a1.modem=‘3-1’
network.mob1s1a1.metric=‘2’
network.mob1s1a1.sim=‘1’
network.mob1s1a1.pdp=‘1’
network.mob1s1a1.dhcpv6=‘0’
network.mob1s1a1.ifname=‘rmnet0’
network.mob1s1a1.auto_apn=‘0’
network.mob1s1a1.apn=‘mm.static’
network.mob1s1a1.auth=‘pap’
network.mob1s1a1.username=‘multinet’
network.mob1s1a1.password=‘multinet’
root@Teltonika-TRB140:~# uci show network.mob1s1a1
network.mob1s1a1=interface
network.mob1s1a1.proto=‘connm’
network.mob1s1a1.modem=‘3-1’
network.mob1s1a1.metric=‘2’
network.mob1s1a1.sim=‘1’
network.mob1s1a1.pdp=‘1’
network.mob1s1a1.dhcpv6=‘0’
network.mob1s1a1.ifname=‘rmnet0’
network.mob1s1a1.auto_apn=‘0’
network.mob1s1a1.apn=‘internet’
network.mob1s1a1.auth=‘none’
root@Teltonika-TRB140:~# uci show network.mob1s1a1
network.mob1s1a1=interface
network.mob1s1a1.proto=‘connm’
network.mob1s1a1.modem=‘3-1’
network.mob1s1a1.metric=‘2’
network.mob1s1a1.sim=‘1’
network.mob1s1a1.pdp=‘1’
network.mob1s1a1.dhcpv6=‘0’
network.mob1s1a1.ifname=‘rmnet0’
network.mob1s1a1.auto_apn=‘0’
network.mob1s1a1.apn=‘internet’
network.mob1s1a1.auth=‘none’
root@Teltonika-TRB140:~#
root@Teltonika-TRB140:~# uci show network.mob1s1a1
network.mob1s1a1=interface
network.mob1s1a1.proto=‘connm’
network.mob1s1a1.modem=‘3-1’
network.mob1s1a1.metric=‘2’
network.mob1s1a1.sim=‘1’
network.mob1s1a1.pdp=‘1’
network.mob1s1a1.dhcpv6=‘0’
network.mob1s1a1.ifname=‘rmnet0’
network.mob1s1a1.auto_apn=‘0’
network.mob1s1a1.auth=‘none’
network.mob1s1a1.apn=‘3iot.com
root@Teltonika-TRB140:~#

Hello,

Please log in to the router’s WebUI and navigate to Network → WAN. Then, press the edit button next to the mob1s1a1 interface.
Could you please confirm that “-- Custom --” is selected next to the APN, and not a specific APN name?

Usually, there can be issues setting APN changes via CLI when a specific APN name is selected in the WebUI instead of “-- Custom --”.

Best Regards,

Ah… the whole problem was that I don’t have acces to the GUI, so needed to change the settings via the CLI!

If this is not possible, I’ll have to get an engineer out to each site where these are installed.

Are there any other ways around it?

Thanks, James

Thank you for clarifying the situation! May I please know why you can’t connect to gateway GUI, while you can do it via SSH? If you connecting to your TRB140 remotly, you can do it both via SSH and WebUI. For the WebUI, please ensure that “remote HTTP access” is enabled. This will allow you to access it remotely.

Best Regards,

We have a firewall on site which I can connect to and SSH, but am unable to connect to the local IP of the Teltonika from outside the firewall.

Regards, James

Hi Marija,

Is there any way around this, or am I going to have to get an engineer out to each site where these are installed?

Thanks for all your help, James

This topic was automatically closed after 15 days. New replies are no longer allowed.

Hello,

I apologize for the delayed response. I have sent you a form to fill out. Once completed, I will be able to contact you privately to provide further assistance. Please use “6086” as the ticket ID. Thank you!

Best Regards,