{"id":1233,"date":"2022-11-04T23:47:29","date_gmt":"2022-11-04T23:47:29","guid":{"rendered":"https:\/\/www.nooblet.org\/blog\/?p=1233"},"modified":"2022-11-10T13:26:31","modified_gmt":"2022-11-10T13:26:31","slug":"adding-mac-addresses-to-phpipam-using-arp","status":"publish","type":"post","link":"https:\/\/www.nooblet.org\/blog\/2022\/adding-mac-addresses-to-phpipam-using-arp\/","title":{"rendered":"Adding MAC addresses to PHPIPAM using ARP"},"content":{"rendered":"<p>After finding this feature wasn&#8217;t implemented <a href=\"https:\/\/github.com\/phpipam\/phpipam\/issues\/3063\">[1]<\/a><a href=\"https:\/\/github.com\/phpipam\/phpipam\/issues\/2378\">[2]<\/a>, I spent some time this evening learning <a href=\"https:\/\/phpipam.net\/\">phpIPAM<\/a>&#8216;s REST API and writing a short bash script to update phpIPAM&#8217;s mac field.<\/p>\n<ul>\n<li>The script will need the username and password of a user that has write permission to the addresses you want to update.<\/li>\n<li>You will need to create an api app, <a href=\"https:\/\/phpipam.net\/#authentication\">as described in the documentation<\/a>.<\/li>\n<li>The script gets info on a single interface and updates addresses in a single subnet.<\/li>\n<li>The script will check that the mac needs updating and only update if necessery.<\/li>\n<li>The script will ignore addresses tagged as (3) &#8220;reserved&#8221; or (4) &#8220;dhcp&#8221;.<\/li>\n<li>The script won&#8217;t add new addresses, only update existing ones.<\/li>\n<li>The script will check local interface ips as well (as these aren&#8217;t in ARP)<\/li>\n<li>The script requires &#8220;iproute2&#8221;, &#8220;curl&#8221; and &#8220;jq&#8221; (Command-line JSON processor).<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.nooblet.org\/blog\/wp-content\/uploads\/2022\/11\/2022-11-05-00_12_24-phpipam-mac.png\" alt=\"\" width=\"249\" height=\"133\" class=\"alignnone size-full wp-image-1247\" \/><\/p>\n<p>Code available at <a href=\"https:\/\/github.com\/lazynooblet\/scripts\/tree\/main\/bash\/phpipam-update-mac-from-arp\">https:\/\/github.com\/lazynooblet\/scripts\/tree\/main\/bash\/phpipam-update-mac-from-arp<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After finding this feature wasn&#8217;t implemented [1][2], I spent some time this evening learning phpIPAM&#8216;s REST API and writing a short bash script to update phpIPAM&#8217;s mac field. The script will need the username and password of a user that has write permission to the addresses you want to update. You will need to create [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":648,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-1233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-other"],"_links":{"self":[{"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/posts\/1233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/comments?post=1233"}],"version-history":[{"count":17,"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/posts\/1233\/revisions"}],"predecessor-version":[{"id":1253,"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/posts\/1233\/revisions\/1253"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/media\/648"}],"wp:attachment":[{"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/media?parent=1233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/categories?post=1233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nooblet.org\/blog\/wp-json\/wp\/v2\/tags?post=1233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}