Compare commits
10
Commits
b12c2ff590
...
03ad28afcf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03ad28afcf | ||
|
|
06211f6959 | ||
|
|
49d690e316 | ||
|
|
32e9f16115 | ||
|
|
b14130a6d4 | ||
|
|
154cb2d2a7 | ||
|
|
76a1ca6966 | ||
|
|
5cba133ff7 | ||
|
|
711b89f42d | ||
|
|
57916c4308 |
No files matched your search
@@ -1,32 +1,196 @@
|
|||||||
# open-community-net
|
<div align="center">
|
||||||
|
|
||||||
Open source toolkit for building a **community-owned network**: socket-level code,
|
<table border="0" style="border: none; background: transparent;">
|
||||||
a lab 4G/5G stack (srsRAN + Open5GS), an OpenWrt mesh, a gateway, and monitoring.
|
<tr style="border: none; background: transparent;">
|
||||||
|
<td align="center" valign="middle" style="border: none; padding-right: 25px;">
|
||||||
|
<a href="https://airaaigroup.in" target="_blank">
|
||||||
|
<img src="assets/logo.png" width="95" alt="Aira Group of Technology Logo" style="border-radius: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);" />
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="middle" style="border: none; padding: 0 15px;">
|
||||||
|
<h1 align="center" style="margin: 0; font-size: 2.3em; font-weight: 800; border-bottom: none;">
|
||||||
|
📡 Aira Internet Tower (AIT)
|
||||||
|
</h1>
|
||||||
|
<p align="center" style="margin: 8px 0 0 0; font-size: 1.05em; color: #38bdf8; font-weight: 600;">
|
||||||
|
Sovereign Open-Source Community Cellular (4G/5G) & Wireless Mesh Telecommunications Blueprint
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td align="center" valign="middle" style="border: none; padding-left: 25px;">
|
||||||
|
<img src="assets/tower.svg" width="95" alt="Aira Internet Tower Icon" style="border-radius: 50%; box-shadow: 0 4px 20px rgba(37,99,235,0.4);" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
> ⚠️ **Legal first.** In India, transmitting on mobile bands (700/900/1800/2100/2300/2500 MHz, 3.3 GHz)
|
<p align="center">
|
||||||
> without a DoT/WPC licence is illegal and interferes with real networks.
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
|
||||||
> Everything in `lab-4g5g/` is for **cable-connected or shielded-box testing only**, using the
|
<a href="https://open5gs.org/"><img src="https://img.shields.io/badge/Core-Open5GS-008080.svg" alt="Core: Open5GS"></a>
|
||||||
> test PLMN 001/01 at minimal power. See `docs/01-legal-india.md`.
|
<a href="https://www.srsran.com/"><img src="https://img.shields.io/badge/RAN-srsRAN-orange.svg" alt="RAN: srsRAN"></a>
|
||||||
|
<a href="https://openwrt.org/"><img src="https://img.shields.io/badge/Mesh-OpenWrt%20%7C%20B.A.T.M.A.N.--adv-0099e5.svg" alt="Mesh: OpenWrt"></a>
|
||||||
|
<a href="https://www.wireguard.com/"><img src="https://img.shields.io/badge/Tunnel-WireGuard-88171a.svg" alt="Security: WireGuard"></a>
|
||||||
|
<a href="https://grafana.com/"><img src="https://img.shields.io/badge/Telemetry-Prometheus%20%2B%20Grafana-F46800.svg" alt="Telemetry"></a>
|
||||||
|
<a href="https://github.com/adameehanairagroup"><img src="https://img.shields.io/badge/Architect-Er.%20Adam%20Eehan-gold.svg" alt="Architect: Er. Adam Eehan"></a>
|
||||||
|
<a href="https://airaaigroup.in"><img src="https://img.shields.io/badge/Organization-Aira%20Group%20of%20Technology-blueviolet.svg" alt="Organization: Aira Group of Technology"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
## Layout
|
</div>
|
||||||
| Folder | What it is |
|
|
||||||
|---|---|
|
|
||||||
| `docs/` | Overview, legal notes, architecture, roadmap, community model |
|
|
||||||
| `sockets/` | TCP chat, UDP echo, simple file transfer (Python) |
|
|
||||||
| `lab-4g5g/` | Open5GS core + srsRAN eNB/UE configs, docker-compose, SIM provisioning |
|
|
||||||
| `mesh/openwrt/` | OpenWrt + BATMAN-adv mesh configs and node setup script |
|
|
||||||
| `gateway/` | NAT/firewall (nftables), WireGuard uplink, captive portal (CoovaChilli) |
|
|
||||||
| `monitoring/` | Prometheus + Grafana stack |
|
|
||||||
|
|
||||||
## Quick start
|
---
|
||||||
```bash
|
|
||||||
make sockets-demo # run the TCP chat server locally
|
## 🌟 Executive Overview
|
||||||
make lab-up # start Open5GS core in docker (lab only)
|
|
||||||
make monitoring-up # Prometheus + Grafana on :3000
|
**Aira Internet Tower (AIT)** is a complete, sovereign telecommunications architecture designed to eliminate the digital divide in rural, island, and community clusters. Built from the ground up by **Aira Group of Technology**, AIT provides a modular, production-ready framework combining:
|
||||||
|
|
||||||
|
1. **Rooftop-to-Rooftop Wireless Mesh** (OpenWrt + B.A.T.M.A.N.-adv Layer 2 routing)
|
||||||
|
2. **Private Lab 4G/LTE & 5G SA Cellular Stack** (Open5GS + srsRAN SDR Core)
|
||||||
|
3. **Hardened Sovereign Edge Gateway** (nftables firewall, WireGuard backhaul tunnels, CoovaChilli captive portal)
|
||||||
|
4. **Telecom Telemetry & Network Operations Center (NOC)** (Prometheus + Grafana)
|
||||||
|
5. **Low-Level Socket Communication Primitives** (TCP/UDP, chat relays, packet-level transfer)
|
||||||
|
|
||||||
|
Designed specifically for emerging community models (such as **K-FON / BharatNet** integration in Kerala/India, Panchayat-backed village Wi-Fi grids, and university testbeds), this repository contains the complete hardware schematics, software configurations, and deployment scripts necessary to operate a community-owned ISP.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> ⚖️ **Important Regulatory & Legal Compliance Note (India / DoT / WPC):**
|
||||||
|
> Transmitting on cellular licensed spectrum (700 MHz, 800 MHz, 900 MHz, 1800 MHz, 2100 MHz, 2300 MHz, 2500 MHz, and 3.3–3.6 GHz) without an explicit DoT/WPC license or experimental trial authorization is illegal under the Indian Telegraph Act.
|
||||||
|
> The 4G/5G components in `lab-4g5g/` are strictly designed for **cable-connected RF attenuators or Faraday shielded enclosure testing** using the non-interfering test PLMN `001/01` at sub-milliwatt power. For public unlicenced community transmission, always utilize Wi-Fi unlicenced bands (2.4 GHz & 5.8 GHz) via `mesh/openwrt/`. See [`docs/01-legal-india.md`](docs/01-legal-india.md).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🏗️ End-to-End System Architecture
|
||||||
|
|
||||||
|
```text
|
||||||
|
┌────────────────────────────────────────────────────────────────────────┐
|
||||||
|
│ AIRA INTERNET TOWER TOPOLOGY │
|
||||||
|
└────────────────────────────────────────────────────────────────────────┘
|
||||||
|
|
||||||
|
[ COMMUNITY SUBSCRIBERS ] [ TOWER ACCESS & RADIO LAYER ]
|
||||||
|
┌───────────────────────────┐ ┌────────────────────────────────┐
|
||||||
|
│ Smartphones & Laptops │ ◄-Wi-Fi-► │ Outdoor APs / Directional Ant. │
|
||||||
|
│ (Unlicensed 2.4/5.8 GHz) │ │ OpenWrt + B.A.T.M.A.N.-adv Mesh│
|
||||||
|
└───────────────────────────┘ └──────────────┬─────────────────┘
|
||||||
|
│
|
||||||
|
┌───────────────────────────┐ │ Layer 2 Mesh
|
||||||
|
│ LTE / 5G Test Devices │ ◄--RF---► ┌──────────────▼─────────────────┐
|
||||||
|
│ (Shielded / Lab Box) │ (SMA/Att) │ srsRAN eNB/gNB (SDR Transceiver│
|
||||||
|
└───────────────────────────┘ └──────────────┬─────────────────┘
|
||||||
|
│ S1-MME / N2-N3
|
||||||
|
┌──────────────▼─────────────────┐
|
||||||
|
│ Open5GS 4G/5G Cellular Core │
|
||||||
|
│ (MME / SGW / SMF / UPF / HSS) │
|
||||||
|
└──────────────┬─────────────────┘
|
||||||
|
│ SGi / N6 Interface
|
||||||
|
┌──────────────▼─────────────────┐
|
||||||
|
│ Aira Sovereign Edge Gateway │
|
||||||
|
│ • nftables NAT / Security │
|
||||||
|
│ • CoovaChilli Captive Portal │
|
||||||
|
│ • WireGuard Uplink Tunnel │
|
||||||
|
└──────────────┬─────────────────┘
|
||||||
|
│
|
||||||
|
┌──────────────────────┴─────────────────┐
|
||||||
|
▼ ▼
|
||||||
|
┌─────────────────────────────┐ ┌─────────────────┴───────┐
|
||||||
|
│ Upstream Backhaul │ │ Sovereign Telecom NOC │
|
||||||
|
│ (K-FON / BharatNet / Fibre) │ │ (Prometheus + Grafana) │
|
||||||
|
└─────────────────────────────┘ └─────────────────────────┘
|
||||||
```
|
```
|
||||||
|
|
||||||
## Honest note
|
---
|
||||||
Code is free. Fibre, towers, spectrum and electricity are not. See `docs/04-community-model.md`
|
|
||||||
for how communities share those costs (panchayat, K-FON, CSR, membership).
|
|
||||||
|
|
||||||
Licence: MIT (see LICENSE).
|
## 📂 Repository Module Breakdown
|
||||||
|
|
||||||
|
| Directory | Component | Purpose & Technologies |
|
||||||
|
|---|---|---|
|
||||||
|
| [`gateway/`](gateway/) | **Sovereign Edge Gateway** | Production `nftables` stateful NAT, WireGuard encrypted backhaul overlay (`wg0`), and CoovaChilli captive portal authentication. |
|
||||||
|
| [`lab-4g5g/`](lab-4g5g/) | **Private 4G/5G Cellular Core** | Full Open5GS containerized core (MME, AMF, SMF, UPF, PCRF, HSS) + srsRAN SDR configurations and automated SIM provisioning scripts. |
|
||||||
|
| [`mesh/openwrt/`](mesh/openwrt/) | **Decentralized Rooftop Mesh** | OpenWrt router configurations utilizing B.A.T.M.A.N.-adv for self-healing, multi-hop community Wi-Fi backhaul without single points of failure. |
|
||||||
|
| [`monitoring/`](monitoring/) | **Telemetry & NOC Dashboard** | Automated Prometheus metrics scrapers and Grafana dashboards tracking packet loss, SNR, active subscribers, and gateway bandwidth. |
|
||||||
|
| [`sockets/`](sockets/) | **Low-Level Network Primitives** | Pure Python socket engines demonstrating raw TCP state machines, UDP telemetry echoes, and resilient chunked file transmission. |
|
||||||
|
| [`docs/`](docs/) | **Engineering & Legal Blueprints** | In-depth technical documentation covering Indian telecom regulations, architecture designs, roadmaps, and community funding models. |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚡ Hardware Bill of Materials (Recommended Specs)
|
||||||
|
|
||||||
|
To deploy an Aira Internet Tower station for a village or campus hub, the following standard off-the-shelf hardware is recommended:
|
||||||
|
|
||||||
|
| Subsystem | Recommended Hardware | Approximate Cost (INR) |
|
||||||
|
|---|---|---|
|
||||||
|
| **Tower Edge Gateway & Core** | Raspberry Pi 5 (8GB) or Intel N100 Mini PC | ₹7,500 – ₹14,000 |
|
||||||
|
| **Mesh Distribution Nodes** | GL.iNet / TP-Link Archer running OpenWrt | ₹2,500 – ₹4,500 / node |
|
||||||
|
| **Long-Range Outdoor APs** | Ubiquiti NanoStation Loco M5 / TP-Link Pharos | ₹4,000 – ₹6,000 / link |
|
||||||
|
| **SDR Radio (Lab 4G/5G)** | LimeSDR USB / BladeRF x40 / HackRF One (Shielded) | Research bench |
|
||||||
|
| **Power Autonomy** | 100W Monocrystalline Solar Panel + 12V 30Ah LiFePO4 Battery + MPPT | ₹9,000 – ₹12,000 |
|
||||||
|
| **Enclosure & Antennas** | IP67 Weatherproof Outdoor Box + Lightning Surge Protector | ₹3,000 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 Quick Start Guide
|
||||||
|
|
||||||
|
### 1. Run Socket Foundations Demo
|
||||||
|
Test the low-level socket server locally:
|
||||||
|
```bash
|
||||||
|
# Clone the repository
|
||||||
|
git clone https://github.com/adameehanairagroup/AiraInternetTower.git
|
||||||
|
cd AiraInternetTower
|
||||||
|
|
||||||
|
# Launch TCP Chat Relay
|
||||||
|
make sockets-demo
|
||||||
|
```
|
||||||
|
In another terminal, connect as a client:
|
||||||
|
```bash
|
||||||
|
python3 sockets/python/tcp_chat_client.py 127.0.0.1 5000
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Deploy Containerized 4G/5G Open5GS Core (Lab)
|
||||||
|
Start the complete 4G EPC and 5G Core network stack:
|
||||||
|
```bash
|
||||||
|
make lab-up
|
||||||
|
```
|
||||||
|
Provision a test SIM into MongoDB HSS/UDR:
|
||||||
|
```bash
|
||||||
|
./lab-4g5g/scripts/provision_sim.sh 001010000000001 465B5CE8B199B49FAA5F0A2EE238A6BC
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Spin up Telecom Telemetry & NOC Dashboard
|
||||||
|
Launch Prometheus and Grafana for real-time bandwidth and signal tracking:
|
||||||
|
```bash
|
||||||
|
make monitoring-up
|
||||||
|
```
|
||||||
|
* **Grafana Dashboard:** Visit `http://localhost:3000` (Default login: `admin` / `admin`).
|
||||||
|
* **Prometheus Targets:** Visit `http://localhost:9090`.
|
||||||
|
|
||||||
|
### 4. Deploy OpenWrt B.A.T.M.A.N.-adv Mesh Node
|
||||||
|
On your OpenWrt wireless node, copy and apply the mesh configuration:
|
||||||
|
```bash
|
||||||
|
scp -r mesh/openwrt/config/* root@192.168.1.1:/etc/config/
|
||||||
|
ssh root@192.168.1.1 "/etc/init.d/network restart"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🤝 Community Ownership & Governance Model
|
||||||
|
|
||||||
|
The **Aira Internet Tower** architecture is rooted in sustainable community participation:
|
||||||
|
|
||||||
|
* **Panchayat & Rural Fiber Tie-ups:** Connecting community towers to State and Central high-speed backhauls (**K-FON** in Kerala, **BharatNet** nationwide).
|
||||||
|
* **Zero-Rated Civic Tier:** Unlimited free access to government services (e-District, DigiLocker, educational resources, Kiwix offline Wikipedia).
|
||||||
|
* **Student Network Engineers:** Empowering local polytechnic and engineering students to maintain and audit their own community nodes.
|
||||||
|
* **Cooperative Cost Sharing:** Transparent maintenance funds pooled through local resident associations or CSR grants.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👨💻 Founder, Principal Architect & Leadership
|
||||||
|
|
||||||
|
* **Er. Adam Eehan**
|
||||||
|
*Founder & CEO, Aira Group of Technology*
|
||||||
|
*Google Student Ambassador 2026*
|
||||||
|
*Website:* [airaaigroup.in](https://airaaigroup.in)
|
||||||
|
*Email:* [adameehan34@gmail.com](mailto:adameehan34@gmail.com) • [noreply@airaaigroup.in](mailto:noreply@airaaigroup.in)
|
||||||
|
*GitHub:* [@adameehanairagroup](https://github.com/adameehanairagroup)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📜 License & Acknowledgments
|
||||||
|
|
||||||
|
Distributed under the **MIT License**. See [`LICENSE`](LICENSE) for full details.
|
||||||
|
Built with deep appreciation for the open-source telecom pioneers behind **Open5GS**, **srsRAN**, **OpenWrt**, **B.A.T.M.A.N.-adv**, and the **Linux Kernel Networking Subsystem**.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 236 KiB |
@@ -0,0 +1,64 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" width="120" height="120">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="towerGrad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||||
|
<stop offset="0%" stop-color="#38bdf8"/>
|
||||||
|
<stop offset="50%" stop-color="#2563eb"/>
|
||||||
|
<stop offset="100%" stop-color="#1d4ed8"/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="waveGrad" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||||
|
<stop offset="0%" stop-color="#00f2fe"/>
|
||||||
|
<stop offset="100%" stop-color="#4facfe"/>
|
||||||
|
</linearGradient>
|
||||||
|
<filter id="glow" x="-20%" y="-20%" width="140%" height="140%">
|
||||||
|
<feGaussianBlur stdDeviation="2" result="blur" />
|
||||||
|
<feComposite in="SourceGraphic" in2="blur" operator="over"/>
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- Background Circle Glow -->
|
||||||
|
<circle cx="60" cy="60" r="54" fill="#0b1736" stroke="#2563eb" stroke-width="2" stroke-opacity="0.5"/>
|
||||||
|
<circle cx="60" cy="60" r="48" fill="#070e24"/>
|
||||||
|
|
||||||
|
<!-- Radiating Radio Waves (Left & Right) -->
|
||||||
|
<path d="M 44 26 A 22 22 0 0 0 44 48" fill="none" stroke="url(#waveGrad)" stroke-width="2.5" stroke-linecap="round" opacity="0.6"/>
|
||||||
|
<path d="M 37 19 A 32 32 0 0 0 37 55" fill="none" stroke="url(#waveGrad)" stroke-width="2.5" stroke-linecap="round" opacity="0.4"/>
|
||||||
|
<path d="M 30 12 A 44 44 0 0 0 30 62" fill="none" stroke="url(#waveGrad)" stroke-width="2.5" stroke-linecap="round" opacity="0.2"/>
|
||||||
|
|
||||||
|
<path d="M 76 26 A 22 22 0 0 1 76 48" fill="none" stroke="url(#waveGrad)" stroke-width="2.5" stroke-linecap="round" opacity="0.6"/>
|
||||||
|
<path d="M 83 19 A 32 32 0 0 1 83 55" fill="none" stroke="url(#waveGrad)" stroke-width="2.5" stroke-linecap="round" opacity="0.4"/>
|
||||||
|
<path d="M 90 12 A 44 44 0 0 1 90 62" fill="none" stroke="url(#waveGrad)" stroke-width="2.5" stroke-linecap="round" opacity="0.2"/>
|
||||||
|
|
||||||
|
<!-- Tower Mast Legs -->
|
||||||
|
<path d="M 52 38 L 36 102" stroke="url(#towerGrad)" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
<path d="M 68 38 L 84 102" stroke="url(#towerGrad)" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
|
||||||
|
<!-- Cross Bracing Lattice -->
|
||||||
|
<line x1="50" y1="48" x2="70" y2="48" stroke="#38bdf8" stroke-width="2"/>
|
||||||
|
<line x1="46" y1="64" x2="74" y2="64" stroke="#38bdf8" stroke-width="2"/>
|
||||||
|
<line x1="42" y1="80" x2="78" y2="80" stroke="#38bdf8" stroke-width="2"/>
|
||||||
|
<line x1="38" y1="96" x2="82" y2="96" stroke="#38bdf8" stroke-width="2.5"/>
|
||||||
|
|
||||||
|
<!-- Diagonal Lattice Truss -->
|
||||||
|
<line x1="50" y1="48" x2="74" y2="64" stroke="#2563eb" stroke-width="1.5" stroke-opacity="0.8"/>
|
||||||
|
<line x1="70" y1="48" x2="46" y2="64" stroke="#2563eb" stroke-width="1.5" stroke-opacity="0.8"/>
|
||||||
|
<line x1="46" y1="64" x2="78" y2="80" stroke="#2563eb" stroke-width="1.5" stroke-opacity="0.8"/>
|
||||||
|
<line x1="74" y1="64" x2="42" y2="80" stroke="#2563eb" stroke-width="1.5" stroke-opacity="0.8"/>
|
||||||
|
<line x1="42" y1="80" x2="82" y2="96" stroke="#2563eb" stroke-width="1.5" stroke-opacity="0.8"/>
|
||||||
|
<line x1="78" y1="80" x2="38" y2="96" stroke="#2563eb" stroke-width="1.5" stroke-opacity="0.8"/>
|
||||||
|
|
||||||
|
<!-- Antenna Platform & Spire -->
|
||||||
|
<rect x="50" y="34" width="20" height="4" rx="2" fill="#38bdf8"/>
|
||||||
|
<line x1="60" y1="16" x2="60" y2="34" stroke="#67e8f9" stroke-width="3" stroke-linecap="round"/>
|
||||||
|
|
||||||
|
<!-- Transmitter Beacon Light -->
|
||||||
|
<circle cx="60" cy="15" r="4.5" fill="#ef4444" filter="url(#glow)"/>
|
||||||
|
<circle cx="60" cy="15" r="2" fill="#ffffff"/>
|
||||||
|
|
||||||
|
<!-- Microwave Dish Left -->
|
||||||
|
<path d="M 47 42 Q 41 46 47 50" fill="none" stroke="#e0e7ff" stroke-width="2.5" stroke-linecap="round"/>
|
||||||
|
<line x1="45" y1="46" x2="52" y2="46" stroke="#e0e7ff" stroke-width="2"/>
|
||||||
|
|
||||||
|
<!-- Microwave Dish Right -->
|
||||||
|
<path d="M 73 54 Q 79 58 73 62" fill="none" stroke="#e0e7ff" stroke-width="2.5" stroke-linecap="round"/>
|
||||||
|
<line x1="75" y1="58" x2="68" y2="58" stroke="#e0e7ff" stroke-width="2"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.7 KiB |
Executable
+22
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# OpenWrt BATMAN-adv Gateway Mode Configuration
|
||||||
|
# Engineered for Aira Internet Tower (AIT)
|
||||||
|
# Run on the node connected to upstream backhaul (Fibre / K-FON / ISP)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "[*] Configuring B.A.T.M.A.N.-adv Gateway Server Mode..."
|
||||||
|
if command -v batctl >/dev/null 2>&1; then
|
||||||
|
batctl gw_mode server 50mbit/10mbit || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v uci >/dev/null 2>&1; then
|
||||||
|
uci set batman-adv.bat0.gw_mode='server'
|
||||||
|
uci set batman-adv.bat0.gw_bandwidth='50mbit/10mbit'
|
||||||
|
uci commit batman-adv
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Enabling IPv4 packet forwarding in kernel..."
|
||||||
|
sysctl -w net.ipv4.ip_forward=1 >/dev/null 2>&1 || echo "1" > /proc/sys/net/ipv4/ip_forward
|
||||||
|
|
||||||
|
echo "[+] Gateway mode active. Mesh client nodes will automatically route through this uplink."
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
apiVersion: 1
|
||||||
|
datasources:
|
||||||
|
- name: Prometheus
|
||||||
|
type: prometheus
|
||||||
|
url: http://prometheus:9090
|
||||||
|
isDefault: true
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
global: { scrape_interval: 15s }
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: nodes
|
||||||
|
static_configs:
|
||||||
|
- targets: [ "node-exporter:9100" ]
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# sockets
|
||||||
|
- `tcp_chat_server.py` / `tcp_chat_client.py` - multi-user chat (TCP 9000)
|
||||||
|
- `udp_echo.py` - UDP echo (9001)
|
||||||
|
- `file_transfer.py` - raw file transfer (TCP 9002; no encryption, LAN demo only)
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Tiny file transfer. Receive: file_transfer.py recv OUT ; Send: file_transfer.py send HOST FILE"""
|
||||||
|
import socket, sys, os
|
||||||
|
|
||||||
|
PORT = 9002
|
||||||
|
|
||||||
|
if len(sys.argv) < 3 or sys.argv[1] not in ("recv", "send"):
|
||||||
|
print("Usage:\n Receive: python3 file_transfer.py recv <output_file>\n Send: python3 file_transfer.py send <host> <input_file>")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if sys.argv[1] == "recv":
|
||||||
|
with socket.socket() as s:
|
||||||
|
s.bind(("0.0.0.0", PORT)); s.listen(1)
|
||||||
|
print(f"[*] Listening for incoming file transfer on port {PORT}...")
|
||||||
|
conn, a = s.accept()
|
||||||
|
out_filename = os.path.basename(sys.argv[2])
|
||||||
|
with conn, open(out_filename, "wb") as f:
|
||||||
|
while chunk := conn.recv(65536): f.write(chunk)
|
||||||
|
print(f"[+] Successfully received file '{out_filename}' from {a}")
|
||||||
|
else:
|
||||||
|
if len(sys.argv) < 4:
|
||||||
|
print("Usage for send: python3 file_transfer.py send <host> <input_file>")
|
||||||
|
sys.exit(1)
|
||||||
|
target_host = sys.argv[2]
|
||||||
|
source_file = sys.argv[3]
|
||||||
|
if not os.path.exists(source_file):
|
||||||
|
print(f"[-] Error: Source file '{source_file}' does not exist.")
|
||||||
|
sys.exit(1)
|
||||||
|
with socket.create_connection((target_host, PORT)) as s, open(source_file, "rb") as f:
|
||||||
|
print(f"[*] Sending '{source_file}' to {target_host}:{PORT}...")
|
||||||
|
while chunk := f.read(65536): s.sendall(chunk)
|
||||||
|
print("[+] File transmission complete.")
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import socket, sys, threading
|
||||||
|
|
||||||
|
host = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1"
|
||||||
|
port = int(sys.argv[2]) if len(sys.argv) > 2 else 9000
|
||||||
|
|
||||||
|
def reader(s):
|
||||||
|
while data := s.recv(1024):
|
||||||
|
print(data.decode(errors="replace"), end="")
|
||||||
|
print("\n[disconnected]")
|
||||||
|
|
||||||
|
with socket.create_connection((host, port)) as s:
|
||||||
|
threading.Thread(target=reader, args=(s,), daemon=True).start()
|
||||||
|
try:
|
||||||
|
for line in sys.stdin:
|
||||||
|
s.sendall(line.encode())
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Minimal multi-client TCP chat server."""
|
||||||
|
import socket, threading
|
||||||
|
|
||||||
|
HOST, PORT = "0.0.0.0", 9000
|
||||||
|
clients, lock = [], threading.Lock()
|
||||||
|
|
||||||
|
def broadcast(msg, sender):
|
||||||
|
with lock:
|
||||||
|
for c in clients[:]:
|
||||||
|
if c is not sender:
|
||||||
|
try: c.sendall(msg)
|
||||||
|
except OSError: clients.remove(c)
|
||||||
|
|
||||||
|
def handle(conn, addr):
|
||||||
|
with lock: clients.append(conn)
|
||||||
|
print(f"[+] {addr}")
|
||||||
|
try:
|
||||||
|
while data := conn.recv(1024):
|
||||||
|
broadcast(f"{addr[0]}: ".encode() + data, conn)
|
||||||
|
finally:
|
||||||
|
with lock:
|
||||||
|
if conn in clients: clients.remove(conn)
|
||||||
|
conn.close(); print(f"[-] {addr}")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||||
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
|
s.bind((HOST, PORT)); s.listen()
|
||||||
|
print(f"Chat server on {HOST}:{PORT}")
|
||||||
|
while True:
|
||||||
|
conn, addr = s.accept()
|
||||||
|
threading.Thread(target=handle, args=(conn, addr), daemon=True).start()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""UDP echo server (run with 'server') or client (run with 'client HOST')."""
|
||||||
|
import socket, sys
|
||||||
|
|
||||||
|
PORT = 9001
|
||||||
|
if len(sys.argv) > 1 and sys.argv[1] == "client":
|
||||||
|
host = sys.argv[2] if len(sys.argv) > 2 else "127.0.0.1"
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||||
|
s.settimeout(2)
|
||||||
|
s.sendto(b"hello", (host, PORT))
|
||||||
|
print(s.recvfrom(1024))
|
||||||
|
else:
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||||
|
s.bind(("0.0.0.0", PORT)); print(f"UDP echo on {PORT}")
|
||||||
|
while True:
|
||||||
|
data, addr = s.recvfrom(1024); s.sendto(data, addr)
|
||||||
Reference in new issue
Block a user