<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>tech &amp;mdash; Niklas&#39; Blog</title>
    <link>https://blog.niklas-meinzer.de/tag:tech</link>
    <description>Some words about things and the like might appear here semi-regularly. Follow  @niklas@blog.niklas-meinzer.de to subscribe</description>
    <pubDate>Tue, 28 Apr 2026 00:02:05 +0200</pubDate>
    <item>
      <title>Configuring a Host-Only network adapter with Ubuntu running on a VM</title>
      <link>https://blog.niklas-meinzer.de/configuring-a-host-only-network-adapter-with-ubuntu-running-on-a-vm</link>
      <description>&lt;![CDATA[For work I sometimes need to test or debug deployments on virtual machines. To do this I like to spin up a local vm in Virtualbox. Since I need to be able to ssh into it, it requires a host-only network adapter.&#xA;&#xA;Whenever I provision a fresh machine of this kind, I have forgotten how to get the host-only adapter to work and it&#39;s hard to find the right instructions online since the process has changed so much during the various Ubuntu version.&#xA;&#xA;So here it goes: How to set up a host-only adapter with Ubuntu 22.04 running in a Virtualbox:&#xA;&#xA;Make sure the host-only adapter is connected to the machine. This is done in the settings of the VM in Virtualbox. Adapters can only be added or removed when the machine is down.&#xA;&#xA;Logged  into the VM run ip link show to list available network interfaces. Depending on what you configured there should be a number of devices listed. Most likely the loopback device, the NAT device and the host-only device, which should show as down. Now note the name of the host-only device&#xA;&#xA;Open the netplan configuration at /etc/netplan/00-installer-config.yaml and add the host-only device like in the following example. In this case I&#39;m assigning a static IP, but I think dhcp works too.&#xA;&#xA;network:&#xA;  ethernets:&#xA;    enp0s3:&#xA;      dhcp4: true&#xA;    enp0s8: # This is the network device I identified earlier&#xA;      dhcp4: no&#xA;      addresses:&#xA;        192.168.56.104/24&#xA;  version: 2&#xA;&#xA;Finally run netplan apply to apply the changes&#xA;&#xA;Now you should see the interface as up when running ip a&#xA;&#xA;tech]]&gt;</description>
      <content:encoded><![CDATA[<p>For work I sometimes need to test or debug deployments on virtual machines. To do this I like to spin up a local vm in Virtualbox. Since I need to be able to ssh into it, it requires a host-only network adapter.</p>

<p>Whenever I provision a fresh machine of this kind, I have forgotten how to get the host-only adapter to work and it&#39;s hard to find the right instructions online since the process has changed so much during the various Ubuntu version.</p>

<p>So here it goes: How to set up a host-only adapter with Ubuntu 22.04 running in a Virtualbox:</p>
<ul><li><p>Make sure the host-only adapter is connected to the machine. This is done in the settings of the VM in Virtualbox. Adapters can only be added or removed when the machine is down.</p></li>

<li><p>Logged  into the VM run <code>ip link show</code> to list available network interfaces. Depending on what you configured there should be a number of devices listed. Most likely the loopback device, the NAT device and the host-only device, which should show as down. Now note the name of the host-only device</p></li>

<li><p>Open the netplan configuration at <code>/etc/netplan/00-installer-config.yaml</code> and add the host-only device like in the following example. In this case I&#39;m assigning a static IP, but I think dhcp works too.</p></li></ul>

<pre><code>network:
  ethernets:
    enp0s3:
      dhcp4: true
    enp0s8: # This is the network device I identified earlier
      dhcp4: no
      addresses:
        - 192.168.56.104/24
  version: 2

</code></pre>
<ul><li><p>Finally run <code>netplan apply</code> to apply the changes</p></li>

<li><p>Now you should see the interface as up when running <code>ip a</code></p></li></ul>

<p><a href="https://blog.niklas-meinzer.de/tag:tech" class="hashtag"><span>#</span><span class="p-category">tech</span></a></p>
]]></content:encoded>
      <guid>https://blog.niklas-meinzer.de/configuring-a-host-only-network-adapter-with-ubuntu-running-on-a-vm</guid>
      <pubDate>Tue, 21 Nov 2023 07:50:59 +0100</pubDate>
    </item>
  </channel>
</rss>