# bnetd **Repository Path**: mirrorshq/bnetd ## Basic Information - **Project Name**: bnetd - **Description**: bnetd is not a wireless router, although it looks like one. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2023-04-29 - **Last Updated**: 2026-03-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # bnetd bnetd is not a wireless router, although it looks like one. ## Overview bnetd creates a private network with the following goals: 1. Create a 3-layer fully-connected private network (intranet) using uplink, subnet, and peernet components 2. Automatically enable applications in the private network to access the internet through the gateway 3. Support UPnP/NAT-PMP for applications to automatically expose services through the gateway 4. Let users control network settings by balancing cost, security, and access quality ## Architecture bnetd instances form a directed acyclic graph: - **UpLink**: Connect to parent node (receives IP from parent) - **SubNet**: Connect to child nodes (allocates IP to children) - **PeerNet**: Direct peer-to-peer connections ### Key Components - **Plugin System**: Extensible plugin architecture for different network types - **Egress Management**: Manages gateway and proxy configurations - **Prefix Pool**: Manages IP prefix allocations - **Traffic Manager**: Handles network traffic routing ### Gateway Types 1. **Normal Gateway**: Uses netns+veth pair, cannot access bnetd internal network 2. **Inline Gateway (Internal)**: Uses loopback or tun interface, accessible from bnetd internal ## Directory Structure ``` bnetd/ ├── bnetd # Main daemon executable ├── lib/ # Python library modules │ ├── bnet_api.py │ ├── bnet_daemon.py │ ├── bnet_egress_target.py │ ├── bnet_gateway.py │ ├── bnet_mgr_obconn.py │ ├── bnet_mgr_uplink.py │ ├── bnet_param.py │ ├── bnet_plugin.py │ ├── bnet_resrc.py │ ├── bnet_traffic.py │ ├── bnet_util.py │ └── plugin/ # Plugin directory ├── libexec/ │ ├── bnetd-gateway.py │ ├── Cargo.toml │ └── netlink-helper.rs # Rust helper for netlink operations ├── python3/bnetd/ # Public Python API library ├── etc/ # Configuration directory ├── systemd/ # Systemd service files └── doc/ # Documentation ``` ## Requirements - Linux - Python 3.13+ - GLib (for main loop) - Rust (for netlink-helper) ## Installation ```bash make sudo make install ``` ## Configuration Configuration files are stored in `/etc/bnetd/`: - `global.json`: Global settings including UUID - `settings.json`: Runtime settings (uplink/obconn auto-connect, gateway settings) - `uplink/`: Uplink connection configurations - `obconn/`: Outbound connection configurations ## Usage ### Start the daemon ```bash bnetd ``` ### With debug logging ```bash bnetd -d DEBUG ``` ### Systemd service ```bash sudo systemctl start bnetd sudo systemctl enable bnetd ``` ## Plugin Development Plugins are stored in `/usr/lib64/bnetd/plugin/` and must contain: 1. `metadata.xml`: Plugin metadata 2. Python module implementing the plugin class Example plugin structure: ``` plugin_name/ ├── metadata.xml └── __init__.py ``` See `doc/template_*.py` files for plugin templates. ## API Library The Python library at `python3/bnetd/` provides: - Plugin base classes (UpLinkPluginBase, SubNetPluginBase, PeerNetPluginBase, ObConnPluginBase) - Egress target classes for proxy configuration - Connection base classes ## License GPLv3 License