OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Profile of migrator »
  • Show Posts »
  • Topics
  • Profile Info
    • Summary
    • Show Stats
    • Show Posts...
      • Messages
      • Topics
      • Attachments

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

  • Messages
  • Topics
  • Attachments

Topics - migrator

Pages: [1]
1
General Discussion / [SOLVED] dhcp static mappings import using modified backup-file
« on: August 23, 2018, 09:34:58 am »
Hello,

i'm trying to import static DHCP entries into OPNsense since i have i.e. lots of printers in various subnets.
Since there seems to be no official way, nore did i found anything except for pfsense, itried to modify the related sections of a downloaded backup (.xml) and reimport that again.
I added entries  for <ipaddr>,  <mac>, <decr> and <hostname> in the xml-code, so it loooks identically to entries done by the GUI
Code: [Select]
  <dhcpd>
    <opt3>
      <enable>1</enable>
      <numberoptions/>
      <range>
        <from>192.168.110.50</from>
        <to>192.168.110.55</to>
      </range>
      <staticmap>
        <mac>00:25:90:cd:0d:98</mac>
        <ipaddr>192.168.110.100</ipaddr>
        <hostname>110-100</hostname>
        <descr>Backup</descr>
      </staticmap>
    </opt3>
    <opt7>
      <enable>1</enable>
      <numberoptions/>
      <range>
        <from>192.168.245.46</from>
        <to>192.168.245.56</to>
      </range>
      <staticmap>
        <mac>c8:5b:76:4f:ae:a0</mac>
        <ipaddr>192.168.245.34</ipaddr>
        <hostname>245-34</hostname>
        <descr> laptop 28.11.2016</descr>
        <mac>c8:5b:76:4f:a4:f3</mac>
        <ipaddr>192.168.245.35</ipaddr>
        <hostname>245-35</hostname>
        <descr> laptop 28.11.2016</descr>
        <mac>50:7B:9D:E4:7B:F0</mac>
        <ipaddr>192.168.245.36</ipaddr>
        <hostname>245-36</hostname>
        <descr> laptop 20.12.2016</descr>
      </staticmap>
    </opt7>
When importing the XML-file i receive the following error in one line for all the added entires (existing mappings, done via the GUI remain and stay the same):
Code: [Select]
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /usr/local/www/services_dhcp.php on line 1121 / 1124 /1127  /1130.
Reviewing te code of services_dhcp.php doesn't help, i don't find an error on my site - did i miss anything here?
Is the back.xml-file secured via checksum or can't be modified at all?
Did anyone tried to import static DHCP mappings or has a better guess how to do this?

Thank you for reading and any ideas.

2
German - Deutsch / [SOLVED] dhcp static mappings import über modifizierte backup-datei
« on: August 21, 2018, 02:03:04 pm »
Hallo,

ich versuche statische DHCPv4-Einträge zu importieren.
Leider scheint es keine offizielle Lösung zu geben, deswegen habe ich versucht die XML-Datei aus dem Backup um die entsprechenden Einträge zu erweitern und das Backup dann wieder einzulesen.
Ich lese die Einträge für <ipaddr>,  <mac>, <decr> und <hostname> per Script aus einem isc-dhcp-server aus und erzeuge damit den xml-code, den ich dann in die entsprechende Section der Backup-Datei hineinkopiere.
Wenn ich über die OPNsense-Gui Einträge  unter DHCP Static Mappings anlege, sehen diese im Backup identisch und i.A. folgendermaßen aus ...
Code: [Select]
  <dhcpd>
    <opt3>
      <enable>1</enable>
      <numberoptions/>
      <range>
        <from>192.168.110.50</from>
        <to>192.168.110.55</to>
      </range>
      <staticmap>
        <mac>00:25:90:cd:0d:98</mac>
        <ipaddr>192.168.110.100</ipaddr>
        <hostname>110-100</hostname>
        <descr>Backup</descr>
      </staticmap>
    </opt3>
    <opt7>
      <enable>1</enable>
      <numberoptions/>
      <range>
        <from>192.168.245.46</from>
        <to>192.168.245.56</to>
      </range>
      <staticmap>
        <mac>c8:5b:76:4f:ae:a0</mac>
        <ipaddr>192.168.245.34</ipaddr>
        <hostname>245-34</hostname>
        <descr> laptop 28.11.2016</descr>
        <mac>c8:5b:76:4f:a4:f3</mac>
        <ipaddr>192.168.245.35</ipaddr>
        <hostname>245-35</hostname>
        <descr> laptop 28.11.2016</descr>
        <mac>50:7B:9D:E4:7B:F0</mac>
        <ipaddr>192.168.245.36</ipaddr>
        <hostname>245-36</hostname>
        <descr> laptop 20.12.2016</descr>
      </staticmap>
    </opt7>
Nach Einlesen des Backup bleiben von Hand eingegebene Einträge bestehen, für die modifizierten hingegen wird eine Zeile angezeigt mit jeweils einer Meldung pro Spalte:
Code: [Select]
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /usr/local/www/services_dhcp.php on line 1121 / 1124 /1127  /1130.
Den entsprechenden Abschnitt habe ich mir angesehen, sehe aber keine Lösung, übersehe ich etwas?
Ist das Backup evtl. geschützt (bspw. über eine Checksum) und nicht modifizierbar?
Hat jemand schon mal etwas ähnliches probiert oder kennt eine andere Lösung für den DHCP-Import?

Danke fürs lesen und noch mehr für Hilfe

Pages: [1]
OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2