.local domains do not work after restarting the local server

My YunoHost server

Hardware: Old laptop or computer
YunoHost version: YunoHost 11.2.27 (stable)
I have access to my server : through the webadmin | direct access via keyboard / screen | …
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no
If yes, please explain:

Description of my issue

Hello everyone,
I am working on a local yunohost which is accessible from the home network only.

I set a local domain as yunohost.local
Another local domain for an app nextcloud.local

Both worked fine until I restart the server.

So after I restart my server the local domains are not working at all. In fact, I can access my server via ip 192.168.XX.XXX only.

When I go to domains and create new local domain new.local all domains start working again.

What could be the solution for this problem?

Thank you in advance!

Alright, I found that I need to edit my client host file like mentioned here:

I changed the settings on my Windows PC and works fine. But it does not work on my phone.

There is no DNS redirection mode available on my home router.

I keep searching for more reliable solution.

I do not know why but when I add new xxx.local domain. It works perfectly until I restart the server.

Any recommendations are appreciated.

Please share the logs of the yunomdns service. :slight_smile:

Thank you so much for your response!

Here is my log: hastebin

I did some experiments:
It seems that yunomdns working normally even though I cannot access the .local domains.
If I stop yunomdns service and then start it, all .local domains are working fine again.

P.S. I need to do stop and start, restart does not work.

Thanks!

I reinstalled the entire YunoHost system, but the problem persisted.

I found a workaround that involves restarting the yunomdns service 30 seconds after the PC starts. It works well.

Here’s how you can do it:

To delay the execution of the sudo systemctl restart yunomdns command by 30 seconds after the system starts, you can modify the systemd service file to include a sleep command. Here’s how you can do it:

Step 1: Create or Modify the Systemd Service File

  1. Create or edit the service file:

    sudo nano /etc/systemd/system/restart-yunomdns.service
    
  2. Add the following content:

    [Unit]
    Description=Restart yunomdns service after boot with delay
    After=network.target
    
    [Service]
    Type=oneshot
    ExecStart=/bin/bash -c "sleep 30 && /usr/bin/systemctl restart yunomdns"
    
    [Install]
    WantedBy=default.target
    
    • ExecStart=/bin/bash -c "sleep 30 && /usr/bin/systemctl restart yunomdns": This command tells systemd to wait for 30 seconds (sleep 30) before running the systemctl restart yunomdns command.
  3. Save and exit:

    • Press CTRL + X, then Y, and hit Enter to save the changes.

Step 2: Enable the Service

  1. Reload systemd to recognize the new or modified service:

    sudo systemctl daemon-reload
    
  2. Enable the service to run on boot:

    sudo systemctl enable restart-yunomdns.service
    

UPDATE: The solution I shared above is not working stably. I’ve spent quite some time trying to find a robust solution for getting local domains to work reliably. However, based on the discussion here: Running Yunohost without domain - local use only - #2 by Aleks, it seems that local domains don’t work well out of the box for home-local use.

You have a few options:

  1. Modify the etc/hosts file on each device.
  2. Set up DNS redirection on your router (if your router supports this feature). More details can be found at Local network access to your server | Yunohost Documentation
  3. Set up a local DNS server.

@tituspijean
Do you have another suggestion?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.