Skip to content

Commandline administration

Ruben Barkow edited this page Sep 8, 2015 · 192 revisions

Solving various problems on the commandline.

(Re-)entering config mode

# uci set gluon-setup-mode.@setup_mode[0].enabled='1'
# uci commit gluon-setup-mode
# reboot

Setting 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].share_location=1
# uci commit gluon-node-info

Check 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

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=Luftloch

Enabling fastd

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

Limit Bandwidth

# uci set gluon-simple-tc.mesh_vpn.limit_egress=800    # upload 0,8Mbit
# uci set gluon-simple-tc.mesh_vpn.limit_ingress=5000  # download 5,0Mbit
# uci set gluon-simple-tc.mesh_vpn.enabled=1
# uci commit gluon-simple-tc

Set existing fastd private key

# uci set fastd.mesh_vpn.enabled=1
# uci set fastd.mesh_vpn.secret=18fa75d1808692f04770bedf30c42dac24585d331560c545d70dd27f22a05648
# uci commit fastd

Show fastd public key

# /etc/init.d/fastd show_key mesh_vpn
18fa75d1808692f04770bedf30c42dac24585d331560c545d70dd27f22a05648    

Enable mesh on WAN-Port

Note: This will change the behaviour of the WAN port (on most devices the blue port) so you will not be able to connect on it to the Internet any more, but instead you can connect other nodes on the WAN port directly that also have enabled any of Mesh-on-WAN or Mesh-on-LAN.

# uci set network.mesh_wan.auto=1
# uci commit network

Change AutoUpdater Branch

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

Reboot to configmode

# uci set "gluon-setup-mode.@setup_mode[0].enabled=1"
# uci commit
# reboot

WAN-LAN Bridge on CPE210/510

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

PoE passthrough on CPE210/510

echo 20 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio20/direction
echo 1 > /sys/class/gpio/gpio20/value

PoE passthrough on Nanostation M

echo 8 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio8/direction
echo 1 > /sys/class/gpio/gpio8/value

Transmit Power on Nanostation M2

OpenWRT Barrier Breaker hat z.Z. (Jan. 2015) noch den Fehler, dass der Antennengewinn der NSM2 nicht berücksichtigt wird. Sie strahlt also "zu viel". Das führt zwar zu phantastischen Reichweiten, was die Sendeleistung angeht, allerdings kann das Endgerät meist über die Distanz (oder die Hindernisse wie Mauern und der Gleichen) nicht antworten. Man hat also scheinbar freifunk, es geht aber nicht. Da das 1. ärgerlich und 2. verboten ist, setzen wir die Sendeleistung von Hand runter auf 100mW:

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

you can check the currently set transmit power with:

iwinfo radio0 txpower

Achtung: Ab Gluon 2015.1 haben sich Schnittstellen-Namen & txpower geändert. Dementsprechend heisst es dann:

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

you can check the currently set transmit power with:

iwinfo client0 txpower

For the Nanostation M2 loco

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

you can check the currently set transmit power with:

iwinfo client0 txpower

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

DNS server:

# uci set gluon-wan-dnsmasq.@static[0].server=XXX.XXX.XXX.XXX
# uci commit gluon-wan-dnsmasq

Reboot to apply:

# reboot

Mesh on WAN and private WiFi simultaneously

(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:

# uci set wireless.wan_radio0=wifi-iface
# uci set wireless.wan_radio0.device=radio0
# uci set wireless.wan_radio0.network=wan
# uci set wireless.wan_radio0.mode=ap
# uci set wireless.wan_radio0.encryption=psk2
# uci set wireless.wan_radio0.ssid="privates WLAN"
# uci set wireless.wan_radio0.key="geheime Passphrase für mein WLAN"
# uci set wireless.wan_radio0.disabled=0

And finish it all up:

# uci commit
# reboot

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

Mesh on LAN

This will activate mesh on all LAN ports (yellow on most devices)

# aktivate
uci set network.client.ifname="bat0"
uci set network.mesh_lan.auto=1
uci commit network


# deaktivate
uci set network.client.ifname="bat0 $(cat /lib/gluon/core/sysconfig/lan_ifname)"
uci set network.mesh_lan.auto=0
uci commit network

Nanostation webinterface in Freifunk net

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 .

ACHTUNG: Zwei Gluon Router die per WAN Interface zusammengeschaltet werden, wo das Vlan 10 jeweils auf der br-client Bridge verbunden ist, können so einen wunderbaren Loop bauen.

Das WAN Interface darf hierfür nicht hinter einem vswitch liegen.

Wenn also:

cat /lib/gluon/core/sysconfig/wan_ifname

z.B eth1.4 ergibt, funktioniert das Vlan Tagging auf dem Gerät nicht!

Einstellungen für eine Nanostation: Hier

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

Clone this wiki locally