https://github.com/cmer/pfsense-bulk-dhcp-import
Import DHCP static mapping from CSV to pfSense
https://github.com/cmer/pfsense-bulk-dhcp-import
dhcp pfsense ruby
Last synced: 8 months ago
JSON representation
Import DHCP static mapping from CSV to pfSense
- Host: GitHub
- URL: https://github.com/cmer/pfsense-bulk-dhcp-import
- Owner: cmer
- Created: 2020-01-01T19:30:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-17T02:33:36.000Z (over 3 years ago)
- Last Synced: 2025-04-30T06:43:57.530Z (about 1 year ago)
- Topics: dhcp, pfsense, ruby
- Language: Ruby
- Size: 5.86 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bulk DHCP entries import for pfSense
This script takes a CSV file and converts its entries to an XML file containing entries compatible with pfSense.
## Installation
1. Make sure Ruby 2.7.0 is installed. Not familiar with Ruby? See [RVM](https://rvm.io).
2. Clone the repo locally.
2. Run `gem install bundler && bundle` in the repo directory.
## Data Conversion & Import
1. Create a CSV file with the data you want to import.
- See `example.csv`. Note that your CSV file **requires** a header line with the proper field names.
- `ipaddr` and `mac` are required fields.
- Optional fields are: `CID HOSTNAME DESCR FILENAME ROOTPATH DEFAULTLEASETIME MAXLEASETIME GATEWAY DOMAIN DOMAINSEARCHLIST DDNSDOMAIN DDNSDOMAINPRIMARY DDNSDOMAINKEYNAME DDNSDOMAINKEY TFTP LDAP`
2. Create an XML backup of your pfSense installation.
- **IMPORTANT:** only select "DHCP Server" as your Backup Area.
3. Run the script against your CSV file.
- `./convert /path/to/dhcp.csv`
- or `./convert /path/to/dhcp.csv /path/to/output.xml`
4. Add the generated entries to your pfSense backup file.
- With your favorite text editor, open BOTH the generated XML file and the pfSense backup XML file.
- Copy all the `staticmap` entries from the generated XML file and replace the old `staticmap` entries in your pfSense XML backup file.
- If your pfSense XML file does not contain `staticmap` entries, simply paste the generated content below `dhcpleaseinlocaltime`.
5. In pfSense, import the modified backup file.
- **IMPORTANT:** only select "DHCP Server" as your Import Area.