Hostname got changed

I put a windows drive into my machine and booted it. Since then my linux hostname has been the name of the windows machine the hard drive was from… ?? I also mounted it from linux to access files on it.

My hostname in the /etc/HOSTNAME file is the correct old one still.

Though in /dev/.sysconfig/network/if-enp2s0 there is the wrong one. and when I grep my system for the new one I get among other thing a log message:

“2015-08-15T22:14:45.074225+02:00 <windows hostname> dhcpcd[6588]: enp2s0: setting hostname to `<windows hostname>’”

Changing the one in /dev/.sysconfig/network/if-enp2s0 does not help. It just gets reset on reboot.

As you can see, the DHCP client sets the hostname, IOW you get the hostname from your router (DHCP Server).
So change it on your router, or disable the option “Change hostname via DHCP” in YaST->Network Devices->Network Settings->Hostname/DNS.

Thanks. I don’t understand why this was triggered after putting that other drive into ma machine though. The computer the drive came from wasn’t used in more than a year also…

Did you boot from the drive?
Otherwise I don’t see any possibility that it would trigger this either, and would rather suspect this being just a coincidence.

yes, I did boot from it into the windows installation.

Well, then the case is clear I think:
Windows used the hostname it was configured to (that was saved on the hard disk in Windows’ registry), and told the router about it which remembered it and keeps assigning it to your PC now.

Okay, I see. Thanks a lot.

On 2015-08-16 00:46, Benutzer42 wrote:
>
> Thanks. I don’t understand why this was triggered after putting that
> other drive into ma machine though. The computer the drive came from
> wasn’t used in more than a year also…

Because you booted your machine with it, running Windows. Windows told
the router the proper name of the machine, and the router recorded it.
When you next booted the same machine in Linux, the router told the
machine what its name should be, because Linux asked.

Clever machines :slight_smile:


Cheers / Saludos,

Carlos E. R.

(from 13.1 x86_64 “Bottle” (Minas Tirith))

Shouldn’t have anything to do with the drive.

When DHCP sets a different name for your machine, it’s using the MAC adddress and the MAC address by default is burned into the silicon of the network adapter you’re using. This is why your machine might be mis-identified as some prior installation (or if you’re multi-booting or switching hard drives with a boot sector), no matter what else happens, your MAC address is the same in all cases.

You have the option in all OS (including both Windows and Linux) to spoof the MAC address, ie through software advertise a different MAC address than what is burned in silicon.

TSU

Of course it has.
The DHCP client (Windows in this case) can advertise a host name to the server.

The server (router) can remember that name based on the MAC address, and send it back to the client everytime the same MAC address sends a request.

On 08/15/2015 06:58 PM, Carlos E. R. wrote:
> On 2015-08-16 00:46, Benutzer42 wrote:
>>
>> Thanks. I don’t understand why this was triggered after putting that
>> other drive into ma machine though. The computer the drive came from
>> wasn’t used in more than a year also…
>
> Because you booted your machine with it, running Windows. Windows told
> the router the proper name of the machine, and the router recorded it.
> When you next booted the same machine in Linux, the router told the
> machine what its name should be, because Linux asked.
>
> Clever machines :slight_smile:
>
The first stage of them becoming self aware. :slight_smile:

Well, not really. :wink:

That’s part of DHCP since years.
I suppose it could cause problems if hosts in the network randomly get different names assigned, so a DHCP server always tries to assign the same name to the same system…
But as mentioned, the client can announce a name, and the server then remembers it.

So, really, the problem here just was that he booted from the Windows drive, where a different name was configured, i.e. a user error…

Although, a client does not have to use the name it gets from the server, in openSUSE there’s the option in YaST for that.

On 2015-08-16 19:36, wolfi323 wrote:
>
> kensch;2724197 Wrote:
>> The first stage of them becoming self aware. :slight_smile:
> Well, not really. :wink:
>
> That’s part of DHCP since years.

We were joking :-p


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Yeah, I got that.