{"id":28,"date":"2015-04-16T13:33:18","date_gmt":"2015-04-16T11:33:18","guid":{"rendered":"https:\/\/blog.unetresgrossebite.com\/?p=28"},"modified":"2015-04-16T13:55:23","modified_gmt":"2015-04-16T11:55:23","slug":"pxe","status":"publish","type":"post","link":"https:\/\/blog.unetresgrossebite.com\/?p=28","title":{"rendered":"PXE"},"content":{"rendered":"<p>Continuing on my project to re-do my internal services, today we&#8217;ll talk about Preboot eXecution Environnement, AKA PXE.<br \/>\nThe principle is quite simple, and widely spread in everyday infrastructures.<\/p>\n<p>Most PXE setups I&#8217;ve heard about involve serving installation images for a single system.<br \/>\nMost tutorials I&#8217;ve found, struggling configuring my service, would stick to serving a specific image, most likely taken from the host system, &#8230;<br \/>\nAlthough PXE is able to provide with a complete set of systems, as well as live environments from memtests, BIOS update utilities as well as liveCDs.<\/p>\n<p>Being refractory to the idea of setting up an NFS server on a PXE server, I&#8217;m avoiding this later usage.<br \/>\nThe main reason being my former work involved OpenVZ virtualization: using NFS is usually a pain in the ass, assuming your physical host\/virtual host combination actually support NFS.<br \/>\nIf setting up a NFS client is most likely doable, setting up a NFS server remain a bad idea, &#8230; and well, I ended up avoiding all kind of NFS services running on my core services.<\/p>\n<p>Anyway, back to PXE.<br \/>\nRelying on industry standards such as DHCP (<a href=\"https:\/\/tools.ietf.org\/rfc\/rfc1531.txt\">RFC1531<\/a>, <a href=\"https:\/\/tools.ietf.org\/rfc\/rfc4578.txt\">RFC4578<\/a>), TFTP (<a href=\"https:\/\/tools.ietf.org\/rfc\/rfc783.txt\">RFC783<\/a>, <a href=\"https:\/\/tools.ietf.org\/rfc\/rfc906.txt\">RFC906<\/a>) then BOOTP (<a href=\"https:\/\/tools.ietf.org\/rfc\/rfc951.txt\">RFC951<\/a>), PXE uses a set of low-level protocols clients, allowing lightweight implementation, inducing a low enough footprint to fit on regular network controllers.<br \/>\nMost DHCP servers can be reconfigured to provide its clients with a PXE server address (&#8216;next-server&#8217;) and a file (&#8216;filename&#8217;), supposed to be distributed by your PXE.<br \/>\nOnce the client retrieved these info from its DHCP, it is able to download and render the downloaded file. Once the first image (usually named <em>pxelinux.0<\/em>, <em>pxeboot.0<\/em>, or anyway you want&#8230;, there&#8217;s a lot of declinations, mostly doing the same thing) is executed, the client would query the TFTP server again for files contained within <em>pxelinux.cfg<\/em> directory.<br \/>\nLooking for additional configurations, the PXE client would usually look up for a file matching its complete hardware address (eg <em>pxelinux.cfg\/aa-bb-cc-dd-ee-ff<\/em> having the booting NIC hardware address set to <em>AA:BB:CC:DD:EE:FF<\/em>). The client would then query for a file matching its complete IP (eg <em>pxelinux.cfg\/C000025A<\/em> having the client IP address set to <em>192.0.2.90<\/em>). If not found, the last digit of the previous query is removed, and then again, &#8230; until the string is empty, at which point, the client queries for a file &#8216;default&#8217;.<br \/>\nThe &#8216;<em>default<\/em>&#8216; file, as of any file from <em>pxelinux.cfg<\/em>, can either define menus layout and several boot options, or simply boot a given image without further notice.<\/p>\n<p>PXE use a very small set of commands. The <em>kernel<\/em>, <em>initrd<\/em> and <em>append<\/em> being the most common booting a system.<br \/>\nSetting up a system requires you to download the proper kernel and initramfs, then declare a menu item loading them. Automating the process is thus pretty straight-forward: two files to downloads, a template to include from your main menu, &#8230; See <a href=\"https:\/\/gitlab.unetresgrossebite.com\/DevOps\/puppet\/tree\/master\/modules\/tftpd\/manifests\/define\">puppet defines, downloading CentOS, CoreOS, Debian, Fedora, FreeBSD, mfsBSD, OpenBSD, OpenSUSE and Ubuntu<\/a>.<br \/>\nMost initramfs could be started with specific arguments such as which device to use, which keyboard layout to load, which repository to use, or even a URL the system installation process would use to retrieve either a <a href=\"https:\/\/gitlab.unetresgrossebite.com\/DevOps\/puppet\/blob\/master\/modules\/tftpd\/templates\/preseed.erb\">preseed<\/a>, a <a href=\"https:\/\/gitlab.unetresgrossebite.com\/DevOps\/puppet\/blob\/master\/modules\/tftpd\/templates\/ks-centos.erb\">kickstart<\/a>, or anything that may help automating installation process.<\/p>\n<p>If unattended installations have limited benefits within smaller networks &#8211; not using CDs is still a big one &#8211; they are tremendous towards huge networks.<br \/>\nTargeting such infrastructures, products emerged bringing PXE to its next level.<br \/>\nCobbler, for instance, a system-agnostic Python-based command-line tool managing PXE configuration. Its primary functionality is to automate repetitive actions and encourage the reuse of existing data through templating.<br \/>\nMAAS, from Canonical, in combination with Juju, based on Ubuntu, able to bootstrap complete infrastructures &#8212; which is what they do, I guess, with BootStack.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continuing on my project to re-do my internal services, today we&#8217;ll talk about Preboot eXecution Environnement, AKA PXE. The principle is quite simple, and widely spread in everyday infrastructures. Most PXE setups I&#8217;ve heard about involve serving installation images for a single system. Most tutorials I&#8217;ve found, struggling configuring my service, would stick to serving [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/28"}],"collection":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=28"}],"version-history":[{"count":3,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions"}],"predecessor-version":[{"id":32,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions\/32"}],"wp:attachment":[{"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.unetresgrossebite.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}