Import Fixed Leases in DHCP



  • I am wondering if there is a way to import serveral hundred records from an exsiting DHCP server to the pfSense DHCP server/ I have a working DHCP server but the web interface in pfSense is so much nicer!

    Thanks for the help



  • You could download the config.xml and look for the relevant part which looks like this:

    <dhcpd><lan><enable><range><from>10.0.0.100</from>
    <to>10.0.0.200</to></range>
    <defaultleasetime><maxleasetime><netmask><failover_peerip><gateway><ddnsdomain><next-server><filename><staticmap><mac>00:50:8d:50:5f:36</mac>
    <ipaddr>10.0.0.10</ipaddr>
    <hostname>whitemage</hostname>
    <descr>sörwär</descr></staticmap>
    <staticmap><mac>00:1a:92:82:43:29</mac>
    <ipaddr>10.0.0.11</ipaddr>
    <hostname>redmage</hostname></staticmap>
    <staticmap><mac>00:60:b0:f3:ec:20</mac>
    <ipaddr>10.0.0.50</ipaddr>
    <hostname>LASERJET_4000N</hostname>
    <descr>LASERJET_4000N</descr></staticmap></filename></next-server></ddnsdomain></gateway></failover_peerip></netmask></maxleasetime></defaultleasetime></enable></lan></dhcpd>

    with a small script you should be able to convert the existing format you already have into this format.
    Then simply restore the config file and it should work.


  • Rebel Alliance Developer Netgate

    @jjalbert:

    I am wondering if there is a way to import serveral hundred records from an exsiting DHCP server to the pfSense DHCP server/ I have a working DHCP server but the web interface in pfSense is so much nicer!

    Part of that depends on how you can export that data from your current DHCP server. As GruensFroeschli suggested, you may be able to write a script that changes your current data into the XML format, place that in the config, and off you go.

    I suppose it wouldn't be too difficult to write an import/export routine for the DHCP leases, but that isn't something that would show up in the short-term. (Though if someone were to start a bounty for such a thing, I'm sure it would get done a lot faster…)



  • Thank you fr the info. All exporting I can do in CSV or tab delimited, may still have the original files. I have a perl script to conver csv to the format I have been using, so I am 4/5th of the way there. I will give it a try and see what happens. Thanks again.



  • Yes it did work, set up spreadsheet file with info I want, save as .csv, use perl script to convert format, copy and restore to pfsence. Works great thanks for the help, however I now have come across another issue. I have MANY Laptops with Wired and Wireless NIC. Can i set 1 ip address to be assigned to multiple mac address? The DHCP Server we use through our ISP allowed this, you could have one ip with multiple mac address, or multiple ips (in different subnets) assigned to one mac address. Any help with this?

    Thanks



  • Would really suggest that you set up an other q about this!

    Suppose the user did not disable the wireless interface on laptop when physically connected.
    This would in that case result in two interfaces with same address. Is this desirable?

    I set my wireless on a separate interface on firewall.
    This way I can have "PC-x fixed" on 192.168.37.213 and "PC-x wireless" on 192.168.73.213.
    The PC is the one to use its own preferred route.


  • Rebel Alliance Developer Netgate

    @Assar:

    Suppose the user did not disable the wireless interface on laptop when physically connected.
    This would in that case result in two interfaces with same address. Is this desirable?

    DHCPD won't let that happen. It will check first to see if the address is actually in use, and if so, assign a different address.

    With ISC DHCPD, which pfSense uses, static DHCP reservations are not absolute. They are more of a preference. That's the reason you can't assign static addresses inside of your DHCP pool: That IP could end up assigned to another machine if the machine with the reservation was powered off.


Locked