Making random device name on each computer boot

Hello, I was wondering if there is a way to make device name randomly generated on each computer boot so that on a local network computer would be harder to detect?
P.S. on Silverblue : )

Sounds like an interesting idea! I’m not sure if systemd has something built-in, but this looks simple: GitHub - ryanmroth/randomhost: Generate and set a random hostname on Linux boot


I’m thinking it’d be possible to randomly generate a string and pass it to hostnamectl through cron or start-up service, but I’m thinking that could be applied late-boot while presenting the non-random hostname to earlier services.

1 Like

Only if you tell dhcp to use the hostname will it leak onto the network.

For an IPv6 network you can set it up to use temporary IPv6 addresses for each new connection. This is on my list of things to learn how to configure for my home network now I have IPv6 at home.

1 Like

There’s a chain here with FreeBSD that has a solution and a few ways to generate the string and char limit: Generating a random hostname

It sounds like at the end, instead of passing it to rc.conf, maybe it can be passed to hostnamectl: Generating a random hostname

Or to /etc/hostname (RHEL)

The host name is only of very limited use to track a host. Its MAC addresses are far easier to obtain and globally unique identifiers.

1 Like

I tried to do it before with some script, but it did not work.
It would be nice if Fedora could implement this feature, just like random MAC.
Please : D

Simply tell dhcp not to send the hostname. Now no external system is told your hostname.

I other words the security you want is already implemented.

It’s probably Bonjour that is creeping the OP out. I find the way it broadcasts information about your PC to whatever network you are connected to a bit disturbing as well. I don’t think services that do that sort of thing should be enabled by default.

Excerpted from serverfault.com – How to use Bonjour?:

  1. If a computer is running Bonjour, its hostname is published on the LAN via mDNS. …
$ systemctl status avahi-daemon.socket
â—‹ avahi-daemon.socket - Avahi mDNS/DNS-SD Stack Activation Socket
     Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.socket; disabled; preset: enabled)
     Active: inactive (dead)
   Triggers: â—Ź avahi-daemon.service
     Listen: /run/avahi-daemon/socket (Stream)
1 Like

It is not the same thing.
Could you explain in detail how to do that (maybe with fedora’s firewall)?
Thank you.

You would need to make a config change with NetworkManager.

Apparently this command where $i is the interface name.
I did not test this.

nmcli connection modify "$i" ipv4.dhcp-send-hostname no ipv6.dhcp-send-hostname no

So, if you need a script it in not implemented?

What script are you referring to?

Is your point are adding small shell scripts is not counted as a config change?

Yes, It would be a lot easier if that could be done in system settings - by marking the option with a tick or maybe linking a text file with your created names that would be picked randomly by the system - implemented with graphical user interface.
Easily and quickly : )