A Python utility for easily importing and configuring static IP reservations from a CSV file on UniFi networking equipment.
- Bulk import of IP reservations from CSV file to UniFi controller
- Static IP address assignment with VLAN tagging
- Works with UDM Pro, UDM SE, and other UniFi controllers
- Secure credential management via separate secrets file
- Detailed logging and error reporting
- Python 3.6 or higher
requestslibrary (pip install requests)- UniFi controller (UDM Pro, UDM SE, Cloud Key, etc.)
- Admin access to your UniFi controller. Ensure the user used is a local account with full admin access.
-
Clone this repository:
git clone https://github.com/yourusername/unifi-ip-reservation-importer.git cd unifi-ip-reservation-importer -
Install the required Python package:
pip install requests -
Create your secrets file:
cp secrets_example.py secrets.py -
Edit
secrets.pywith your UniFi controller credentials
Create a CSV file with the following columns:
| VLAN | MAC | Client Name | IP |
|---|---|---|---|
| 1 | 00:11:22:33:44:55 | Living Room TV | 192.168.1.50 |
| 2 | AA:BB:CC:DD:EE:FF | IoT Camera | 192.168.10.10 |
- VLAN: The VLAN ID number
- MAC: The device MAC address (format doesn't matter - the script normalizes it)
- Client Name: A friendly name for the device
- IP: The static IP address to assign
- Prepare your CSV file with the device information
- Update the
CSV_PATHinunifi.pyto point to your file - Run the script:
python unifi-ip-import.py
- The script will detect VLANs automatically from your UniFi controller configuration
- Make sure your UniFi networks are properly configured with VLANs before running
- For devices to use the assigned VLANs, you'll also need to configure:
- Switch ports for wired devices
- SSIDs with appropriate VLAN tags for wireless devices
- Keep your
secrets.pyfile secure - Add
secrets.pyto your.gitignorefile if using Git - Consider using a dedicated service account with limited permissions
MIT