Two uses for Single Board Computers

Abdun Nihaal
https://nihaal.me
11 September 2021 at ILUGC
Creative Commons License

Single Board Computers

  • Low power computers
  • Can run Linux
  • Eg: Raspberry Pi, Beagle Bone, etc
  • IoT applications, Home servers

Image by Kevin Partner from Pixabay

Setup Static IP

  • Need Static IP to connect
  • Add to /etc/dhcpcd.conf

    interface wlan0
    static ip_address=192.168.0.200/24
    static routers=192.168.0.1
    static domain_name_servers=192.168.0.1      
    

Reducing power consumption

  • Setup SSH and run headless (without monitor)
  • Power off HDMI ports

    /bin/tvservice -o
    
  • Unplug peripherals
  • Turn off LEDs

Extending SD card life

  • Disable Swap (try zram instead)
  • Disable Journalling in Ext4 filesystems
  • Frequently written to directories
    1. Mount them from USB drive (/home)
    2. Use tmpfs (/var/log, /tmp)

1. IRC Bounce server with ZNC

znc.png

What is IRC Bounce server?

Sorry, your browser does not support SVG.

ZNC Installation

  • Installing and configuring ZNC

    sudo apt-get install znc
    znc --makeconf
    
  • Making it start at boot

    crontab -e
    # Add "@reboot znc" to the end
    
  • Has a Web interface for configuration

    https://<sbc_ip_address>:<znc_port>
    

Connecting from an IRC client (Weechat)

  • Add and connect to ZNC server

    /server add rpi <sbc_ip_address>/<znc_port>
        -username=user -password=pass
        -ssl -autoconnect
    /save
    /connect rpi
    
  • Set up SSL fingerprint

    cat ~/.znc/znc.pem |\
        openssl x509 -sha512 -fingerprint -noout |\
        tr -d ':' | tr 'A-Z' 'a-z' | cut -d = -f 2
    

2. Pi Hole

Sorry, your browser does not support SVG.

What is Pi Hole?

  • Blocks ads and trackers
  • DNS sinkhole
  • Network wide blocking
  • Blocks in-app ads
  • Uses a list of common tracker URLs

How it works? For normal requests

Sorry, your browser does not support SVG.

How it works? For Ad requests

Sorry, your browser does not support SVG.

Pi hole Installation

  • Installation script

    curl -sSL https://install.pi-hole.net | bash
    
  • Change admin password

    pihole -a -p
    
  • Has a easy to use web interface

    https://<ip_address>/admin
    

Changing DNS to point to Pi Hole (2 ways)

  1. Change DNS on specific devices
    • On Linux
      • /etc/resolv.conf
      • /etc/systemd/resolved.conf
    • On Android
      • Under Advanced WiFi settings
  2. Change DNS on the WiFi router
    • Through your router interface

Thanks

Links