Skip to content

Commandline administration

Florian Maurer edited this page Oct 22, 2023 · 174 revisions

On this page you can find various commands to manage your Gluon based node using the command line. You can access the command line remotely using SSH if you've added your public key or defined a password in the configuration wizard. All nodes should be accessible using their IPv6 addresses. If in doubt ask your local community on how to find your devices IPv6 address.

Basics

Most settings can be changed using the UCI configuration tool.

shell

On the console you have a Linux busybox shell with a limited command set.

UCI

You read the current value with

uci get <config>.<section>.<option>

If you don't know where to find a certain value search for it with

uci show | grep searchpattern

for setting a value you use

uci set <config>.<section>.<option>="new value"

If the variable is a list, for example fastd.mesh_vpn.method, use uci set to set the first list array element and every further element add with

uci add_list <config>.<section>.<option>="new list element"

or del_list to Remove the given string from an existing list option:

del_list <config>.<section>.<option>="list element"

See also the UCI Documentation

Your Gluon Release may have some custom scripts, which use temporary UCI state to do some of its magic. So it may be a good idea to check changes before commit:

uci changes

If you are fine with the changes, you can commit them all at once with uci commit or just individual sections (e.g. gluon section) using:

uci commit gluon

Common Tasks

Reboot

reboot

(Re-)entering config mode

gluon-enter-setup-mode
Manual Steps for Versions from before v2022.1
uci set gluon-setup-mode.@setup_mode[0].enabled='1'
uci commit gluon-setup-mode
reboot

Install new firmware via commandline

Nowadays, sysupgrade supports upgrading from a given URL and takes care of everything else

sysupgrade [FIRMWAREURL]
Manual Steps for Versions from before v2020.1
cd /tmp/
echo 3 > /proc/sys/vm/drop_caches
wget [FIRMWAREURL]
echo 3 > /proc/sys/vm/drop_caches
sysupgrade [NAMEOFFIRMWAREFILE]

As an alternative to wget you can push the firmware file from your client using scp -O into /tmp

Add SSH public key

cat ~/.ssh/your_public_rsa_key.pub | ssh root@$ROUTER_IP 'cat >> /etc/dropbear/authorized_keys'

ed25519 keys are supported since v2022.1

Show number of connected clients

batctl tl | grep -cEo "\[.*W.*\]+"

Show Informations about Node

gluon-info

This will show some Human Readable stats about a Node. Otherwise, the following commands will return specifics:

Show router model

# With vendor and hardware version (example: "tp-link-tl-wdr4300-v1")
lua -e 'print(require("platform_info").get_image_name())'
# With vendor and hardware version (human readable, example: "TP-Link TL-WDR4300 v1")
lua -e 'print(require("platform_info").get_model())'
# Only type of router (example: "tl-wdr4300")
lua -e 'print(require("platform_info").get_board_name())'

Show installed gluon version

# Gluon version (example: "v2023.1")
cat /lib/gluon/gluon-version
# Build version (example: "2023.1.0-stable-2016-06.05")
cat /lib/gluon/release

Show Current Site

gluon-show-site

Switching the domain

gluon-switch-domain newdomaincode
show steps prior to v2021.1
uci set gluon.core.domain="newdomaincode"
gluon-reconfigure
reboot

Change autoupdater branch

uci set autoupdater.settings.enabled=1
uci set autoupdater.settings.branch=stable
uci commit autoupdater
autoupdater -f

To use a different branch than saved only once, use:

autoupdater -b [NAMEOFBRANCH] -f

To do an update to a firmware lacking enough signatures

uci set autoupdater.stable.good_signatures='1'
autoupdater -f

Change the OpenWrt keyboard layout

Only helpful on targets (eg. x86, kvm) that have a direct keyboard interface (usb/ps2 etc.). Gluon being OpenWrt based by default only sports the US keyboard layout which makes using eg. a German keyboard a tedious task.

For this to work you have to explicitely enable the busybox applet loadkmap during gluon build time. You can do that eg. in GLUON_DIR/include/config or more target specific in GLUON_DIR/targets/<profile>/config (if you don't want the applet in all profiles). add

CONFIG_BUSYBOX_CONFIG_LOADKMAP=y

When the loadkmap applet is available in your Gluon build you can load keymaps like this

loadkmap < /usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys.bmap

A readymade package of binary keymaps (the format expected by busybox, converted from the Debian keymaps package) can be downloaded here . The whole package is 1.1MB in size, so you might want to copy only selected maps to your box if you are constrained for space. Placing the maps into /usr/share/keymaps/ would be good style but is not necessarily needed.

Change/Disable console blanking timeout, monitor switch off

By default the physical console gets blanked after 10 minutes (600 secs). You can check the current timeout via

cat /sys/module/kernel/parameters/consoleblank

Gluon/OpenWrt is lacking the needed setterm binary to manipulate this timeout. Luckily the timeout is set via a control sequence "\033[<signal>;<value>]". Valid combinations are listed on the console_codes man page.

Linux Console Private CSI Sequences
The following sequences are neither ECMA-48 nor native VT102.  They are native  to  the
Linux console driver.  Colors are in SGR parameters: 0 = black, 1 = red, 2 = green, 3 =
brown, 4 = blue, 5 = magenta, 6 = cyan, 7 = white.
ESC [ 1 ; n ]       Set color n as the underline color
ESC [ 2 ; n ]       Set color n as the dim color
ESC [ 8 ]           Make the current color pair the default attributes.
ESC [ 9 ; n ]       Set screen blank timeout to n minutes.
ESC [ 10 ; n ]      Set bell frequency in Hz.
ESC [ 11 ; n ]      Set bell duration in msec.
ESC [ 12 ; n ]      Bring specified console to the front.
ESC [ 13 ]          Unblank the screen.
ESC [ 14 ; n ]      Set the VESA powerdown interval in minutes.

Knowing that we can disable the timeouts for blanking and monitor switch off

printf '\033[9;0]\033[14;0]'

If you want to make the changes permanent, you can add the line to ~/.profile, which is executed everytime a shell is started. If the file is missing simply create it.

Running command on WAN interface

By default, commands you run on gluon use routing and DNS of the Freifunk mesh. You can run a command "on the WAN interface", using the WAN DNS, by wrapping it in gluon-wan:

gluon-wan nslookup heise.de
gluon-wan ping 1.1.1.1

gluon-wan only affects DNS. For regular traffic, IPv4 is always sent over the Uplink/WAN port, IPv6 always over mesh (except for destination addresses that are directly reachable via Uplink/WAN.

Node Information

Setting location

Check Location settings

uci show gluon-node-info
gluon-node-info.@location[0]=location
gluon-node-info.@location[0].share_location=1
gluon-node-info.@location[0].latitude=53.834470
gluon-node-info.@location[0].longitude=10.702518
gluon-node-info.@location[0].altitude=11.51

Set and Share Location

uci set gluon-node-info.@location[0].latitude=53.834470
uci set gluon-node-info.@location[0].longitude=10.702518
uci set gluon-node-info.@location[0].altitude=11.51
uci set gluon-node-info.@location[0].share_location=1
uci commit gluon-node-info

Don't Share Location

uci set gluon-node-info.@location[0].share_location=0
uci commit gluon-node-info

Setting contact

uci get gluon-node-info.@owner[0] || uci add gluon-node-info owner
uci set gluon-node-info.@owner[0].contact=example@example.com
uci commit gluon-node-info

Check settings

$ uci show gluon-node-info
....
gluon-node-info.@owner[0]=owner
gluon-node-info.@owner[0].contact=example@example.com

Changing hostname

$ pretty-hostname newhostname-with-utf8-support
...
root@newhostname-with-utf8-support:~# 

Check settings

$ pretty-hostname
....
hostname-with-utf8-support
Showing / Setting Hostname without pretty-hostname

Note: this paragraph is meant for routers with old firmware, that may not have 'pretty-hostname', yet. This way utf8-support is not given.

Setting Hostname without pretty-hostname

uci set system.@system[0].hostname='newname'
uci commit system
/etc/init.d/system reload

Showing Hostname without pretty-hostname

$ uci show system
....
system.@system[0].hostname='newname'

Connectivity

Network Reconfiguration

Starting with release 2022.1, the wired network configuration is rebuilt from /etc/config/gluon upon each gluon-reconfigure. Therefore the network configuration is overwritten at least with every firmware upgrade.

Update-Safe configuration can be achieved using the roles API to attach uplink, mesh or client to ports - or add VLAN configurations.

Note, that the role uplink enables access to the private WAN network on ports, but does not require to actually have mesh_vpn enabled (and does not interfer with such settings.

Show switch infos like link status and negotiated speeds (swconfig)

swconfig dev switch0 show

Uplink-Related

The VPN-Uplink (Mesh-VPN) can be enabled and disabled via console.

fastd

Enable fastd (gluon >=v2019.1)

Since Gluon v2019.1, mesh-vpn is configured independently of the used VPN software.

uci set gluon.mesh_vpn.enabled=1
/lib/gluon/mesh-vpn/update-config
uci commit gluon.mesh_vpn.enabled
/etc/init.d/fastd generate_key mesh_vpn
18fa75d1808692f04770bedf30c42dac24585d331560c545d70dd27f22a05648

Disable fastd (gluon >=v2019.1)

Since Gluon v2019.1, mesh-vpn is configured independently of the used VPN software.

/etc/init.d/fastd stop
uci set gluon.mesh_vpn.enabled=0
/lib/gluon/mesh-vpn/update-config
uci commit gluon
Instructions for Gluon < v2019.1 (click to show)

Enable fastd (gluon <v2019.1)

$ uci set fastd.mesh_vpn.enabled=1
$ uci commit fastd
$ /etc/init.d/fastd generate_key mesh_vpn
18fa75d1808692f04770bedf30c42dac24585d331560c545d70dd27f22a05648

Disable fastd (gluon <v2019.1)

/etc/init.d/fastd stop
uci set fastd.mesh_vpn.enabled=0
uci commit fastd

Note: "/etc/init.d/fastd stop" won't stop fastd process if enabled=0.

This will disable Mesh-VPN permanently. If you just want to disable it for example for one hour or until reboot, the preferred method is the following:

Disable fastd for a limited time

You can remotely stop fastd for a while with this script from your console

SECONDS=3600 # one hour
ssh root@your:ipv6::addr:ess '(/etc/init.d/fastd stop && sleep '$SECONDS' && /etc/init.d/fastd start)&'

Enable null@l2tp fastd connections

This requires at least v2022.1 and that the gluon-mesh-vpn-fastd-l2tp package was included during the build process. Later can be checked via opkg status gluon-mesh-vpn-fastd-l2tp (no output means it's missing).

You should check your currently fastd connection methods:

uci show fastd.mesh_vpn.method

Then delete all:

uci del fastd.mesh_vpn.method

and add null@l2tp at first and then the others:

uci add_list fastd.mesh_vpn.method=null@l2tp
uci add_list fastd.mesh_vpn.method=null
# ...

Finally commit the changes and restart fastd:

uci commit fastd.mesh_vpn.method
/etc/init.d/fastd restart

Note: Your community's servers need to support null@l2tp connections.

Show fastd public key

/etc/init.d/fastd show_key mesh_vpn
~>18fa75d1808692f04770bedf30c42dac24585d331560c545d70dd27f22a05648   

Show fastd private key

uci get fastd.mesh_vpn.secret
1234567890123456789012345678901234567890123456789012345678901234    

Set existing fastd private key

uci set fastd.mesh_vpn.enabled=1
uci set fastd.mesh_vpn.secret=1234567890123456789012345678901234567890123456789012345678901234
uci commit fastd
/etc/init.d/fastd stop; /etc/init.d/fastd start

Depending on the setup your community uses this can be helpful to avoid reregistration of your node due to new fastd keys

Tunneldigger

Enable Tunneldigger

$ uci set tunneldigger.mesh_vpn.enabled=1
$ uci commit tunneldigger
$ /etc/init.d/tunneldigger restart

Disable Tunneldigger

/etc/init.d/tunneldigger stop
uci set tunneldigger.mesh_vpn.enabled=0
uci commit tunneldigger

This will disable Mesh-VPN permanently. If you just want to disable it for example for one hour or until reboot, the preferred method is the following:

Disable Tunneldigger for a limited time

You can remotely stop Tunneldigger for a while with this script from your console

SECONDS=3600 # one hour
ssh root@your:ipv6::addr:ess '(/etc/init.d/tunneldigger stop && sleep '$SECONDS' && /etc/init.d/tunneldigger start)&'

VPN bandwidth limitation

Limit Bandwidth with fastd (Gluon <2019.1)

uci set simple-tc.mesh_vpn.limit_egress=800    # upload 0.8 Mbit/s
uci set simple-tc.mesh_vpn.limit_ingress=5000  # download 5.0 Mbit/s
uci set simple-tc.mesh_vpn.enabled=1
uci commit simple-tc
/etc/init.d/fastd restart

Note: Ingress (download) bandwidth limiting with simple-tc is probably not going to work effectively, because the node has no influence on how much data is directed towards it and can only queue or drop overflowing packets, thus degrading the connection rather than limiting it's speed. Use with caution.

Also Note: It is not a good idea to set the upload Bandwidth below 200 (or below 500 in large meshes)

Limit Bandwidth with Tunneldigger (Gluon 2018.2.x)

uci set tunneldigger.mesh_vpn.limit_bw_down=5000  # download 5.0 Mbit/s
uci set simple-tc.mesh_vpn.limit_egress=800       # upload 0.8 Mbit/s
uci set simple-tc.mesh_vpn.enabled=1
uci commit tunneldigger
uci commit simple-tc

Note: Tunneldigger sets the download bandwidth limit on the gateway server, therefor the note about simple-tc above does not apply and download traffic limiting is probably going to work fine.

Also Note: It is not a good idea to set the upload Bandwidth below 200 (or below 500 in large meshes)

Limit Bandwidth (Gluon >=v2019.1)

Since Gluon v2019.1, bandwidth limitations are configured independently of the used VPN software.

uci set gluon.mesh_vpn.limit_egress=800    # upload 0.8 Mbit/s
uci set gluon.mesh_vpn.limit_ingress=5000  # download 5.0 Mbit/s
uci set gluon.mesh_vpn.limit_enabled=1
/lib/gluon/mesh-vpn/update-config
uci commit gluon

Set a static IPv4 for the WAN-Port

uci set network.wan.proto=static
uci set network.wan.ipaddr=XXX.XXX.XXX.XXX
uci set network.wan.netmask=XXX.XXX.XXX.XXX
uci set network.wan.gateway=XXX.XXX.XXX.XXX
uci commit network
/etc/init.d/network restart

DNS server

uci add_list gluon-wan-dnsmasq.@static[0].server=XXX.XXX.XXX.XXX
uci commit gluon-wan-dnsmasq
/etc/init.d/gluon-wan-dnsmasq restart

Enable DHCP for the WAN-Port

uci set network.wan.proto=dhcp
uci commit network
/etc/init.d/network restart

Disable DHCP+DHCPv6 on WAN port

uci set network.wan.proto=none
uci set network.wan6.proto=none
uci commit network
/etc/init.d/network restart

Mesh VXLAN ID (>=2018.1)

The VXLAN ID can be discovered from the domain_seed.

lua -lgluon.util -e 'print(tonumber(gluon.util.domain_seed_bytes("gluon-mesh-vxlan", 3), 16))'

Mesh on LAN

activate

uci add_list gluon.iface_lan.role='mesh'
uci commit gluon
gluon-reconfigure
/etc/init.d/network restart

disable

uci del_list gluon.iface_lan.role='mesh'
uci commit gluon
gluon-reconfigure
/etc/init.d/network restart
Instructions for Gluon < v2022.1 (click to show)

activate (Gluon >=2018.1)

uci set network.mesh_lan.disabled=0
for ifname in $(cat /lib/gluon/core/sysconfig/lan_ifname); do
  uci del_list network.client.ifname=$ifname
done
uci commit network
/etc/init.d/network restart

deactivate (Gluon >=2018.1)

uci set network.mesh_lan.disabled=1
for ifname in $(cat /lib/gluon/core/sysconfig/lan_ifname); do
  uci add_list network.client.ifname=$ifname
done
uci commit network
/etc/init.d/network restart

activate (Gluon >=2016.1.x)

uci set network.mesh_lan.auto=1
for ifname in $(cat /lib/gluon/core/sysconfig/lan_ifname); do
  uci del_list network.client.ifname=$ifname
done
uci commit network
/etc/init.d/network restart

deactivate (Gluon >=2016.1.x)

uci set network.mesh_lan.auto=0
for ifname in $(cat /lib/gluon/core/sysconfig/lan_ifname); do
  uci add_list network.client.ifname=$ifname
done
uci commit network
/etc/init.d/network restart

Mesh on WAN

This will change the behaviour of the WAN port (on most devices the blue port) so you can directly connect other nodes on the WAN port that also have enabled any of Mesh-on-WAN or Mesh-on-LAN.

activate

uci add_list gluon.iface_wan.role='mesh'
uci commit gluon
gluon-reconfigure
/etc/init.d/network restart

disable

uci del_list gluon.iface_wan.role='mesh'
uci commit gluon
gluon-reconfigure
/etc/init.d/network restart
Instructions for Gluon < v2022.1 (click to show)

activate (Gluon >=2018.1.x)

uci set network.mesh_wan.disabled=0
uci commit network
/etc/init.d/network restart

Note:

  1. If you now connect your WAN port to your Home Router too and don't configure some additional VLAN, the whole mesh traffic will also be pushed into your local network, which might cause problems.
  2. Be sure to have VPN disabled, otherwise this connection would build up another fastd tunnel inside the Freifunk net.

deactivate (Gluon >= 2018.1.x)

uci set network.mesh_wan.disabled=1
uci commit network
/etc/init.d/network restart

activate (Gluon <=2017.1.x)

uci set network.mesh_wan.auto=1
uci commit network
/etc/init.d/network restart

deactivate (Gluon <= 2017.1.x)

uci set network.mesh_wan.auto=0
uci commit network
/etc/init.d/network restart

create a Mesh VLAN on one port

You can add mesh-on-lan in a given VLAN on one port (for example while the lan ports have the client role). Here, we are creating a new interface with tagged VLAN 8

uci set gluon.iface_lan_vlan8=interface
uci set gluon.iface_lan_vlan8.name='eth0.8'
uci add_list gluon.iface_lan_vlan8.role='mesh'
uci commit gluon
gluon-reconfigure
reboot

switch to legacy mode (without VXLAN, Gluon >=2018.1)

uci set network.mesh_wan.legacy='1'
uci commit network
/etc/init.d/network restart

use "legacy='0'" to enable VXLAN based meshing

Mesh on WAN and private WiFi simultaneously

Nowadays, the web-private-wifi package allows an easy configuration through the UI of such configurations.

Instructions for Gluon < v2022.1 (click to show)

(tested & valid for Gluon 2014.4)

Simultaneous configuration of Mesh-on-WAN and a private WiFi network (bridged to your local network on the WAN port) is not usually possible - in Mesh-on-WAN mode B.A.T.M.A.N. consumes the WAN interface completely, no other traffic should use that interface anymore. A private WiFi would not have access to your LAN in this case.

While making only minimal changes to the network configuration of the node, you can achieve both by using a VLAN on your local network (or a second port & cable if you're so inclined and have more than one port available, which isn't covered in this example). Let the node do Mesh-on-WAN directly on the WAN interface, while seperating your private network with a VLAN tag from that interface (mixed untagged/tagged mode). Tagging the mesh traffic is possible too, but needs additional configuration (REORDER_HDR) and isn't covered in this example.

This example is designed to keep as much of the upper level network layout consistent with the default state, in particular the interface br-wan still is the interface which handles local network traffic (Ethernet & WiFi), which is used e.g. by the firewall.
This example uses VLAN id 42. The necessary VLAN configuration of your local network will not be explained.

This example was used on a TP-Link TL-WR841Nv9 which features an additional integrated VLAN aware ethernet switch. This switch and its ports were not used, keeping it available for other tasks and configurations. This also means that this example does work on devices with only one ethernet port.

uci set network.mesh_wan.auto=1
uci set network.mesh_wan.ifname=$(cat /lib/gluon/core/sysconfig/wan_ifname)
uci set network.wan_vlan=device
uci set network.wan_vlan.type=8021q
uci set network.wan_vlan.vid=42
uci set network.wan_vlan.ifname=$(cat /lib/gluon/core/sysconfig/wan_ifname)
uci set network.wan_vlan.name=vlan-wan
uci set network.wan.ifname=vlan-wan

Then configure your private WiFi like you usually would:

RID=0
SSID="privateWLANname"
KEY="yoursecret1337password"
uci set wireless.wan_radio$RID=wifi-iface
uci set wireless.wan_radio$RID.device=radio$RID
uci set wireless.wan_radio$RID.network=wan
uci set wireless.wan_radio$RID.mode=ap
uci set wireless.wan_radio$RID.encryption=psk2
uci set wireless.wan_radio$RID.ssid="$SSID"
uci set wireless.wan_radio$RID.key="$KEY"
uci set wireless.wan_radio$RID.disabled=0
uci set wireless.wan_radio$RID.macaddr="$($(echo "lua -e print(require('gluon.util').generate_mac(3+4*$RID))"))"

And finish it all up:

uci commit wireless
reboot

If you can't reach your node on the WAN port after it has rebooted, you're in the wrong VLAN.

switching WAN network to LAN ports

WAN at all LAN ports (switch mode)

If you don't need Freifunk on LAN but do need more network ports of your local private network, you can use your router as switch.

Using the roles API this can be achieved with:

uci del_list gluon.iface_lan.role='client'
uci add_list gluon.iface_lan.role='uplink'
uci commit gluon
gluon-reconfigure
/etc/init.d/network restart
Instructions for Gluon < v2022.1 (click to show)
uci set network.client.ifname=local-port
uci add_list network.client.ifname=bat0
uci set network.wan.ifname=eth0
uci add_list network.wan.ifname=eth1
uci commit network
/etc/init.d/network restart

For the TP-LINK TL-WDR3600 / TL-WDR4300 / Archer C7 use eth0.1 and eth0.2 instead of eth0 and eth1.

Client network on WAN ports (reverse switch mode)

uci del_list gluon.iface_wan.role='uplink'
uci add_list gluon.iface_wan.role='client'
uci del_list gluon.iface_lan.role='client'
uci add_list gluon.iface_lan.role='uplink'
uci commit gluon
gluon-reconfigure
/etc/init.d/network restart
Instructions for Gluon < v2022.1 (click to show) ````shell uci set network.client.ifname=eth0 uci add_list network.client.ifname=local-port uci add_list network.client.ifname=bat0 uci set network.wan.ifname=eth1 uci commit network /etc/init.d/network restart ````

Wireless configuration

All tasks are per radio. If you've got only a single radio (2.4GHz only or 5GHz only) it is usually named radio0. On dualband devices you have to apply the setting to each radio. On dual-band devices the radios are usually named radio0 for 2.4GHz and radio1 for 5GHz. If in doubt check using uci show wireless - each radio should display a value "hwmode" - 11g or 11ng are 2.4GHz, 11a or 11na are 5GHz. The following examples are radio0 only.

Helpful tools

iw, iwinfo e.g.

# list devices by phy and current radio properties (freq,channel,width,tx-power by phy# etc.)
iw dev
# show info for all devices
iwinfo
# list all connected clients to dev client0
iwinfo client0 assoclist
# both tools can do much more, ask them about it
iw --help
iwinfo --help

Disable Client Network

This will disable the client network while the mesh network stays active:

deactivate

uci set wireless.client_radio0.disabled=1
uci commit wireless
wifi

activate

uci set wireless.client_radio0.disabled=0
uci commit wireless
wifi

Disable IBSS/Ad-Hoc Mesh Network

deactivate (Gluon >=2016.1.x)

uci set wireless.ibss_radio0.disabled=1
uci commit wireless
wifi

activate (Gluon >=2016.1.x)

uci set wireless.ibss_radio0.disabled=0
uci commit wireless
wifi

If you have 2.4GHz and 5GHz, enable/disable both (or according to your needs):

uci set wireless.ibss_radio0.disabled=1
uci set wireless.ibss_radio1.disabled=1
uci commit wireless
wifi

Disable 802.11s Mesh Network

deactivate

uci set wireless.mesh_radio0.disabled=1
uci commit wireless
wifi

activate

uci set wireless.mesh_radio0.disabled=0
uci commit wireless
wifi

Change wireless channel

uci set wireless.radio0.channel=X
uci commit wireless
wifi 

Please keep in mind changing the channel can prevent nearby devices from meshing with your router.

Preserve changed channels during update:

uci set gluon.wireless.preserve_channels='1'
uci commit gluon
Instructions for Gluon < v2022.1 (click to show)
uci set gluon-core.@wireless[0].preserve_channels='1'
uci commit gluon-core

activate Outdoor Mode

uci set gluon.wireless.outdoor='1'
uci commit gluon
gluon-reconfigure
reboot

set htmode

to increase the bandwith in Outdoor Mode, one can set the htmode to something else than HT20. Tod do so first, find out possible htmodes using:

iwinfo client0 htmodelist or iwinfo client1 htmodelist

while the number behind is the MHz of channel width

 HT - 802.11n
VHT - 802.11ac
 HE - 802.11ax

Then one can set the htmode for the respective radio. 5GHz Wifi is not always radio1

uci set gluon.wireless.outdoor_radio1_htmode='VHT40'
uci commit gluon
gluon-reconfigure
reboot

PoE passthrough

PoE passtrough can be set since Gluon >=2016.2.x

activate

uci set system.gpio_switch_poe_passthrough.value=1
uci commit system
/etc/init.d/gpio_switch restart

deactivate

uci set system.gpio_switch_poe_passthrough.value=0
uci commit system
/etc/init.d/gpio_switch restart

Custom Update Safe Configuration

Network configurations and changed files are overwritten with every sysupgrade, to keep configurations, one can use the following hacks. This is generally discouraged and a dedicated package should be used instead if possible for your modifications.

Regular Jobs

To execute custom jobs regularly, you can add a micron.d job by adding a file to /usr/lib/micron.d/yourfilename.

To echo the current date to a custom logger every morning at 01:05 add the following file content:

5 1 * * * logger -s -t "date_topic" -p 5 "The Time is `date`"

As micron.d is much smaller than openwrt cron it does not support custom aliases like @reboot or @daily

Execution on Boot

To execute a script on boot, the content can be added to /etc/rc.local. This can be used to make sure additional packages are installed or change other configurations.

You must be sure, that this is late enough, else, your config does not seem to work, as it is overwritten by the later init process. In fact, /etc/rc.local is executed in /etc/rc.d/S95done which is directly running before S96led.

Disable LEDs on boot

So to change the LED configuration, we should be after S96led. We can do this by creating a new file: /etc/rc.d/S97ledchange

To disable all LEDs on boot, we can add the following content to /etc/rc.d/S97ledoff:

#!/bin/sh /etc/rc.common
START=97

for i in /sys/class/leds/*; do
	echo 0 > "$i"/brightness
done
/etc/init.d/led stop
logger -s -t "turnoff_led" -p 5 "leds turned off"

of course, don't forget to set the executable bit:

chmod +x /etc/rc.d/S97ledoff

Update proof way

while the above is quite neat, it is not update-safe if not part of a package. To turn the lights off in an update safe way, we can only use the /etc/rc.local file.

We can let something run in a background with it using:

sh -c "sleep 10 && echo 0 > /sys/class/leds/white:status/brightness" &

This turns the led off in the background correctly and persists during sysupgrades

Install SNMP

To add SNMP in a update-proof way, you can add adjust the /etc/config/snmpd according to your expectations. This file is generally not touched during updates. Now add the following to /etc/rc.local to make sure that the snmp service exists and is installed:

sh -c "sleep 240 && opkg update && opkg install snmpd && service restart snmpd" &
exit 0

This does not only look like a dirty hack, but can be quite useful to reduce manual maintenance.

Device specific

TP-Link CPE 210/510/...

WAN-LAN Bridge

uci set network.client.ifname='bat0'              # remove eth0.2 from client net
uci delete network.@switch_vlan[1]                # delete VLAN 2 
uci set network.@switch_vlan[0].ports='0t 4 5'    # set VLAN 1 to Port 4 (LAN)
uci commit network
/etc/init.d/network restart

Ubiquiti

Transmit power on Ubiquiti devices

There is a bug in the current (2015/01) OpenWRT Barrier Breaker which prevents to factor in the antenna gain for transmission power setting. This is still existant in Chaos Calmer (Gluon 2016.1). Therefore your device will actually transmit with higher power than advertised in the web-UI. This is a) usually illegal and b) while clients may receive a great signal they will most likely be unable to answer. To prevent this we lower the power manually.

Nanostation

uci set wireless.radio0.txpower=9
uci commit wireless
wifi

Nanostation M2 loco

uci set wireless.radio0.txpower=12
uci commit wireless
wifi

you can check the currently set transmit power with:

iwinfo client0 txpower

Nanostation webinterface inside the Freifunk network

The NanoStation and other Point-to-Point accesspoints usually have only one network interface. If you use these PtP links for batman-adv traffic, you lose the ability to access the web interface .

WARNING: If you connect two Gluon Routers with VLAN10 on br-client using WAN you'll get a loop. You have been warned...

Tha WAN Interface must not be behind a vswitch

If

cat /lib/gluon/core/sysconfig/wan_ifname

shows for example eth1.4 VLAN tagging is not possible

Settings for Nanostation: here

uci set network.client.ifname="$(cat /lib/gluon/core/sysconfig/lan_ifname) bat0 $(cat /lib/gluon/core/sysconfig/wan_ifname).10"
uci commit network
/etc/init.d/network restart

Additional links

Clone this wiki locally