IIAB
Internet In A Box
INTRODUCTION
Internet-in-a-Box (IIAB) is a low-cost digital library, consisting of a wireless access point with storage, which users nearby can connect to. The hardware and software from which it is built has changed since 2012, as miniaturization of storage space and electronics progressed. As of 2017, its hardware often consists of a Raspberry Pi with a replaceable storage card.
Scenario: Pros & Cons
| Case | Pros | Cons |
|---|---|---|
| Traveling Abroad | • Portable library of movies, shows, music for morale and entertainment • Educational resources available without roaming charges or connectivity • Lightweight, self-contained — no need to rely on foreign ISPs or public Wi-Fi • Ability to share with fellow travelers or students on the road | • Limited storage space restricts content variety and depth • Risk of seizure at border checkpoints (authorities suspicious of private servers) • Hardware damage or theft during travel • Updates harder to fetch if away from home infrastructure |
| Foriegn Invasion | • Acts as an independent information hub when media/internet is censored • Stores critical survival manuals (first aid, communications, civil defense) • Can serve as a morale and propaganda counter-tool for your group • Runs quietly off low power (solar + battery possible) | • Radio/electromagnetic emissions could be detected if adversaries are scanning • Requires physical defense — loss of the device = loss of local knowledge • Updates impossible if cut off from global internet • Risk of confiscation if discovered by occupying forces |
| Extinction Event | • Provides a long-term knowledge ark (history, medicine, agriculture, engineering) • Small enough to shield in a Faraday cage or metal box • Supports offline education for children and adults • Can keep community culture and language alive | • Long-term storage degradation without regular replication • Without proper shielding, vulnerable to EMP/solar storms • Requires periodic power — not useful if all charging options are lost • Limited interactivity compared to dynamic teaching (just a library, not a teacher) |
Carrier Board
| Manufacter | Model | IO | Price | |
|---|---|---|---|---|
![]() |
DeskPi | Mini Cube | 2x USB 2.0, 2x HDMI, 1Gb LAN, 1x USB-C, 40 GPIO, 1x NVME M-key, | $50 |
INSTALLATION
Requirements
|-----------|-----------|
| Workflow | 30 minutes |
| Hardware | CM4:8GB_RAM:16-64GB_eMMC : $60
| Software | OpenWRT Raspberry Pi Imager rpi boot |
| Network | non-captive portal AP - internet |
| | |
| Optional | Unifi Mini Flex : $30 10k Power Bank : $60 |
Piboot
wkdir C:\Program Files (x86)\Raspberry Pi
- copy drop in files to \msg and \root
- Place CM4/5 into OEM daughter board
- Ensure rpiboot/emmc disable jumper engaged
- Plug micro usb/usb c port into pc
- Open C:\Program Files (x86)\Raspberry Pi directory
- Right click open terminal/ps here
- cmd > ./rpiboot -o -d "C:\Program Files (x86)\Raspberry Pi\msd"
- Power on OEM daughter board
- after eeprom is updated it should mount the emmc as usb drive
Raspi Imager
device | pi4
operating system | custom > c\user\Antzvill\OneDrive\Desktop\openwrt-24.10.2-bcm27xx-bcm2711-rpi-4-squashfs-factory.img.gz
storage | G:<cm4>
Once device storage loaded replace config.txt with provided updated version
/boot/config.txt
[CM4]
dtparam=ant2 # antenna selection | (default){internal} ant1, {external} ant2, {disable both}
otg_mode=1 # enable usb host mode
[all]
# Place your custom settings here.
# Overclock settings from leepspvideo https://www.youtube.com/watch?v=9q1XGHO58>
arm_freq=2147
over_voltage=10
force_turbo=1
Eject CM4
Place CM4 into OpenWrt/IIAB daughter board
Connect device directly to lan port as wifi is disabled by default
Open web browser and proceed to 192.168.1.1 default
Proceed to Network > Wireless
Here you will scan with radio0 for wifi with internet connection
Enter wifi password , DON'T remove all connections associated (keeps preconfig OpenWrt AP)
Now we need to bridge the Wifi with Lan so we can download updates/packages
Edit the new formed wireless and there should be a section under interface configuration to add lan/wwan > save > apply
From here on you should be able to access the UI/SSH from anywhere on the network so disconnect current device from lan port
Web browser login into OpenWrt @192.168.X.XXX find it on your WiFi/ipscanner
Proceed to software and update lists
LUCI INSTALL
Luci upgrade > install
The ARGON theme requires a few packages either find them in the list or putty in and opkg install
luci-compat, luci-lib-ipkg
wget --no-check-certificate -q "https://github.com/jerrykuku/luci-theme-argon/releases/download/v2.3.2/luci-theme-argon_2.3.2-r20250207_all.ipk" -O luci-theme-argon.ipk
opkg install luci-theme-argon.ipk
UPGRADES
opkg update
opkg install luci-app-attendedsysupgrade
Or handle one by one
EXPAND SQUASE FS/eMMC
SOURCE | https://openwrt.org/docs/guide-user/advanced/expand_root
Install packages
opkg update
opkg install parted losetup resize2fs blkid
Download expand-root.sh
wget -U "" -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0"
- Source the script (creates /etc/uci-defaults/70-rootpt-resize and /etc/uci-defaults/80-rootpt-resize, and adds them to /etc/sysupgrade.conf so they will be re-run after a sysupgrade)
'. ./expand-root.sh'
Resize root partition and filesystem (will resize partiton, REBOOT resize filesystem, and REBOOT again)
'sh /etc/uci-defaults/70-rootpt-resize'
M.2/USB
You don't have to use an m.2 drive you have to option of utilizing the second usb port on the deskpi board to mount a 2.0 usb drive that can be mapped to. Be advised that usb memory is more volatile than chipsets on m.2 nvme drives. The process is basically the same for both, setting up partitions and formatting those partitions.
Partition M.2
# SOURCE | GPTv5 - OpenWRT
df -h # display any connected storage (/dev/nvmeXXX) { OPTIONS } lsblk | fdsik -l
ls /dev/nvme* # /dev/nvme0 */dev/nvme0n1*
sudo su # switch to root
# CREATE FIRST PARTITION
gdisk /dev/nvme0n1
> [n] (new partition) > [1] partition number > default start > [+650G] or default end > [enter] Hex code/GUID > [w] (write partition table) > [Y] Proceed?
# CREATE SECOND PARTITION
gdisk /dev/nvme0n1
> [n] (new partition) > [2] partition number > default start (650G) > default end > [enter] Hex code/GUID > [w] (write partition table) > [Y] Proceed?
Format M.2
# SOURCE | {openwrt} (https://openwrt.org/docs/guide-user/storage/usb-drives)
opkg install e2fsprogs kmod-fs-ext4
ls /dev/nvme* # /dev/nvme0 /dev/nvme0n1 */dev/nvme0n1p1* */dev/nvme0n1p2*
mkfs.ext4 /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p2
ls -l /dev/nvme*> Example Output
crw------- 1 root root 243, 0 Dec 31 1969 /dev/nvme0
brw------- 1 root root 259, 0 Oct 2 16:04 /dev/nvme0n1
brw------- 1 root root 259, 2 Oct 2 16:04 /dev/nvme0n1p1
brw------- 1 root root 259, 3 Oct 2 16:06 /dev/nvme0n1p2
mkdir -p /mnt/nvme/kiwix # make a kiwix mount directory
mkdir -p /mnt/nvme/docker # make a docker mount directory
opkg install kmod-nvme kmod-fs-ext4 e2fsprogs parted fdisk
opkg install kmod-usb-storage
opkg install kmod-usb-storage-uas
block info> Example Output
/dev/loop0: UUID="5ea1b6ee-e62f-472c-920b-25bb4600d274" LABEL="rootfs_data" VERSION="1.0" MOUNT="/rom/overlay" TYPE="ext4"
/dev/mmcblk0p1: UUID="6859-BBC4" LABEL="boot" VERSION="FAT16" MOUNT="/boot" TYPE="vfat"
/dev/mmcblk0p2: UUID="29efb356-20b37cde-c97428b8-89208c50" VERSION="4.0" MOUNT="/rom" TYPE="squashfs"
/dev/nvme0n1p1: UUID="fd92f4f1-4fe4-4f9c-80f3-d9e12d81ae93" VERSION="1.0" TYPE="ext4"
/dev/nvme0n1p2: UUID="1080f650-62d0-4024-8741-f6e17bed43af" VERSION="1.0" TYPE="ext4"
copy UUIDs
vi/nano /etc/config/fstab
config 'mount'
option target '/mnt/nvme/kiwix'
option uuid '<nvme0n1p1-UUID>'
option enabled '1'
config 'mount'
option target '/mnt/nvme/docker'
option uuid '<nvme0n1p2-UUID>'
option enabled '1'
Enable and start fstab Service
/etc/init.d/fstab enable
/etc/init.d/fstab start
Test without reboot
block mount
df -h> Example Output
Filesystem Size Used Available Use% Mounted on
/dev/root 5.3M 5.3M 0 100% /rom
tmpfs 3.8G 1.2M 3.8G 0% /tmp
/dev/loop0 13.6G 602.2M 12.4G 5% /rom/overlay
overlayfs:/overlay 13.6G 602.2M 12.4G 5% /
/dev/mmcblk0p1 63.9M 19.0M 44.8M 30% /boot
tmpfs 512.0K 0 512.0K 0% /dev
overlayfs:/overlay 13.6G 602.2M 12.4G 5% /mnt/ssd
/dev/nvme0n1p1 638.7G 2.0M 606.2G 0% /mnt/nvme/kiwix
/dev/nvme0n1p2 1.2T 2.0M 1.1T 0% /mnt/nvme/docker
Copy Files .zim from Desktop
There are two options to move the large files to the partions, you can use an SFTP/FTP program like WinSCP to move them over network or mount the m.2 drive directly into another desktop to copy RECOMMENDED.
- Direct | WARNING If using a windows machine be advised windows will not assign drive letters/mount ext4 partitions
- WSL on the other hand can be used to mount an m.2 reader with nvme drive containing ext4 partitions
- Powershell(Run-as Admin) > wmic diskdrive list brief
Corsair MP600 MICRO SCSI Disk Device \\.\PHYSICALDRIVE1
- Mount m.2 2242 into WSL
- drives formatted as exfat WSL doesn't read that type by default you will need to install two packages to be able to mount source drive.
wsl --mount \\.\PHYSICALDRIVE1 --partition 1 --type ext4
wsl --mount \\.\PHYSICALDRIVE2 --type extfat
Transfer files via wsl
You will now need a linux command terminal; in powershell enter wsl
cp /mnt/wsl/PHYSICALDRIVE2/example_1.zim /mnt/wsl/PHYSICALDRIVE1p2
cp /mnt/wsl/PHYSICALDRIVE2/example_2.zim /mnt/wsl/PHYSICALDRIVE1p2
# etc..
Once finished copying files
wsl --umount \\.\PHYSICALDRIVE1
wsl --umount \\.\PHYSICALDRIVE2
- SFTP/FTP |
opkg install openssh-sftp-serverWinSCP make an SFTP connection while IIAB is powered on and move files over network. Speed depends on wifi connection to IIAB. 3gb.zim took 8mins.
USB-OTG (Panda)
dip switches 1off,2off,3on,4off
opkg update (after reboot)
opkg install kmod-usb-xhci-hcd, usbutils, kmod-mt76x02-usb
lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci-hcd/1p, 480M
|__ Port 001: Dev 002, If 0, Class=[unknown], Driver=hub/4p, 480M
|__ Port 001: Dev 003, If 0, Class=[unknown], Driver=mt76x0u, 480M
reboot
DOCKER
opkg install luci-app-dockerman
LED
Add LED action
TERMINAL
SOURCE | google.search: openwrt luci-app-ttyd not working
putty <@openwrt>:22
uci set ttyd.@ttyd0.interface='0.0.0.0'
uci commit
service ttyd stop
service ttyd start
USER MANAGEMENT
opkg install shadow-useradd
useradd -m -s /bin/ash biggieSmalls
passwd biggieSmalls
usermod -aG root biggieSmalls
enable Luci Login
vi/nano /etc/config/rpcd
config login
option username 'biggieSmalls'
option password '$p$biggieSmalls'
list read '*'
list write '*'
enable new user to execute terminal cmds
vim/nano /etc/sudoers
find root ALL line and add
biggieSmalls ALL=(ALL:ALL) ALL
Portainer
sudo docker pull portainer/portainer-ce:latest || error "Failed to pull latest Portainer docker image!"
sudo docker run -d -p 9000:9000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest || error "Failed to run Portainer docker image!"
Unifi
WARNING First time start up can take up to 8 mins to build database tables, check logs.
docker-compose.yml
# SOURCE | https://github.com/linuxserver/docker-unifi-network-application
services:
unifi-network-application:
image: lscr.io/linuxserver/unifi-network-application:latest
container_name: unifi-network-application
restart: unless-stopped
networks:
- unifi-bridge
# depends_on:
# unifi-db:
# condition: service_healthy
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- MONGO_HOST=unifi-db
- MONGO_DBNAME=unifi-db
- MONGO_PORT=27017
- MONGO_USER=<MONGO_DB_USERNAME>
- MONGO_PASS=<MONGO_DB_PASSWORD>
- MONGO_AUTHSOURCE=admin
- MONGO_TLS=false
volumes:
- ./unifi/config:/config
ports:
- 8443:8443
- 3478:3478/udp
- 10001:10001/udp
- 8080:8080
privileged: false
unifi-db:
image: mongo:4.4.0 # MongoDB versions > 4.2 only supports ARMv8.2 or higher CM4 ARMv8.0
container_name: unifi-db
restart: unless-stopped
networks:
- unifi-bridge
# command: ["mongod", "--bind_ip_all"] # <- important
environment:
- MONGO_INITDB_ROOT_USERNAME=<MONGO_DB_USERNAME>
- MONGO_INITDB_ROOT_PASSWORD=<MONGO_DB_PASSWORD>
# for init script only:
- MONGO_DBNAME=unifi-db
- MONGO_AUTHSOURCE=admin
- MONGO_USER=<MONGO_DB_USERNAME>
- MONGO_PASS=<MONGO_DB_PASSWORD>
volumes:
- ./mongodb/data:/data/db
# - ./mongodb/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
# ports:
# These parameters are separated by a colon and indicate <external>:<internal> respectively.
# - 27017:27017
# ulimits:
# nofile: { soft: 1048576, hard: 1048576 }
# nproc: 524288
# healthcheck:
# test: ["CMD", "mongo", "--quiet", "--eval", "db.adminCommand('ping')"]
# test: ["CMD-SHELL", "mongo --quiet -u \"$MONGO_INITDB_ROOT_USERNAME\" -p \"$MONGO_INITDB_ROOT_PASSWORD\" --authenticationDatabase \"${MONGO_AUTHSOURCE}\" --eval 'db.adminCommand({ping:1}).ok' >/dev/null 2>&1"]
# interval: 10s
# timeout: 10s
# start_period: 60s
# retries: 5
# healthcheck:
# test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/test --quiet
# interval: 10s
# timeout: 10s
# retries: 5
# start_period: 60s
# REQUIRED FOR br-xxxxxx to poplulate with 'ip a'
networks:
unifi-bridge:
driver: bridge
x-casaos:
architectures:
- amd64
- arm64
Settings > System > Interface > switch to legacy
legacy-dash Settings > Network Application > Network application Hostname/IP 192.168.2.1 > check Override inform host with the Network apllication hostname/IP > APPLY CHANGES > User Interface > toggle New User Interface > APPLY CHANGES
Trouble Shooting
DOCKER FIX UNIFI/SQL NETWORK NOT TALKING
after running docker-compose > network created [unifi-network-application_default] in Luci > Docker > networks: unifi-network-applicatoin_default Parent Interface=None GPTv5 response: This means OpenWrt doesn’t know which physical network this Docker network should connect to, so traffic cannot be NATed or routed out — even though docker0 works perfectly.STEP 1 - Identify the bridge name
Get all interfaces/bridges even docker virtual
'ip a'
find "br-xxxXXX" if missing add dedicated network to docker-compose.yml
STEP 2 - Add the interface to OpenWrt
in LuCI:
Go to Network → Interfaces.
Click Add new interface.
Fill in:
- Name: unifi_control
- Protocol: Unmanaged
- Device: Select br-xxxXXX (or whatever your bridge name is).
- Bring up on boot: ✔️
Save & Apply.
STEP 3 - Add to Docker firewall zone
Go to Network → Firewall → Zones.
Edit your docker zone.
Under Covered Networks, check both:
docker (for docker0)
unifi_control (for this new bridge)IMPORTANT
Ensure:
- Input: ACCEPT
- Output: ACCEPT
- Forward: ACCEPT
- Masquerading: ✔️
- MSS Clamping: ✔️
Save & Apply.
Still in Firewall:
Source zone: docker
Destination zone: lan (if UniFi needs to discover APs, switches, etc.)
Destination zone: wwan (internet access)
Restart services
/etc/init.d/firewall restart
/etc/init.d/dockerd restart
Verify NAT rules exist
iptables -t nat -L POSTROUTING -v -n | grep 172.
- Example Output
0 0 MASQUERADE 0 -- * !docker0 172.17.0.0/16 0.0.0.0/0
0 0 MASQUERADE 0 -- * !br-c094a1c12470 172.18.0.0/16 0.0.0.0/0
0 0 MASQUERADE 6 -- * * 172.17.0.2 172.17.0.2 tcp dpt:9000
0 0 MASQUERADE 6 -- * * 172.17.0.2 172.17.0.2 tcp dpt:9443
