An intelligent network management tool that automatically detects whether your ROV system is connected to a router or directly to a client device, and creates an Ethernet bridge when needed to allow for sharing of DWEOS's web server.
This application monitors your Ethernet connection and automatically:
-
Detects Router vs Client Connections: Intelligently determines if your Ethernet connection is to a router (with internet access) or to a client device (like a laptop needing internet)
-
Automatic Bridge Creation: When connected to a client device, automatically creates a bridge interface (
br0) to share your internet connection -
DHCP Server Management: Starts a DHCP server using
dnsmasqto assign IP addresses to connected client devices -
Smart Switching: Automatically switches between normal operation (when connected to router) and bridge mode (when sharing connection with clients)
-
Clean Shutdown: Properly cleans up bridge interfaces and DHCP services when stopped
- Zero Configuration: Runs automatically without manual intervention
- Intelligent Detection: Uses multiple methods to verify router connectivity (IP config, gateway, DHCP)
- Robust Bridge Management: Creates and manages Linux bridge interfaces with proper STP configuration
- DHCP Integration: Provides IP addresses to connected clients automatically
- System Integration: Works with NetworkManager and systemd-resolved
- Graceful Cleanup: Properly removes bridge interfaces and restores network settings on exit
- Linux system with NetworkManager
- Python 3.8+
- Root/sudo privileges (required for network interface management)
dnsmasq,net-toolspackage- D-Bus system bus access
git clone <repository-url>
cd wifi-detector# On Ubuntu/Debian:
sudo apt update
sudo apt install dnsmasq net-tools python3-venv python3-pip
# On Fedora/RHEL:
sudo dnf install dnsmasq net-tools python3-venv python3-pip
# On Arch Linux:
sudo pacman -S dnsmasq python python-pip# Create virtual environment
python3 -m venv env
# Activate virtual environment
source env/bin/activate
# Install Python dependencies
pip install -r requirements.txtchmod +x run_with_env.shImportant: This application requires root privileges to manage network interfaces.
sudo ./run_with_env.shWhen bridge mode is active:
- Bridge Interface:
br0 - Bridge IP:
192.168.2.101/24 - DHCP Range:
192.168.2.100-192.168.2.200 - Lease Time: 24 hours
- NetworkManager Integration: Uses D-Bus to communicate with NetworkManager
- Bridge Management: Creates Linux bridge interfaces using
ipcommands - DHCP Service: Uses
dnsmasqfor DHCP server functionality
The application uses multiple checks to determine router connectivity:
- Valid IP configuration (non-link-local addresses)
- Presence of default gateway
- DHCP-assigned configuration
- DNS server availability
sdbus: D-Bus Python bindings*sdbus-networkmanager: NetworkManager D-Bus interface*- APT
dnsmasq: DHCP/DNS serveriproute2: Network interface management tools (Usually installed by default)net-tools: View network configurations
* installed from requirements.txt