Skip to content

Raspberry pi os

Remove .local from hostname/network alias

Raspberry pi os seems to use avahi to make itself availably using the .local ending.
But we want just the hostname without the .local!

Using NetworkManager (tested)

Open the NetworkManager hostname config:

sudo nano /etc/NetworkManager/conf.d/hostname.conf

Add the following and set the hostname you want to use:

[Connection]
hostname=<yourhostname>

Then restart NetworkManager

sudo systemctl restart NetworkManager

Using dhcpcd (untested pls report in an issue if worked/or not)

If you are using an older os you might need to change the dhcpcd configuration.
Open the config:

sudo nano /etc/dhcpcd.conf

Search for a hostname entry, remove the # at the start of the line and reboot the pi.

sudo reboot


Done, now your pi should be available with your custom hostname without using .local

Disabling avahi

Now we can disable the avahi daemon:

sudo systemctl stop avahi-daemon
sudo systemctl disable avahi-daemon