<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pratyush_Udhani7</title>
    <description>The latest articles on DEV Community by Pratyush_Udhani7 (@pratyushudhani).</description>
    <link>https://dev.to/pratyushudhani</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F604966%2Fe705328c-0e97-489c-ba31-de2f810dee59.jpeg</url>
      <title>DEV Community: Pratyush_Udhani7</title>
      <link>https://dev.to/pratyushudhani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pratyushudhani"/>
    <language>en</language>
    <item>
      <title>How to connect headless linux server to internet without network manager</title>
      <dc:creator>Pratyush_Udhani7</dc:creator>
      <pubDate>Tue, 27 May 2025 10:10:04 +0000</pubDate>
      <link>https://dev.to/pratyushudhani/how-to-connect-headless-linux-server-to-internet-without-network-manager-j16</link>
      <guid>https://dev.to/pratyushudhani/how-to-connect-headless-linux-server-to-internet-without-network-manager-j16</guid>
      <description>&lt;p&gt;In a headless installation you can connect to wifi networks using network-manager, iwctl etc. But wait first you need to install these, and for that you need internet. &lt;/p&gt;

&lt;p&gt;I was stuck in this egg-chicken problem myself and then I got to know about Netplan and wpa_supplicant.&lt;/p&gt;

&lt;p&gt;In this guide, we'll walk through two methods to connect your Linux server to Wi-Fi using only built-in tools: Netplan and wpa_supplicant.&lt;/p&gt;

&lt;h2&gt;
  
  
  Method 1: Netplan
&lt;/h2&gt;

&lt;p&gt;Netplan is Ubuntu’s default network configuration system. You can define Wi-Fi networks in a YAML file and let the system manage them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Edit Netplan configuration file&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vim /etc/netplan/01-netcfg.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file name may vary. It will look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;network&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
  &lt;span class="na"&gt;wifis&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# wifi interface&lt;/span&gt;
    &lt;span class="na"&gt;wlo1&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;dhcp4&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="na"&gt;access-points&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SSID_1"&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;auth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;key-management&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;psk"&lt;/span&gt;
            &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;password"&lt;/span&gt;
      &lt;span class="err"&gt;  &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SSID_2"&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;auth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;key-management&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;psk"&lt;/span&gt;
            &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;password2"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;wlo1&lt;/code&gt; with your own wifi interface. Use &lt;code&gt;ip link show&lt;/code&gt; to find your interface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Apply the changes&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;netplan apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect to the Wi-Fi&lt;/li&gt;
&lt;li&gt;Request a DHCP IP address&lt;/li&gt;
&lt;li&gt;Set up the default route&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Test your connection&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Method 2: wpa_supplicant
&lt;/h2&gt;

&lt;p&gt;wpa_supplicant is the backend used by most Linux systems to handle WPA/WPA2 Wi-Fi authentication. It connects your Wi-Fi interface to a protected wireless network using a configuration file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Generate a Secure Wi-Fi Config&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wpa_passphrase &lt;span class="s2"&gt;"YourSSID"&lt;/span&gt; &lt;span class="s2"&gt;"YourPassword"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; wpa.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generated a config for your wifi. If you don't know the SSID, you can easily check it through some other device. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Create the Configuration File&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vim /etc/wpa_supplicant/wpa_supplicant.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the contents of &lt;code&gt;wpa.conf&lt;/code&gt; to this file. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Start wpa_supplicant&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;wpa_supplicant &lt;span class="nt"&gt;-B&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; wlan0 &lt;span class="nt"&gt;-c&lt;/span&gt; /etc/wpa_supplicant/wpa_supplicant.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;wlan0&lt;/code&gt; with your own wifi interface. Use &lt;code&gt;ip link show&lt;/code&gt; to find your interface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Test your connection&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Troubleshooting&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure the wifi interface is up by running &lt;code&gt;sudo ip link set wlo1 down&lt;/code&gt; &lt;code&gt;sudo ip link set wlo1 up&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;wpa_supplicant might interfere by creating p2p-dev-wlan0 and I found it useful to kill it's instances to resolve those conflicts. &lt;code&gt;sudo killall wpa_supplicant&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>linux</category>
      <category>homelab</category>
      <category>devops</category>
      <category>network</category>
    </item>
  </channel>
</rss>
