11
Deploying prplMesh on Gl.iNet
Oguz Ozhan edited this page 2022-11-15 08:29:27 +00:00

[[TOC]]

Flashing the image over the factory firmware

Note: if your have Gl.iNet B1300 loaded with Minim firmware or it has already been flashed with PrplWRT or OpenWRT then upgrade over Web UI or using sysupgrade command. The default IP address of the routers running Minim firmware is 192.168.11.1, for OpenWRT and PrplWRT it's 192.168.1.1. If you need to flash over original Gl.iNet factory firmware then use method 1 or 2 from the instructions below.

Prepare You PC

  • Connect your PC using an Ethernet cable to the Gl.iNet B1300 Ethernet port closest to the USB socket.
  • Configure your PC to have static IP address 192.168.1.2 netmask 255.255.255.0

Method 1 (Using Browser from Bootloader):

  • Unplug the power connector
  • Push down the Reset button (the left one if facing the buttons, it's marked with a circular arrow)
  • While holding the Reset button plug in the power connector.
  • Wait approximately 20sec (the LEDs will change from [on on on] to [on off on] and finally [on on off])
  • Release the Reset button
  • Point your WEB browser to http://192.168.1.1 (you should see the firmware upgrade UI)
  • Use the WEB browser to upload and flash the new firmware.

Method 2 (Using TFTP):

  • Set up a TFTP server on your PC (unless already have one)
  • Copy the firmware file to the TFTP server root folder
  • Rename the firmware file to "lede-gl-b1300.bin"
  • Power cycle Gl.iNet B1300
  • Use TFTP logs or wait approximately 20sec till the device boots and the upload is complete
  • Use ping, SSH client or WEB browser to determine when flashing is complete and OpenWRT firmware has booted (the default OpenWRT IP address is also 192.168.1.1).

Method 3 (Using Browser from Luci)

  • Amazon CA (Amazon description includes 'OpenWrt') comed shipped running a factory OS that is openwrt (images below)
  • Navigate right to luci, running behind the factory GUI http://192.168.8.1/cgi-bin/luci (no password set)
  • Drop a prpl sysupgrade binary just like any OpenWrt/Prpl upgrade, choose to not save settings, and wait for the device to reboot at 192.168.1.1 alt text alt text

Method 4 (Using SSH)

If you already have OpenWrt or a derivative running on the device, you can upgrade it like so:

  • Copy the image to the device over ssh:
scp openwrt-ipq40xx-generic-glinet_gl-b1300-squashfs-sysupgrade.bin root@192.168.1.1:/tmp
  • SSH into the device and do the upgrade:
sysupgrade -v /tmp/openwrt-ipq40xx-generic-glinet_gl-b1300-squashfs-sysupgrade.bin

Configure Gl.iNet B1300 for running PrplMesh

Note: the instructions below assume you are starting with the default config (if not, you can use Web UI or firstboot command to clear the current config and then reboot the device to boot with the system defaults).

  • Point your WEB browser to http://192.168.1.1
  • Set a password
  • Open a terminal session using ssh root@192.168.1.1 or, alternatively, open a serial console (there's no soldering involved as the connector is already on the board, you just need to hook up any 3.3v TTL-to-USB dongle, see https://docs.gl-inet.com/en/2/hardware/b1300/)
  • Make sure both radios are enabled, for example:
uci set wireless.radio0.disabled=0
uci set wireless.radio1.disabled=0

-Set up the device as an extender or a router By default the device is a router. If you'd like to set it up as an extender, delete the WAN bridge, move eth1 to the LAN bridge and change LAN to use DHCP instead of the static IP assignment, for example:

# Disable DHCP servers
/etc/init.d/odhcpd disable
/etc/init.d/dnsmasq disable

# Remove all firewall rules
uci delete firewall.@zone[2]
uci delete firewall.@zone[1]
uci delete firewall.@zone[0]
uci delete firewall.@forwarding[0]
for j in $(seq 0 20); do uci delete firewall.@rule[0]; done

# Remove WAN interface
uci delete network.wan
uci delete network.wan6

# Reconfigure DHCP client for bridge over LAN and WAN ports
uci delete network.lan.ipaddr
uci delete network.lan.netmask
uci delete network.lan.ip6assign
uci delete network.globals.ula_prefix
uci set network.lan.proto=dhcp
uci set network.lan.ipv6=0
uci set network.lan.ifname='eth0 eth1'
uci set network.lan.stp=1

# Configure the WAN port as the backhaul interface (even for wireless backhaul)
# Currently prplmesh checks if the wired backhaul is up, and waits for wireless connection if it's not.
uci set prplmesh.config.backhaul_wire_iface=eth1

# If you use wireless backhaul, add some STA interfaces:
uci set wireless.default_radio11=wifi-iface
uci set wireless.default_radio11.device='radio0'
uci set wireless.default_radio11.mode='sta'
uci set wireless.default_radio11.wps_pushbutton='1'
uci set wireless.default_radio11.wps_config='push_button'
uci set wireless.default_radio11.network='lan'
uci set wireless.default_radio11.multi_ap='1'
uci set wireless.default_radio11.default_disabled='1'
uci set wireless.default_radio21=wifi-iface
uci set wireless.default_radio21.device='radio1'
uci set wireless.default_radio21.mode='sta'
uci set wireless.default_radio21.wps_pushbutton='1'
uci set wireless.default_radio21.wps_config='push_button'
uci set wireless.default_radio21.network='lan'
uci set wireless.default_radio21.multi_ap='1'
uci set wireless.default_radio21.default_disabled='1'
uci set prplmesh.radio0.hostap_iface='wlan0-1'
uci set prplmesh.radio0.sta_iface='wlan0'
uci set prplmesh.radio0.hostap_iface_steer_vaps='wlan0-1'
uci set prplmesh.radio1.sta_iface='wlan1'
uci set prplmesh.radio1.hostap_iface='wlan1-1'
uci set prplmesh.radio1.hostap_iface_steer_vaps='wlan1-1'


uci commit
  • Set up prplMesh to run the controller and the agent, only the agent or only the controller. By default prplMesh runs the controller and the agent. If you'd like to run the agent only then modify the configuration, for example:
uci set prplmesh.config.management_mode='Multi-AP-Agent'                                 
uci set prplmesh.config.operating_mode='WDS-Repeater'
uci set prplmesh.config.wired_backhaul=1
uci set prplmesh.config.master=0
uci set prplmesh.config.gateway=0
  • Add required wireless interfaces and configure their operation mode as ap or sta The script in tests/certification/turris-omnia/uci.sh in the prplMesh repository can be used for that.

  • Configure unique MAC address on the LAN bridge interface, for example:

uci set network.lan.macaddr="00:01:02:03:44:F0"
  • Configure unique MAC addresses on the interfaces, for example:
uci set wireless.default_radio0.macaddr="00:01:02:03:44:05"
uci set wireless.default_radio1.macaddr="00:11:12:13:44:15"
  • Commit and apply the changes
uci commit
/etc/init.d/network restart
/etc/init.d/prplmesh restart
  • Verify that all the MAC addresses are unique, for example:
root@MINIM:/# ifconfig | grep HWaddr
br-lan Link encap:Ethernet HWaddr 00:01:02:03:44:F0
eth0 Link encap:Ethernet HWaddr E4:95:6E:45:12:34
eth1 Link encap:Ethernet HWaddr E4:95:6E:45:56:78
wlan0 Link encap:Ethernet HWaddr 00:11:12:13:44:15
wlan1 Link encap:Ethernet HWaddr 00:01:02:03:44:05

Building PrplMesh for Gl.iNet B1300 from local sources and deploying

This section describes how to proceed from building PrplMesh-enabled firmware image to working on the PrplMesh sources. It is for developers who would like to modify the PrplMesh code and run/debug it on the Gl.iNet B1300 device. You have to be able to build the firmware image and flash it to the device according to the above instructions before proceeding here.

  • Clone PrplMesh repo (outside of the PrplWRT repo folder, the instructions assume you start in that folder)
cd ..
git clone https://gitlab.com/prpl-foundation/prplmesh/prplMesh.git

Let's assume the PrplMesh repo folder ends up being /work/new/prplMesh

  • Go back to the PrplWRT folder and build prplMesh from sources in /work/new/prplMesh
cd ./prplwrt
make package/prplmesh/clean V=s
rm -Rf ./prplMesh/build
make package/prplmesh/prepare USE_SOURCE_DIR=/work/new/prplMesh V=s
make package/prplmesh/compile V=s

If the build is successful you should have the IPK file ready to deploy to the device

user@ubuntu16-64:/work/new/prplwrt$ ls -l ./bin/packages/*/feed_prpl/prplmesh-*.ipk
-rw-r--r-- 1 user user 3166269 Sep 18 16:38 ./bin/packages/arm_cortex-a7_neon-vfpv4/feed_prpl/prplmesh-nl80211_1.4.0-eb2327daaff7c4e5071dcfb9ddd75c88f2b747a7-1.4.0_arm_cortex-a7_neon-vfpv4.ipk
  • Deploy the new IPK You can deploy using the instructions here or just copy and install the IPK manually.
scp ./bin/packages/arm_cortex-a7_neon-vfpv4/feed_prpl/prplmesh-*.ipk root@192.168.1.1:/tmp/prplmesh.ipk
ssh root@192.168.1.1 opkg install --force-reinstall /tmp/prplmesh.ipk

Note: If you get following error from scp(ssh)

no matching host key type found. Their offer: ssh-rsa

Then please use scp(ssh) with options below

scp -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa ...