Custom interface to the device 'status' menu

46 views
Skip to first unread message

Daniele Cerasuolo

unread,
Mar 15, 2024, 4:26:40 AM3/15/24
to OpenWISP
hello everyone, 
I have a device with a bond interface used as a main ip address interface but openwisp does not recognize it. I looked at the monitoring module code and I think the bond interface does not belong to the default scheme. I would like to implement part to add a custom interface to the schema, could you give me some pointers on where to start? 

Federico Capoano

unread,
Mar 15, 2024, 10:22:27 AM3/15/24
to open...@googlegroups.com
Hi Daniele,

Could you share the OpenWrt UCI configuration sample for your use case so we can better understand what you're trying to do?
What do you mean by "main ip address"? Is this the management interface address? Or what exactly?

The library which deals with configurations is here:
https://github.com/openwisp/netjsonconfig/

Federico

Daniele Cerasuolo

unread,
Mar 15, 2024, 10:50:35 AM3/15/24
to open...@googlegroups.com
We created a bond interface formed by the eth1 and eth2 interfaces, set with an IP.
We defined the bond interface (named "bond0") as follow:
"
ip link set eth1 down
ip link set eth2 down
echo "+bond0" > /sys/class/net/bonding_masters
echo active-backup > /sys/class/net/bond0/bonding/mode
echo "+eth1" > /sys/class/net/bond0/bonding/slaves
echo "+eth2" > /sys/class/net/bond0/bonding/slaves
echo 5 > /sys/devices/virtual/net/bond0/bonding/num_grat_arp
echo 50 > /sys/class/net/bond0/bonding/miimon
echo "eth1:1" > /sys/class/net/bond0/bonding/queue_id
echo "eth2:2" > /sys/class/net/bond0/bonding/queue_id
echo eth1 > /sys/devices/virtual/net/bond0/bonding/primary
echo "1" > /sys/devices/virtual/net/bond0/bonding/all_slaves_active
ip link set eth1 up
ip link set eth2 up
ip link set dev bond0 up
ip addr add 192.168.101.2/24 brd 192.168.101.255 dev bond0

"
the file /etc/config/network is:
config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option packet_steering '1'
        option ula_prefix 'xxxxxxxxxxxx::/48'

config device 'device1'
        option name 'br-lan'
        list ports 'lan0'
        list ports 'lan1'
        list ports 'lan2'
        list ports 'lan3'
        option type 'bridge'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option dns '8.8.8.8'

config device 'device2'
        option macaddr 'xxxxxxxxxxxxx'
        option name 'eth2'

config interface 'plc1'
        option device 'eth2'
        option proto 'static'
        option ipaddr '192.168.30.10'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'plc0'
        option device 'eth1'
        option proto 'static'
        option ipaddr '192.168.20.10'
        option netmask '255.255.255.0'
        option ip6assign '60'

The device is connected to openwisp via the ip address associated with the bond0 interface , I would like to add this information to the status menu.




--
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.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openwisp/CAAGgX6%2BLA-9p9VBLLb0NRx%3DgYkBC%3D5xQXMQQZMPSzdx4U9JNJg%40mail.gmail.com.


--

Daniele Cerasuolo

Via Diocleziano, 107 

80125 – Napoli (NA) , Italy 

Mail: d.cer...@gematica.com 

Website: www.gematica.com 

INFO PRIVACY 

= = = = = = = = = = = = = = = = = = = = 

The content of this e-mail and its attachments are exclusively directed to the receiver and must be considered  confidential under embargo or use for any purpose for which this e-mail was sent. Therefore, it is prohibited  the dissemination and communication by persons other than the receiver, under Italian Law, ( Artt. 616 e ss.  c.p. e D.lgs n. 196/03 Codice Privacy). If this e-mail and its attachments have been received in error, please destroy what has been received and  notify the sender at the following address:in...@gematica.com 


Federico Capoano

unread,
Mar 16, 2024, 7:00:55 AM3/16/24
to open...@googlegroups.com
Hi Daniele,

OpenWrt doesn't "see" interfaces which are not defined in its network configuration.

Try defining a new interface called "bond0" and set it to "proto" none. That may help OpenWrt to see this interface and allow openwisp to report its address to the controller.

I hope it helps.

Federico

Daniele Cerasuolo

unread,
Mar 26, 2024, 8:12:11 AM3/26/24
to open...@googlegroups.com
I tried defining the interface in the /etc/config/network file with both proto to 'none' and 'static' but openwisp still doesn't recognize it. 
As you can see in the attached screen, the interface is recognized using the 'ifconfig' command.image.png
 Is there anything else I can try or should something be changed in the code? If yes, in what way?

--
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.

f.capoano

unread,
Apr 17, 2024, 12:27:11 PM4/17/24
to OpenWISP
Sorry for my late response.
I am not sure how to help here, the OpenWISP Monitoring package relies on the system to get the interface information from OpenWrt, so the key is to make sure ubus returns this.

More info:

I hope this helps.

Federico
 
Reply all
Reply to author
Forward
0 new messages