configure OpenWRT Clients with Openwisp2 Controller

1,871 views
Skip to first unread message

Alexandre Rigaud

unread,
Mar 18, 2017, 3:26:36 PM3/18/17
to OpenWISP
hello,

I want to apply a configuration template on a OpenWRT client but i looked at your 3 videos and i don't know how to do this ! Someone can explain if i'm doing things wrong or so ? 

Federico Capoano

unread,
Mar 19, 2017, 3:25:27 PM3/19/17
to Alexandre Rigaud, OpenWISP

Hi Alexandre,

to apply a template to a device, you have to select its checkbox in the templates section.

What's the procedure you have been trying?

Federico


Il sab 18 mar 2017, 20:26 Alexandre Rigaud <alexandre...@gmail.com> ha scritto:
hello,

I want to apply a configuration template on a OpenWRT client but i looked at your 3 videos and i don't know how to do this ! Someone can explain if i'm doing things wrong or so ? 

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexandre Rigaud

unread,
Mar 23, 2017, 3:12:59 PM3/23/17
to OpenWISP
Hello,

I followed this guide that you provide :

https://www.youtube.com/watch?v=v_DUeFUGG8Q&list=PLPueLZei9c8_DEYgC5StOcR5bCAcQVfR8


when i check the box near the configuration and/or template nothing happens :(

Alexandre Rigaud

unread,
Mar 23, 2017, 3:15:22 PM3/23/17
to OpenWISP


I can only choose "delete" from the menu . 



Le samedi 18 mars 2017 20:26:36 UTC+1, Alexandre Rigaud a écrit :

Alexandre Rigaud

unread,
Mar 23, 2017, 7:19:04 PM3/23/17
to OpenWISP
finnaly i was able to use OpenWisp to control my OpenWRT client  :)  ! 

but please : can you explain from scratch how to do this in another video ?  , because I had to search over 1 week to understand how it works ... I found this link where someone guided me to the solution to my problem  (Thanks Alberto )


After installing the IPK you released yesterday ( 22/03/2017) i was able to comunicate with my controller ; 

i just edited my config file 

# nano /etc/config/openwisp

here is my configuration in exemple : 

GNU nano 2.7.5                                                             File: /etc/config/openwisp

# For more information about these config options please see the README

config controller 'http'
        option url 'https://192.168.1.143'
        #option interval '120'
        option verify_ssl '0'
        #option shared_secret ''
        #option consistent_key '1'
        #option mac_interface 'eth0'
        #option merge_config '1'
        #option test_config '1'
        #option test_script '/usr/sbin/mytest'
        option uuid '3ef6c097c93c47ac87768c8487948108'
        option key 'VXeUq3X808vUSuCDWH59ugBZn3IWK81J'
        list unmanaged 'system.@led'
        list unmanaged 'network.loopback'
        list unmanaged 'network.@switch'
        list unmanaged 'network.@switch_vlan'
        # curl options
        #option connect_timeout '15'
        #option max_time '30'
        #option capath '/etc/ssl/certs'
        #option cacert '/etc/ssl/certs/ca-certificates.crt'
        # hooks
        #option pre_reload_hook '/usr/sbin/my_pre_reload_hook'

after that i did this command 

    
# openwisp-reload-config

after this i rebotted the OpenWRT just to make sure everything is OK so 

 # reboot 


and after i did this command : 

 # logread | grep openwisp

and outputs me that :

Thu Mar 23 21:21:32 2017 daemon.info openwisp: OpenWISP config agent started
Thu Mar 23 21:21:32 2017 user.notice : openwisp: OpenWISP config agent started
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Local configuration outdated
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Downloading configuration from controller...
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Configuration downloaded, now applying it...
Thu Mar 23 21:21:32 2017 daemon.info openwisp: The following uci configs have been renamed: dhcp.cfg02411c, dropbear.cfg024dd4, firewall.cfg1c92bd, firewall.cfg0c92bd, firewall.cfg02e63d, firewall.cfg18af89, firewall.cfg04dc81, firewall.cfg1692bd, firewall.cfg0e92bd, firewall.cfg1492bd, firewall.cfg1292bd, firewall.cfg06dc81, firewall.cfg08ad58, firewall.cfg0a92bd, firewall.cfg1a92bd, firewall.cfg1092bd, rpcd.cfg02f8be, system.system, ucitrack.cfg20822b, ucitrack.cfg1e0f89, ucitrack.cfg0aad04, ucitrack.cfgThu Mar 23 21:21:32 2017 daemon.info openwisp: Service dhcp has been reloaded via procd/ubus
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Service dropbear has been reloaded via procd/ubus
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Service firewall has been reloaded via procd/ubus
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Service network has been reloaded via procd/ubus
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Service rpcd has been reloaded via init.d script
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Service system has been reloaded via procd/ubus
Thu Mar 23 21:21:32 2017 daemon.info openwisp: Service ucitrack has been reloaded via procd/ubus
Thu Mar 23 21:21:37 2017 daemon.info openwisp: Testing configuration...
Thu Mar 23 21:21:37 2017 daemon.info openwisp: Configuration test succeded
Thu Mar 23 21:21:37 2017 daemon.info openwisp: Configuration applied succesfully

From the web server/controller i was able to see my configuration was working after that 


If you want a feedback of what i did and/or how i did, i can send you by mail or here what i've done to make it work !  

I mean, I started from scratch with 3 virtual machines, it was a little bit complicated to follow your tutorial because everything was functionning from your computer .

I had problems with ansible playbook on my ubuntu virtual Machine on the begining, but after 2 hours of workaround it finally worked !   

thanks a lot !

Saluti Federico =) 

Alexandre 

Le samedi 18 mars 2017 20:26:36 UTC+1, Alexandre Rigaud a écrit :

Federico Capoano

unread,
Mar 24, 2017, 6:41:06 AM3/24/17
to OpenWISP
Hey Alexandre,

glad to know you made it.

I will try to schedule the work to make another video. Maybe it's better to wait for the next release in which I will add a few more things that would be nice to show.

Federico

Fernando Fonseca

unread,
Jun 29, 2018, 6:48:06 AM6/29/18
to OpenWISP
Hi Alexandre.

Your words gave me stenght to go forward...

I am having lots of problems trying to install openwisp on my openwrt LEDE version ( LEDE Reboot 17.01.4 r3560-79f57e422d / LuCI lede-17.01 branch (git-17.290.79498-d3f0685) ).

I downloaded the IPK file to install using the "ipkg install" command. But says cannot continue because no curl and luafilesystem is present.

Something you can help on that?

I really appretiate... I want to make a simple way to install it and publish it to others as well...

Regards sr.

Oliver Kraitschy

unread,
Jun 29, 2018, 8:07:49 AM6/29/18
to open...@googlegroups.com
Hi Fernando,

I guess that opkg fails when trying to download the packages curl and
luafilesystem.

What does the command "opkg update" output? It should fetch a list of
available packages. If it fails then you might need to adjust the urls to
the repositories:

https://openwrt.org/docs/guide-user/additional-software/opkg#adjust_repositories

If it succeeds then you can install the missing packages with:

opkg install curl luafilesystem

I hope that helps.

Greetings,
Oliver

Fernando Fonseca

unread,
Jun 29, 2018, 11:06:51 AM6/29/18
to open...@googlegroups.com
Hi Oliver.

Just got that sorted out.... Amazing help.

Althought, I just used "opkg install openwisp".

All went well. Just instaled the version and curl and luafilesystem.

Now i have the folders and all the current files in my router.

Do you thing that is ok at a first look?

Just need to install the openwise2 in a virtual machine. :o)

By the way, do you have any virtual image file with your openwise2 instalation that you can provide to be easier to test the whole system?

Regards.




> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+unsubscribe@googlegroups.com.

Fernando Fonseca

unread,
Jun 29, 2018, 1:10:52 PM6/29/18
to OpenWISP
Hi Alexandre

I am trying  to install openwisp2 on ubuntu server just like you.

But got one erro that i cannot resolve till now.

Can you give me an hand on that?

This is the error iam talking about.

"
TASK [openwisp.openwisp2 : migrate] ******************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "./manage.py migrate --noinput", "msg": "\n:stderr: Traceback (most recent call last):\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", line 51, in get_new_connection\n    conn.load_extension(self.spatialite_lib)\nsqlite3.OperationalError: mod_spatialite: cannot open shared object file: No such file or directory\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File \"./manage.py\", line 10, in <module>\n    execute_from_command_line(sys.argv)\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/core/management/__init__.py\", line 371, in execute_from_command_line\n    utility.execute()\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/core/management/__init__.py\", line 365, in execute\n    self.fetch_command(subcommand).run_from_argv(self.argv)\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/core/management/base.py\", line 288, in run_from_argv\n    self.execute(*args, **cmd_options)\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/core/management/base.py\", line 335, in execute\n    output = self.handle(*args, **options)\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/core/management/commands/migrate.py\", line 77, in handle\n    connection.prepare_database()\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", line 61, in prepare_database\n    with self.cursor() as cursor:\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 255, in cursor\n    return self._cursor()\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 232, in _cursor\n    self.ensure_connection()\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 216, in ensure_connection\n    self.connect()\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/db/backends/base/base.py\", line 194, in connect\n    self.connection = self.get_new_connection(conn_params)\n  File \"/opt/openwisp2/env/lib/python3.6/site-packages/django/contrib/gis/db/backends/spatialite/base.py\", line 55, in get_new_connection\n    ) from exc\ndjango.core.exceptions.ImproperlyConfigured: Unable to load the SpatiaLite library extension \"mod_spatialite\"\n", "path": "/opt/openwisp2/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin", "state": "absent", "syspath": ["/tmp/ansible_rfiZQl", "/tmp/ansible_rfiZQl/ansible_modlib.zip", "/tmp/ansible_rfiZQl/ansible_modlib.zip", "/usr/lib/python2.7", "/usr/lib/python2.7/plat-x86_64-linux-gnu", "/usr/lib/python2.7/lib-tk", "/usr/lib/python2.7/lib-old", "/usr/lib/python2.7/lib-dynload", "/usr/local/lib/python2.7/dist-packages", "/usr/lib/python2.7/dist-packages"]}
        to retry, use: --limit @/home/fernando/openwisp2-ansible-playbook/playbook.retry

PLAY RECAP *******************************************************************************************************************
localhost                  : ok=40   changed=0    unreachable=0    failed=1

"

Regards Sr


quinta-feira, 23 de Março de 2017 às 23:19:04 UTC, Alexandre Rigaud escreveu:

Fernando Fonseca

unread,
Jun 29, 2018, 2:40:49 PM6/29/18
to OpenWISP
Please do not worry about my last question.

I am noticed that i am using ubuntu server version 18

I will install a lower version (14 something) ans start from the scratch again.

I will update you guys with the success or not regarding thin instalation.

For a better environment test in the near future i will post some VM ready to use.
Is hard to have my device ready to use and not the server.... Maybe i can make use of one of my servers and allow it for future simple fast tests for everyone while their private servers aren't ready....

Have a nice weekend you all...

Oliver Kraitschy

unread,
Jun 29, 2018, 3:11:04 PM6/29/18
to open...@googlegroups.com
Hi Fernando,

I'm glad that you got it installed :-)

No, I don't have a virtual image of an openwisp2 install but you can use
the ansible-openwisp2 role to install openwisp2 on a linux vm - but I see
that you're already working on that :-)

Have a nice weekend and happy playing with openwisp2 :-)

Greetings,
Oliver

Fernando Fonseca

unread,
Jul 2, 2018, 1:38:25 PM7/2/18
to open...@googlegroups.com
Hi Oliver

Done. Just finished configured the OpenWisp in my ubuntu v16
All documented for a future post for all new users to get this straight.

I Also instaled the IPK in my openmesh router with LEDE v17. 
I am getting this error:

"Mon Jul  2 17:32:29 2018 daemon.err openwisp: Failed to connect to controller during registration: curl exit code 48"

this is my conf file in : etc/conf

"config controller 'http'
option url '192.168.1.247'
#option interval '120'
option verify_ssl '0'
option shared_secret '657AC2xMjyvCg8EqAzuwJNUS2StsqqcW'
#option consistent_key '1'
option mac_interface 'eth0'
#option merge_config '1'
#option test_config '1'
#option test_script '/usr/sbin/mytest'
#option uuid ''
#option key ''
#list unmanaged 'system.@led'
#list unmanaged 'network.loopback'
#list unmanaged 'network.@switch'
#list unmanaged 'network.@switch_vlan'
# curl options
#option connect_timeout '15'
#option max_time '30'
#option capath '/etc/ssl/certs'
# hooks
option pre_reload_hook '/usr/sbin/my_pre_reload_hook'"


Note, i also used the option url as "http://192.168.1.247" and "http://192.168.1.247"

Still get the same error.

Can someone give me an hand?

Regards to you all guys.





Fernando Fonseca

unread,
Jul 2, 2018, 2:40:26 PM7/2/18
to open...@googlegroups.com
Just got the thing working at 99%

In the config openwisp the url must be as https
In the usr/sbin/ioebwisp_config I changed the : 
FETCH_COMMAND="curl -s --connect-timeout $CONNECT_TIMEOUT --max-time $MAX_TIME --capath $CAPATH"
to
FETCH_COMMAND="curl -s --connect-timeout $CONNECT_TIMEOUT --max-time $MAX_TIME"

All ok till now... device can talk with the openwisp2 server.

But when device tries to apply the config file i got this : 
"
Mon Jul  2 18:34:14 2018 daemon.info openwisp: The following uci configs have been renamed: dhcp.cfg06f37d
Mon Jul  2 18:34:14 2018 daemon.crit openwisp: Could not update configuration, openwisp-update-config exit code was 1
Mon Jul  2 18:34:14 2018 daemon.err openwisp: Configuration could not be applied, update operation aborted
Mon Jul  2 18:36:14 2018 daemon.info openwisp: Local configuration outdated
Mon Jul  2 18:36:14 2018 daemon.info openwisp: Downloading configuration from controller...
Mon Jul  2 18:36:15 2018 daemon.info openwisp: Configuration downloaded, now applying it...
Mon Jul  2 18:36:15 2018 daemon.info openwisp: The following uci configs have been renamed: wireless.cfg033579, wireless.cfg043579
Mon Jul  2 18:36:15 2018 daemon.crit openwisp: Could not update configuration, openwisp-update-config exit code was 1
Mon Jul  2 18:36:15 2018 daemon.err openwisp: Configuration could not be applied, update operation aborted
"

Any thoughts??

Oliver Kraitschy

unread,
Jul 2, 2018, 2:45:10 PM7/2/18
to open...@googlegroups.com
Hi Fernando,

did you write a blog post about the installation process? Did you use the
usage tutorial of ansible-openwisp2
(https://github.com/openwisp/ansible-openwisp2#usage-tutorial)? If you
think that the documentation needs improvement, then we would be happy to
hear your suggestions ;-)

About your current problem: you need to use the full url with the protocol
prefix (http/https). And I think you need to use https (unless you
modified the ansible role to not use https).

Greetings,
Oliver

Fernando Fonseca

unread,
Jul 2, 2018, 3:11:14 PM7/2/18
to open...@googlegroups.com
I am writting a tutorial for the whole process...
I will update the current one as soon as i get all done.

Just need to know about my previous question in the group.
Once solved i think i can put all together for others as reference.

Oliver shoul be cool if you could share how to modify the ansible role to not use https. Is that just a line that i have to add into the role section?

Regards.



Greetings,
Oliver

Fernando Fonseca

unread,
Jul 2, 2018, 4:30:09 PM7/2/18
to open...@googlegroups.com
Well........ Almost there.....

Updated the ipk version.

now i can get the configs from the openwisp2 server.

But, the configs do not apply. But the log say's they was...

"
Mon Jul  2 20:27:34 2018 daemon.info openwisp: Local configuration outdated
Mon Jul  2 20:27:34 2018 daemon.info openwisp: Downloading configuration from controller...
Mon Jul  2 20:27:34 2018 daemon.info openwisp: Configuration downloaded, now applying it...
Mon Jul  2 20:27:35 2018 daemon.crit openwisp: Could not update configuration, openwisp-update-config exit code was 1
Mon Jul  2 20:27:35 2018 daemon.info openwisp: Configuration applied succesfully
"

Any idea?

Oliver Kraitschy

unread,
Jul 3, 2018, 8:52:25 AM7/3/18
to OpenWISP
Hi Fernando,

this error appears when the configuration couldn't be merged:

https://github.com/openwisp/openwisp-config/blob/master/openwisp-config/files/openwisp.agent#L260

Which modifications to the configuration did you make? You could try first
with some uncritical modification like adding some file or adding a ntp
server to the ntp client configuration.

Greetings,
Oliver

Fernando Fonseca

unread,
Jul 3, 2018, 11:05:01 AM7/3/18
to open...@googlegroups.com
Hi Oliver.

Yes. I realise that.....

I get the erro with  "option merge_config '0' " or either "option merge_config '0'  ".

Do not know if is some file permisison or so. The .tar.gz  file is under the tmp folder with the configuration files. All them filled with right config from the controller.


"
Tue Jul  3 14:49:17 2018 daemon.info openwisp: Configuration applied succesfully
Tue Jul  3 14:59:03 2018 daemon.info openwisp: Local configuration outdated
Tue Jul  3 14:59:03 2018 daemon.info openwisp: Downloading configuration from controller...
Tue Jul  3 14:59:04 2018 daemon.info openwisp: Configuration downloaded, now applying it...
Tue Jul  3 14:59:04 2018 daemon.crit openwisp: Could not update configuration, openwisp-update-config exit code was 1
Tue Jul  3 14:59:04 2018 daemon.info openwisp: Configuration applied succesfully

"

Fernando Fonseca

unread,
Jul 3, 2018, 11:46:19 AM7/3/18
to open...@googlegroups.com
Do you know what is this means -> "  Tue Jul  3 14:59:03 2018 daemon.info openwisp: Local configuration outdated  " ?

Just noticed it know...

Oliver Kraitschy

unread,
Jul 3, 2018, 2:56:44 PM7/3/18
to open...@googlegroups.com
Hi Fernando,

which settings did you try to apply with OpenWISP? Did you try with other
settings? Does the issue appear with any settings?

Greetings,
Oliver

Oliver Kraitschy

unread,
Jul 3, 2018, 3:13:10 PM7/3/18
to OpenWISP
Hi Fernando,

this means that the configuration provided by the controller has changed
since the previous check of openwisp-config for configuration updates.

https://github.com/openwisp/openwisp-config/blob/master/openwisp-config/files/openwisp.agent#L218

Greetings,
Oliver

Federico Capoano

unread,
Jul 5, 2018, 12:30:01 PM7/5/18
to open...@googlegroups.com
Hey Fernando,

if you set merge_config to 0 it means you have to store the full configuration in the controller, but right now the recommended (and default) way is to keep merge_config set to 1 and only store the most relevant bit of configurations in openwisp2.
This will likely change and be improved in the future but that's what we got now with our current resources.

For more info please refer to the README, which covers all the basic info you need to know: https://github.com/openwisp/openwisp-config.

PS: unfortunately Ubuntu 18 and debian 9 are not supported yet, nobody has worked to add support to these new systems yet.

Let us know if you made it, I hop so :-)

Fed

--
You received this message because you are subscribed to the Google Groups "OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openwisp+u...@googlegroups.com.

deepak kumar Pradhan

unread,
Aug 10, 2018, 1:30:04 AM8/10/18
to OpenWISP
Ok,

You have to connect the openWRT client to server, and select the template(tic the checkbox) and configure the template parameters.
And Save the template, you will see the template configuration will be applied to device.
If you can elaborate, whats the setup is, then it would be easy to explain the template push.
Are you using openwisp? 
Reply all
Reply to author
Forward
0 new messages