Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
raspberry_pi:mods:mesh [2017/05/25 20:32]
matthias [IPv6 Setup]
raspberry_pi:mods:mesh [2018/02/23 16:54] (current)
matthias [Mesh config script] without cd but use homedir
Line 16: Line 16:
    - Create Mesh setup script & make it bootable    - Create Mesh setup script & make it bootable
    - Configure Avahi to announce PirateBox    - Configure Avahi to announce PirateBox
 +
 +===== Prereq. =====
 +Check the internet is working and sudo is active:
 +
 +  sudo touch /​tmp/​sudo_test
 +  sudo rm /​etc/​resolv.conf
 +  sudo sh -c 'echo "​nameserver 8.8.8.8"​ > /​etc/​resolv.conf'​
 +  dig google.de | grep -q -e 192.168.77.1 && echo "​error,​ Internet is not working!"​
 +
  
 ===== Software bridge ===== ===== Software bridge =====
 Create the network configuration file for the bridge: Create the network configuration file for the bridge:
 +  ​
   cat <<EOF > piratebox_bridge   cat <<EOF > piratebox_bridge
   Description="​General bridge interface for PirateBox"​   Description="​General bridge interface for PirateBox"​
Line 30: Line 39:
   IP=static   IP=static
   Address=(192.168.77.1/​24)   Address=(192.168.77.1/​24)
-  IP6=no 
   EOF   EOF
   sudo mv piratebox_bridge /​etc/​netctl/​   sudo mv piratebox_bridge /​etc/​netctl/​
Line 40: Line 48:
   sudo sed -i -e '​s|DO_IFCONFIG="​yes"​|DO_IFCONFIG="​no"​|'​ \   sudo sed -i -e '​s|DO_IFCONFIG="​yes"​|DO_IFCONFIG="​no"​|'​ \
       -e '​s|DO_BRIDGE="​no"​|DO_BRIDGE="​yes"​|'​ \       -e '​s|DO_BRIDGE="​no"​|DO_BRIDGE="​yes"​|'​ \
-       /​opt/​piratebox/​conf/​piratebox.conf+      -e '​s|DNSMASQ_INTERFACE="​wlan0"​|DNSMASQ_INTERFACE="​br-lan"​|'​ \ 
 +      ​/​opt/​piratebox/​conf/​piratebox.conf
  
 Edit piratebox.service file for system dependencies Edit piratebox.service file for system dependencies
Line 53: Line 62:
  
 ===== IPv6 Setup ===== ===== IPv6 Setup =====
 +Let's start with fixes on PirateBox 1.1.3
 +
 +    sudo sed -i -e 's| radvd|/​usr/​bin/​radvd|g'​ /​opt/​piratebox/​init.d/​piratebox_alt
 +
 Do the following commands.. ​ Do the following commands.. ​
  
-  sudo sed -i -e "​s|NODE_CONFIG_ACTIVE='​no'​|NODE_CONFIG_ACTIVE='​yes'​|"​ /​opt/​piratebox/​conf/​node.conf 
   PREFIX="​fdc0:​ffea"​   PREFIX="​fdc0:​ffea"​
   FIXED=$(hexdump -n8 -e '/2 ":​%03x"​ ' /dev/random )   FIXED=$(hexdump -n8 -e '/2 ":​%03x"​ ' /dev/random )
Line 61: Line 73:
   prefix=`</​dev/​urandom tr -dc a-zA-Z1-9 | head -c8`   prefix=`</​dev/​urandom tr -dc a-zA-Z1-9 | head -c8`
   work_hostname="​$prefix.piratebox.lan"​   work_hostname="​$prefix.piratebox.lan"​
 +  sudo touch /​opt/​piratebox/​conf/​node.conf
 +  sudo sed -i -e "​s|NODE_CONFIG_ACTIVE='​no'​|NODE_CONFIG_ACTIVE='​yes'​|"​ /​opt/​piratebox/​conf/​node.conf
   sudo sed -i -e "​s|NODE_IPV6_IP=''​|NODE_IPV6_IP='​$V6_GEN_RESULT'​|"​ \   sudo sed -i -e "​s|NODE_IPV6_IP=''​|NODE_IPV6_IP='​$V6_GEN_RESULT'​|"​ \
       -e "​s|NODE_NAME=''​|NODE_NAME='​$prefix'​|"​ \       -e "​s|NODE_NAME=''​|NODE_NAME='​$prefix'​|"​ \
Line 66: Line 80:
   sudo sed -i -e '​s|IPV6_ENABLE="​no"​|IPV6_ENABLE="​yes"​|'​ \   sudo sed -i -e '​s|IPV6_ENABLE="​no"​|IPV6_ENABLE="​yes"​|'​ \
               -e "​s|fdc0:​ffea::​1|$V6_GEN_RESULT|"​ \               -e "​s|fdc0:​ffea::​1|$V6_GEN_RESULT|"​ \
-               /​opt/​piratebox/​conf/​ipv6.conf+              ​/​opt/​piratebox/​conf/​ipv6.conf 
 +  echo "​IP6=static 
 +  Address6=($V6_GEN_RESULT/​64)"​ > ipv6.netctl  
 +  sudo sh -c 'cat ipv6.netctl >> /​etc/​netctl/​piratebox_bridge'​ 
 +  echo " 
 +  OK. 
 +  Please note the following infos: 
 +     ​Generated node name: $work_hostname 
 +     ​Generated IPv6: $V6_GEN_RESULT 
 +     ​Prefix:​ /64 
 +  " 
 + 
 +===== Mesh config script ===== 
 +This step assumes, that you have a working network connection and the wifi adapter for mesh is the 2nd (phy1). 
 + 
 +  sudo sh -c 'echo "​br_netfilter"​ > /​etc/​modules-load.d/​netfilter.conf'​ 
 +  sudo modprobe br_netfilter 
 +  sudo pacman -Sy --noconfirm batctl 
 +  wget https://​github.com/​PirateBox-Dev/​PirateBox-Mesh/​releases/​download/​1.1.4/​piratebox-mesh_1.1.4_all_NON_WRT.sh 
 +  chmod a+x piratebox-mesh_1.1.4_all_NON_WRT.sh 
 +  sudo mv piratebox-mesh_1.1.4_all_NON_WRT.sh /​bin/​piratebox-mesh.sh 
 +  sudo sed -i -e '​s|phy0|phy1|g' ​ \ 
 +     -e '​s|MESH_CHANNEL=0|MESH_CHANNEL=6|'​ \ 
 +     -e '​s|EXCHANGE_MAC="​yes"​|EXCHANGE_MAC="​no"​|'​ \ 
 +     /​bin/​piratebox-mesh.sh 
 +   
 +Create a start/stop script: 
 + 
 +  cat <<EOF > ~/​mesh.service 
 +  [Unit] 
 +  Description=PirateBox Mesh Service 
 +  PartOf=netctl@piratebox_bridge.service  
 +   
 +  [Service] 
 +  Type=idle 
 +  RemainAfterExit=yes 
 +  ExecStart=/​bin/​piratebox-mesh.sh start  
 +  ExecStop=/​bin/​piratebox-mesh.sh stop 
 +   
 +  [Install] 
 +  WantedBy=multi-user.target 
 +  EOF 
 +  sudo mv ~/​mesh.service /​etc/​systemd/​system 
 +  sudo systemctl daemon-reload 
 +  sudo systemctl start mesh.service  
 +  sudo systemctl enable mesh.service  
 + 
 +===== AVAHI ===== 
 + 
 +  sudo mv /etc/avahi /​etc/​avahi.old 
 +  sudo ln -s /​opt/​piratebox/​conf/​avahi/​ /​etc/​avahi 
 +  sudo systemctl start avahi-daemon 
 +  sudo systemctl enable ​ avahi-daemon 
 +   
 +===== Finalize ===== 
 +At the end you should do a reboot
  
 +  sudo reboot