Posts mit dem Label DHCP werden angezeigt. Alle Posts anzeigen
Posts mit dem Label DHCP werden angezeigt. Alle Posts anzeigen

28.6.17

isc-dhcp-server führende 0 fehlt

Ich hatte folgendes eingefügt in die dhcp.conf:

on commit {
        set clip = binary-to-ascii(10, 8, ".", leased-address);
       set clhw = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
        log(concat("Commit: IP: ", clip, " Mac: ", clhw));
        execute("/home/pi/scripts/dash/dash_action", clip, clhw);
    }
}

Jedoch sorgt die Funktion binary-to-ascii dafür, dass mögliche führenden Nullen abgeschnitten werden. Das sorgt dann z.B. für eine solche Ausgabe:

e0:76:d0:60:3:fc
Abhilfe schafft folgendes:

         set clhw = concat (
            suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,1,1))),2), ":",
            suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,2,1))),2), ":",
            suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,3,1))),2), ":",
            suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,4,1))),2), ":",
            suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,5,1))),2), ":",
            suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,6,1))),2)
            );

3.10.16

DHCP Server konfigurieren

Adresspool definieren:

class "virtualbox"
{
  match if binary-to-ascii(16,8,":",substring(hardware,1 ,2)) == "08:00";
}

Eigenen Adressraum für virtuelle Maschinen festlegen:

pool
{
   allow members of "virtualbox";
  range 192.168.1.200 192.168.1.220:
}

 Unbekannte Geräte ausschließen

subnet 192.168.178.0 netmask 255.255.255.0
{
option routers x.x.x.x;
range 192.168.178.50 192.168.178.150;
deny unknown-clients;

}


subnet 192.168.1.0 netmask 255.255.255.0
{
option routers x.x.x.x;
range 192.168.1.50 192.168.1.150;
option host-name = concat("intruder", binary-to-ascii(10,8,"",substring(leased-address,3,1)));
allow unknown-clients;

}



DHCP Server im Netz finden

dhcping -s 255.255.255.255 -r -v
Ein Dank an Heise!

Openhab und Ecoflow Max - API Anbindung

 Ich wollte die neu erworbene Powerstation in Openhab einbinden, um den aktuellen Status (Ladestand etc.) über Openhab auswerten zu können. ...