From bc9c9099988d15b40bb7ea4b4e9ea423ae19f6ee Mon Sep 17 00:00:00 2001 From: IvanKuchin Date: Fri, 26 Jan 2024 07:30:23 -0800 Subject: [PATCH] Add more descriptive instructions --- README.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eacc526..e038c2f 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,11 @@ Small script synchronizes phpipam hosts with pi-hole resolvers. ## Use case -Phpipam considered source of truth for DNS resolution. Network admins create hostnames in phpipam. -Pihole used as a DNS-server. +Phpipam considered to be a source of truth for DNS resolution. +* Network admins create hostnames in phpipam. +* Pihole used as a DNS-server. +* (optional) Cisco router acts as a DHCP-server + To synchronize phpipam hostanmes with pihole DNS-resolver ``` phpipamsync get pi-hole @@ -26,3 +29,61 @@ pi_hole: /home/ikuchin/docker/pi.hole/etc-pihole/custom.list # full path to p ``` **ATTENTION** pi-hole custom file will be rewritten, not appended. + +## phpipam API token + +To generate API topken, in phpipam go to Administration -> API -> Create API token. + +* Type - SSL with App code token +* App permission - Read + +Important: HTTPS access should be enabled to phpipam + +## Cisco DHCP config + +To generate DHCP config snippet for Cisco router configuration + +``` +phpipamsync get cisco-dhpc +``` + +Once snippet generated it can be copy/paste-ed to actual router configuration. There is no integration between phpipamsync and router. + +## Examples + +### DNS resolution + +``` +e:\docs\src\go\phpipamsync>nslookup tesla.home +... +Non-authoritative answer: +Name: tesla.home +Address: 192.168.168.49 + +e:\docs\src\go\phpipamsync>nslookup 192.168.168.49 +... +Name: tesla.home +Address: 192.168.168.49 +``` + +### Cisco IOS DHCP config + +ClientID generated from either of options below: +* MAC address (by adding prefix 01.....) +* Custom field named ClientID ( Administration -> Custom fields -> Custom IP addresses fields ) + +``` +$ phpipamsync get cisco-dhcp + +ip dhcp pool fridge + host 192.168.251.13 255.255.255.0 + client-identifier 0170.2c1f.3ed2.cb + default-router 192.168.251.1 +! +ip dhcp pool tesla + host 192.168.168.49 255.255.255.0 + client-identifier 014c.fcaa.8ec6.62 + default-router 192.168.251.1 +! +``` +