{"id":8,"date":"2018-07-15T03:26:10","date_gmt":"2018-07-14T20:26:10","guid":{"rendered":"http:\/\/geeksops.com\/?p=8"},"modified":"2025-02-15T19:21:19","modified_gmt":"2025-02-15T12:21:19","slug":"cisco-nexus-auto-provisioning-using-poap","status":"publish","type":"post","link":"https:\/\/rotreein.com\/?p=8","title":{"rendered":"Cisco Nexus Auto Provisioning using POAP"},"content":{"rendered":"\n<p>Goal :<\/p>\n\n\n\n<ul>\n<li>Faster deployment in Nexus Switch<\/li>\n<\/ul>\n\n\n\n<p>Requirement<\/p>\n\n\n\n<ul>\n<li>DHCP Server ( isc-dhcp-server )&nbsp;<\/li>\n\n\n\n<li>TFTP \/ SCP Server<\/li>\n\n\n\n<li>Cisco Nexus 9000v ( GNS3)<\/li>\n\n\n\n<li>Python Script<\/li>\n<\/ul>\n\n\n\n<p>Below the topology in Development Environment&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"552\" height=\"287\" src=\"https:\/\/geeksops.com\/wp-content\/uploads\/2019\/06\/Topology-ZTP-N9KV.jpg\" alt=\"\" class=\"wp-image-27\" srcset=\"https:\/\/rotreein.com\/wp-content\/uploads\/2019\/06\/Topology-ZTP-N9KV.jpg 552w, https:\/\/rotreein.com\/wp-content\/uploads\/2019\/06\/Topology-ZTP-N9KV-300x156.jpg 300w\" sizes=\"(max-width: 552px) 100vw, 552px\" \/><\/figure>\n\n\n\n<p>Both devices will automatically push configuration based on serial Number.&nbsp; The following mapping configuration in Nexus 9000v<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table><tbody><tr><td><strong>IP <\/strong><\/td><td><strong>SN<\/strong><\/td><td><strong>Switch Name<\/strong><\/td><td><strong>Script Name<\/strong><\/td><td><strong>Script<\/strong> <strong>Name<\/strong><\/td><\/tr><tr><td>172.19.254.31<\/td><td>9GPNP3P68OD<\/td><td>LEAF1R1<\/td><td>poap_nexus_sn.py<\/td><td>conf.9GPNP3P68OD<\/td><\/tr><tr><td>172.19.254.32<\/td><td>91990H4TOLV<\/td><td>LEAF2R1<\/td><td>poap_nexus2_sn.py<\/td><td>conf.91990H4TOLV<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Install isc-dhcp-server<\/p>\n\n\n\n<p class=\"has-very-dark-gray-color has-very-light-gray-background-color has-text-color has-background has-small-font-size\"><strong>root@dhcp-server-prov:~$ apt-get&nbsp;installisc-dhcp-server -y<\/strong><\/p>\n\n\n\n<p>Edit isc-dhcp-server configuration in file&nbsp; \/etc\/dhcp\/dhcpd.conf.&nbsp;In the option dhcp-client-identifier you need to add \u00ab&nbsp;\\000&nbsp;\u00bb before the serial number.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-very-dark-gray-color has-very-light-gray-background-color has-text-color has-background has-small-font-size\"><strong>default-lease-time 3600;<br> max-lease-time 7200;<br> authoritative;<br>subnet 172.19.254.0 netmask 255.255.255.0 {<br> range 172.19.254.11 172.19.254.200;<br> host n9k1 {<br> option dhcp-client-identifier &#8220;\\0009GPNP3P68OD&#8221;;<br> fixed-address 172.19.254.31;<br> option routers 172.19.254.1;<br> option bootfile-name &#8220;poap_nexus_sn.py&#8221;;<br> option tftp-server-name &#8220;172.19.254.3&#8221;;<br> }<br> host n9k2 {<br> option dhcp-client-identifier &#8220;\\00091990H4TOLV&#8221;;<br> fixed-address 172.19.254.32;<br> option routers 172.19.254.1;<br> option bootfile-name &#8220;poap_nexus2_sn.py&#8221;;<br> option tftp-server-name &#8220;172.19.254.3&#8221;;<br> }<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Install tftpd-hpa<\/p>\n\n\n\n<p class=\"has-very-dark-gray-color has-very-light-gray-background-color has-text-color has-background has-small-font-size\"><strong>root@tftp:~# apt-get install tftpd-hpa -y<\/strong><\/p>\n\n\n\n<p>Edit tftpd-hpa configuration in file \/etc\/default\/tftpd-hpa<\/p>\n\n\n\n<p class=\"has-very-dark-gray-color has-very-light-gray-background-color has-text-color has-background has-small-font-size\"><strong>TFTP_USERNAME=&#8221;tftp&#8221;TFTP_DIRECTORY=&#8221;\/home\/rohmat\/tftp-server&#8221;TFTP_ADDRESS=&#8221;0.0.0.0:69&#8243;TFTP_OPTIONS=&#8221;&#8211;secure&#8221;<\/strong><\/p>\n\n\n\n<p>in directory \/home\/rohmat\/tftp-server, download script on github&nbsp;<a href=\"https:\/\/github.com\/CiscoSE\/Cisco-POAP.git\">https:\/\/github.com\/CiscoSE\/Cisco-POAP.git<\/a><\/p>\n\n\n\n<p class=\"has-very-dark-gray-color has-very-light-gray-background-color has-text-color has-background has-small-font-size\"><strong>rohmat@tftp:~\/tftp-server$ git clone <\/strong><a href=\"https:\/\/github.com\/CiscoSE\/Cisco-POAP.git\">https:\/\/github.com\/CiscoSE\/Cisco-POAP.git<\/a><strong><br>rohmat@tftp:~\/tftp-server$ mkdir n9k<\/strong><br><strong>rohmat@tftp:~\/tftp-server\/Cisco-POAP$ mv * ..\/n9k<br> rohmat@tftp:~\/tftp-server$ md5sum poap_nexus_sn.py 71c542b1504265f2751f39ace85dcd3f  poap_nexus_sn.py<br> rohmat@tftp:~\/tftp-server$ md5sum poap_nexus2_sn.py c180867155428f301a6f9a26622ad066  poap_nexus2_sn.py<\/strong><\/p>\n\n\n\n<p>After generate an md5 of the poap_nexus_sn.py &amp; poap_nexus2_sn.py, the following line will replace the second line with md5, if the md5 is not validated the POAP process will fail and restart<\/p>\n\n\n\n<p class=\"has-very-dark-gray-color has-very-light-gray-background-color has-text-color has-background has-small-font-size\"><strong>rohmat@tftp:~\/tftp-server\/n9k$ f=poap_nexus_sn.py ;&nbsp;cat$f |&nbsp;sed&#8217;\/^#md5sum\/d&#8217;&gt; $f.md5 ;&nbsp;sed-i&nbsp;&#8220;s\/^#md5sum=.*\/#md5sum=\\&#8221;$(md5sum $f.md5 | sed &#8216;s\/ .*\/\/&#8217;)\\&#8221;\/&#8221;$f<br>rohmat@tftp:~\/tftp-server\/n9k$ f=poap_nexus2_sn.py ;&nbsp;cat$f |&nbsp;sed&#8217;\/^#md5sum\/d&#8217;&gt; $f.md5 ;&nbsp;sed-i&nbsp;&#8220;s\/^#md5sum=.*\/#md5sum=\\&#8221;$(md5sum $f.md5 | sed &#8216;s\/ .*\/\/&#8217;)\\&#8221;\/&#8221;$f<\/strong><\/p>\n\n\n\n<p>Put image nxos.7.0.3.I7.3.bin &amp; configuration file conf.XXXX , also need to generate an md5 for the image<\/p>\n\n\n\n<p class=\"has-very-dark-gray-color has-very-light-gray-background-color has-text-color has-background has-small-font-size\"><strong>rohmat@tftp:~\/tftp-server\/n9k$ md5sum conf.91990H4TOLV &gt; conf.91990H4TOLV.md5<\/strong><br><strong>rohmat@tftp:~\/tftp-server\/n9k$ md5sum conf.9GPNP3P68OD &gt; conf.9GPNP3P68OD.md5<\/strong><br><strong>rohmat@tftp:~\/tftp-server$ md5sum nxos.7.0.3.I7.3.bin &gt; nxos.7.0.3.I7.3.bin.md5<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><em>Demo auto provisioning LEAF1R1<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1081\" height=\"302\" src=\"https:\/\/rotreein.com\/wp-content\/uploads\/2025\/02\/image-2.png\" alt=\"\" class=\"wp-image-902\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1084\" height=\"215\" src=\"https:\/\/rotreein.com\/wp-content\/uploads\/2025\/02\/image-3.png\" alt=\"\" class=\"wp-image-903\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><em>Demo auto provisioning LEAF2R1<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1081\" height=\"332\" src=\"https:\/\/rotreein.com\/wp-content\/uploads\/2025\/02\/image-4.png\" alt=\"\" class=\"wp-image-904\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1097\" height=\"186\" src=\"https:\/\/rotreein.com\/wp-content\/uploads\/2025\/02\/image-5.png\" alt=\"\" class=\"wp-image-905\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Goal : Requirement Below the topology in Development Environment&nbsp; Both devices will automatically push configuration based on serial Number.&nbsp; The following mapping configuration in Nexus 9000v IP SN Switch Name Script Name Script Name 172.19.254.31 9GPNP3P68OD LEAF1R1 poap_nexus_sn.py conf.9GPNP3P68OD 172.19.254.32 91990H4TOLV LEAF2R1 poap_nexus2_sn.py conf.91990H4TOLV Install isc-dhcp-server root@dhcp-server-prov:~$ apt-get&nbsp;installisc-dhcp-server -y Edit isc-dhcp-server configuration in file&nbsp; \/etc\/dhcp\/dhcpd.conf.&nbsp;In&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/rotreein.com\/index.php?rest_route=\/wp\/v2\/posts\/8"}],"collection":[{"href":"https:\/\/rotreein.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rotreein.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rotreein.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rotreein.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":38,"href":"https:\/\/rotreein.com\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"predecessor-version":[{"id":913,"href":"https:\/\/rotreein.com\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions\/913"}],"wp:attachment":[{"href":"https:\/\/rotreein.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rotreein.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rotreein.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}