Skip to content

Commandline administration

leeps edited this page Mar 1, 2015 · 192 revisions

Solving various problems on the commandline.

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

# 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

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

Sendeleistung auf 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

Überprüfen kann man die gesetzte Sendeleistung mit:

iwinfo wlan0 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
# 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

# uci set network.client.ifname='bat0'
# uci set network.mesh_lan=interface
# uci set network.mesh_lan.ifname="$(cat /lib/gluon/core/sysconfig/lan_ifname)"
# uci set network.mesh_lan.mesh=bat0
# uci set network.mesh_lan.proto=batadv
# uci commit network


/etc/init.d/network restart

Testen (funktioniert nur, wenn auch ein Kabel eingesteckt ist):

batctl if

sollte nun u.A. eth1: active anzeigen

ubus call network.interface.mesh_lan status

Sollte "up": true anzeigen

Nanostation Webinterface im Freifunk Netz

Die Nanostation und andere PtP Accesspoints besitzen meistens nur ein Netzwerkinterface. Nutzt man diese PtP Links für batman-adv Traffic, verliert man die Möglichkeit auf das Webinterface zuzugreifen.

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 eine wunderbare Loop bauen.

Das Wan Interface darf hierfür nicht hinter einem vswitch liegen. Wenn also:

cat /lib/gluon/core/sysconfig/wan_ifname

sowas wie 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