4

My iMac's name is windowlick. Every time I reboot it, for some reason it detects that the name windowlick is already in use on the network and renames itself with a random suffix, e.g. windowlick (3829) or the like, and it gets a zeroconf/bonjour hostname of windowlick-2.local instead of the usual windowlick.local.

I can manually fix this by going to the Sharing preferences panel, but I'd rather not have to do this, especially since I often do remote access from an external network (via ssh to another machine that gets the incoming port assignment) and if my machine rebooted due to a power failure or a system update I don't like having to guess at the hostname.

My computer gets its IP address via DHCP assignment from the router (a recent Netgear); it also behaved this way on my previous router (an Apple Time Capsule). It has a reserved IP address for its wired Ethernet port, but it connects via both Ethernet and Wi-Fi (which does not have an address reservation). I suspect that something to do with name assignment is doing something weird with the order of operations on the Wi-Fi vs. Ethernet interfaces.

Unfortunately, I cannot simply disable Wi-Fi, as I make use of OS features that require that my Wi-Fi be active (for example, Unlock with Apple Watch).

Is there any way to tell macOS to not be "polite" and rename itself if it sees "another" machine by the same name?

This seems similar to My Mac mini's computer name keeps changing when it resumes from sleep but I don't have the problem when resuming from sleep, it's only after a reboot, and I already have the static IP assignment per the accepted answer on that question. Also, this doesn't happen on my MacBook (which does not have a static assignment).

5
  • mDNS and other zeroconf protocols don't work that way. If Bonjour is renaming your host it's because a conflicting host responded to a broadcast message. You can manually rename your machine, but Bonjour will automatically try to fix it by appending a unique digit. Find the dupe host and rename that.
    – Allan
    Nov 21, 2018 at 20:28
  • 2
    @Allan There is definitely no duplicate host on my network. This is my home network and I know exactly what all of my machines are named. There is only one windowlick. Also I'm not sure what you mean by "that way," in this case; I'm only sharing the symptoms I"m seeing and speculating that maybe my router is preemptively responding on my desktop's behalf for some reason, including to my desktop.
    – fluffy
    Nov 21, 2018 at 20:30
  • mDNS is multicast DNS meaning the host "casts" it's name and IP out to the network and if there are no conflicts, it caches it. First thing to do is find out what the TTL value is for your mDNS responder...(assuming it's your router), issue the command dig @192.168.1.1 type windowlick.local Post that output to your question. Replace that IP with your routers IP if necessary
    – Allan
    Nov 21, 2018 at 20:53
  • @Allan I am aware of the basics of how mDNS works, but I am also aware that some routers do interesting things with it these days to try to support things like wake-on-LAN and so on. That said it looks like my router doesn't actually store any local results for .local, so this must be something happening on the macOS side of things after all.
    – fluffy
    Nov 22, 2018 at 4:49
  • @Allan I have edited my question to remove the mDNS caching stuff because that does not seem plausible after all. Thanks.
    – fluffy
    Nov 22, 2018 at 4:52

4 Answers 4

4

For what it's worth, I had this exact same problem and also need to have both wifi and ethernet enabled on my iMac. It started after upgrading to Mojave, my router is an Asus RT-AC88U and had until Mojave been fine. After the update I started getting the message in macOS about a duplicate computer name on my network and my computer changed it's name from "iMac" to "iMac (2)" - but within a few days is was up to "iMac (2000)" and kept rising.

Spoke to Apple, they suggested deleting the wifi adapter and re-adding it in Mojave which didn't fix it. The only other thing they suggested was a rebuild of macOS from scratch.

I tried all the other fixes suggested everywhere, disabling wifi (not good as I also want to be able to unlock my mac with my apple watch) - but the problem does go away, renaming network locations, rebooting router, delete and re-add ethernet and everything else I came across. I also had the smart wifi option enabled on the router to combine the 2.4G and 5G SSID in to a single name broadcast (the router then assigns devices to the correct band) - it was suggested this might also be a problem so I put the router back to 2 different SSID's for the different bands. Nothing fixed the issue.

Then I realised that my ethernet adapter had a fixed IP address that I gave it but the wifi adapter was on DHCP. I had also reserved the fixed IP address on the router for ethernet but not wifi. So I reserved the 2 addresses I wanted for both adapters on the router and then set them to DHCP on the iMac. I also made sure that the Advanced settings for the IP address had a different DHCP Client ID name specified just to be sure.

So far so good, the iMac hasn't changed it's name in a few days now.

2
  • Oh! That's probably it - I have the same setup, with the wifi getting a dynamic address and the ethernet being statically-assigned. I'll try setting both to be static. Thanks!
    – fluffy
    Dec 29, 2018 at 22:02
  • unfortunately that eventually stopped working too. argh why does apple have to keep throwing a spanner in the works
    – fluffy
    May 18, 2019 at 17:44
2

Recommend you try following in Terminal to make your windowlick static

sudo scutil –-set HostName new_hostname

sudo scutil –-set LocalHostName new_hostname

sudo scutil –-set ComputerName new_hostname
0
2

The problem is you have a multi-homed host on the same network; two simultaneous network connections.

It has a reserved IP address for its wired Ethernet port, but it connects via both Ethernet and Wi-Fi (which does not have an address reservation).

There's no reason to do this.

Disconnect your WiFi (IMO) wired is better. Reboot and your host name should stick.

You can't have the same host name for different adapters on the same network. If windowlick.local had two IP addresses on the same network, which IP would it go to if you issued a ping windowlick command? This is why it automatically renamed the hostname.

However, you can have the same hostname on different subnets. For example, WiFi was on the 192.168.1.0 network and Ethernet was on 192.168.2.0 network..

9
  • 1
    I was multihoming as a workaround to other problems with wireless clients not being able to talk to my desktop, though. And shouldn't macOS be able to determine that the "other" windowlick is still itself and that it shouldn't have to change its machine name as a result?
    – fluffy
    Nov 22, 2018 at 19:18
  • Although I just checked the various wireless clients I was having trouble with before and they all seem to be working on a wired-only connection, so I guess this solution is probably what I'll stick with for now. Thanks.
    – fluffy
    Nov 22, 2018 at 19:37
  • To answer the question in the first comment...macOS won't make assumptions. Remember, the name is not just for internal use, it's for other hosts to find you and you can't have the same name pointing to different addresses. If you still have issues with your wireless not talking to wired clients, post a new question because that in and of itself is a problem that should be addressed.
    – Allan
    Nov 22, 2018 at 19:58
  • 1
    Do you happen to know how macOS is detecting whether the bonjour name is already in use? Because if it's detecting that it's in use by itself that would mean it's pretty safe for it to not change the bonjour name. It seems weird to me that macOS would conflict with itself on a use case that is supported very well by the OS itself; multi-homing isn't even remotely new to macOS. Also my wired network was set at the highest priority. Regarding the wireless vs wired, that was an old problem I hadn't re-evaluated in a while, and of course I would open a separate question for it if I had a need.
    – fluffy
    Nov 22, 2018 at 21:56
  • 1
    And I just ran into a reason why I need Wi-Fi to be enabled: it's required for my Apple Watch to be able to unlock it.
    – fluffy
    Nov 22, 2018 at 22:07
1

I’ve had that same renaming issue for a while when keeping both my ethernet and WiFi interfaces active. I just found out that the aliases I had created in my ISP router to easily keep track of all my devices (mac addresses) connecting to it was triggering this. I was using the same alias name for both mac addresses. I now added -ETH and -WiFi to the alias name in my router to uniquely identify the ethernet and WiFi connections from my computer.

Did the trick for me. Both interfaces on same network with hostname of my computer no longer changing.

1
  • Unfortunately, my router doesn't provide any means of setting a DHCP client name for macOS to apply to the interface. But this would be a great option for someone whose router does have that option.
    – fluffy
    Dec 22, 2020 at 23:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .