Getting my server to use a media.local instead of a ip address

Hi, since it’s cumbersome to remember a whole ip address, I want to use media.local:7878 instead of 192.168.132.10:7878/.
I have sonarr,radarr and transmission on my server already.

How do I do this?

You can add it to DNS on the network. If this isn’t possible then you can add it in the hosts file in the client. If this is Linux based then this is /etc/hosts if it’s Windows then this is in C:\Windows\System32\drivers\etc\hosts
You can then use the name as you desire

It’s linux based.

hostname --fqdn
media.local

nano /etc/hostname
also shows media.local

haaken@media:~$ hostnamectl
Static hostname: media.local
Icon name: computer-server
Chassis: server 🖳
Machine ID: 3d105eb8cd624b37b7f93ca6ade7e524
Boot ID: 546810995621482f96e5ec39fc9ac1fb
Operating System: Ubuntu 24.10
Kernel: Linux 6.11.0-13-generic
Architecture: x86-64
Hardware Vendor: Dell Inc.
Hardware Model: PowerEdge R720
Firmware Version: 2.9.0
Firmware Date: Fri 2019-12-06
Firmware Age: 5:185m5y 2w

If I try http://media.local:8989/ it can’t find the address.

If you run:

cat /etc/hosts

do you see an entry for the name you want to use?

The .local domain is reserved for mDNS queries, you should not use it in any non mDNS context.

If you want .local queries to work you should drop it from all your config files and make sure avahi-daemon is installed … when it answers an mDNS request it will automatically append .local to the hostname in its replies …

1 Like

cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 media

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
haaken@media:~$

I did that, still the same.

What does this command line output?

avahi-resolve-host-name media.local

A realistic example from my own network:

 53+0 ~$ avahi-resolve-host-name raspberrypi.local
raspberrypi.local       dead:beef:dead:beef:dead:beef:dead:beef
 54+0 ~$

avahi-utils wasn’t installed, but after a install
haaken@media:~$ avahi-resolve-host-name media.local
media.local 192.168.132.10
haaken@media:~$

That actually fixed the problem!

Media.local now works.

1 Like