A network diagnostic tool that transforms a Raspberry Pi CM4-DUAL-ETH-MINI into a transparent network bridge that identifies the IP address of any device plugged into it. (as long as they are requesting an ip via DHCP)
Click the image above to watch the demo video
IP Spy answers the simple question: "What IP address did this device just get?"
When you plug any device (phone, computer, IoT device, etc.) inbetween a device and the router it will:
- Transparently bridge the device to your network
- Monitor DHCP and ARP traffic in real-time
- Display the MAC and IP of the device on the OLED display
- (Note: for most setups, it likely doesn't actually have to be between the device and the router, but just on the same network)
- Raspberry Pi CM4-DUAL-ETH-MINI with dual ethernet ports, or a normal Pi with an extra ethernet port plugged in with USB
- MicroSD card with Raspberry Pi OS
- Network cables
Test Device → [eth0] → [br0 Bridge] → [eth1] → Main Network Router
The CM4 creates a Linux bridge (br0
) that transparently connects eth0
and eth1
, allowing traffic to pass through while monitoring device connections.
sudo apt update && sudo apt install -y python3-pip python3-scapy bridge-utils
pip3 install -r requirements.txt
# Enable the bridge service for boot persistence
sudo systemctl enable network-bridge.service
sudo systemctl start network-bridge.service
# Start the bridge monitor
sudo python3 bridge_monitor.py
# In another terminal, watch for IP assignments
tail -f device_ip.txt
- Connect your router/network to
eth1
- Connect a test device to
eth0
(actually, you can reverse the plugs, it doesn't matter) - Power on the test device
- Watch the IP assignment appear! (either as a message from the shell or the OLED display if you've set that up)
The bridge is automatically configured by the network-bridge.service
systemd service, which:
- Creates the
br0
bridge interface - Adds
eth0
andeth1
to the bridge - Brings all interfaces up
- Persists across reboots
sudo ./setup-bridge.sh
brctl show br0
ip addr show br0
# Check service status
sudo systemctl status network-bridge.service
# Restart bridge
sudo systemctl restart network-bridge.service
Disable "Wait for Network at Boot" with raspi-config or reduce the timeout. We don't really need things plugged in when the Pi boots to work, so I set the timeout very low on the Pi.
# Check uplink connectivity
ping 192.168.1.1
# Verify bridge is passing traffic
sudo tcpdump -i br0 -c 10
# Run monitoring scripts with sudo
sudo python3 bridge_monitor.py
bridge_monitor.py
- Main monitoring scriptsetup-bridge.sh
- Bridge configuration scriptnetwork-bridge.service
- Systemd service for boot persistenceoled-loading.service
- Systemd service to show "Loading..." on OLED display early in boot sequenceoled_show_loading.py
- Script that displays loading message on OLEDrequirements.txt
- Python dependenciessimple_start.sh
- A thing to run it with the virtual env oled-venv, but I mean, you don't have to use one, or you could do it with conda or whatever, it's not that important
The oled-loading.service
can be enabled to display a "Loading..." message on the OLED display very early in the Raspberry Pi boot sequence. This is useful for providing visual feedback that the system is starting up.
To enable the OLED loading service:
sudo systemctl enable oled-loading.service
sudo systemctl start oled-loading.service
To disable it:
sudo systemctl disable oled-loading.service
The service runs early in the boot process (after local filesystem is mounted) and will silently exit if the OLED display is not connected or if there are any issues, ensuring it doesn't interfere with the boot process.
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Seth A. Robinson
- Website: rtsoft.com
- YouTube: @RobinsonTechnologies
- Twitter/X: @rtsoft
- Bluesky: @rtsoft.com
- Mastodon: @[email protected]
This project was developed with assistance from AI tools for code generation and documentation.