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
294 views 1 comments
by anonymous

Hi,

we will have to configure about 800 to 1200 routers, all of them with a slightly different configuration. Instead of configuring all of them via the Web GUI I download things like openvpn certificates, SIM PIN etc. from a database and create different configuration files with a python script. After creating the configuration I transfer the single files automatically via SCP and reboot the router. To configure them automatically I adjust and transfer the following files:

  • /etc/config/firewall
  • /etc/config/network
  • /etc/config/ntpclient
  • /etc/config/openvpn
  • /etc/config/ping_reboot
  • /etc/config/rms_connect
  • /etc/crontabs/root
  • /etc/shadow
  • /etc/config/simcard
  • /etc/config/teltonika

My problem lies within the 'etc/config/network' file. I generate the following wan2 config

config interface 'wan2'
    option ifname 'eth1'
    option proto 'dhcp'
    option enabled '0'
    option disabled '1'

After the transfer and automatic reboot I realized that the wan2 configuration within the 'etc/config/network' was changed to

config interface 'wan2'
    option enabled '0'
    option disabled '1'
    option ifname 'wwan0'
    option proto 'none'

this results in having two Mobile WANs beeing displayed on the Web GUI. If I change the file on the router again and reboot everything looks fine (WAN1 = Mobile, WAN2 = Wired, WAN3 = Wifi).

Is there some script I don't know about that is executed after the first boot that is changing the network configuration?

Or is it recless anyway to manually change the configuration like this? Is there a cleaner way to autoconfigurate the routers without using the Web GUI for all the routers we have.

Regards Ian

1 Answer

0 votes
by anonymous
Hi,

There actually is a cleaner way to do it, just use UCI commands, they have almost all the values from all the configs that are existent within RUT devices. This will not only save your time but also will be faster, as the changes made are committed and then you just use luci-reload to restart all the services.

More info about them could be found here: https://openwrt.org/docs/guide-user/base-system/uci#command-line_utility

The main commands you will use:

uci show

uci set

uci commit

luci-reload

Regarding the config that you saw changing - it could be that init.d script manipulates with that exact interface and just changes it on need. If you need more exact info on why is that happening I could contact RnD and ask about this, but I believe UCI method should be easier to be done.

EB.
Best answer
by anonymous
Hi EB that looks promising. I'll have a look at it. Thank you!