How to Install Dnsmasq on Clear Linux

Dnsmasq is a lightweight and easy-to-configure DNS and DHCP server designed to provide DNS and DHCP services to a small network. It can be used on Clear Linux to provide name resolution and IP address allocation services for a home or small office network.

In this tutorial, we will show you how to install Dnsmasq on Clear Linux using the following steps:

  1. Update your Clear Linux system
  2. Install Dnsmasq
  3. Configure Dnsmasq
  4. Test your Dnsmasq configuration

Step 1: Update your Clear Linux system

Before installing Dnsmasq on Clear Linux, it is recommended to update your system to the latest version available. To update your Clear Linux system, run the following command in a terminal:

sudo swupd update

This command will update all current packages on your system to their latest version.

Step 2: Install Dnsmasq

After updating your system, run the following command to install Dnsmasq:

sudo swupd bundle-install dnsmasq

This command will install Dnsmasq and its dependencies on your Clear Linux system.

Step 3: Configure Dnsmasq

After installing Dnsmasq, you need to configure it to provide DNS and DHCP services.

To configure Dnsmasq, follow the steps below:

  1. Create a dnsmasq configuration file in the /etc directory:

    sudo touch /etc/dnsmasq.conf
    sudo nano /etc/dnsmasq.conf
    
  2. In the editor, add the following lines to the configuration file to enable DNS resolution and DHCP server options:

    # DNS resolution
    domain-needed
    bogus-priv
    no-resolv
    
    # DHCP server options
    dhcp-range=192.168.0.20,192.168.0.254,255.255.255.0,12h
    dhcp-option=3,192.168.0.1
    dhcp-authoritative
    

    Note: Replace 192.168.0.1 with your router's IP address, and the DHCP range with your preferred IP range and lease time.

  3. Save and close the file.

Step 4: Test your Dnsmasq configuration

After configuring Dnsmasq, restart the service and test the configuration by pinging a hostname on your network.

To restart the Dnsmasq service, run the following command:

sudo systemctl restart dnsmasq.service

To test your Dnsmasq configuration, run the following command:

ping mycomputer.local

If Dnsmasq is working correctly, you should see the IP address of the hostname you are trying to ping.

Congratulations! You have successfully installed and set up Dnsmasq on Clear Linux.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!