terminal host name changed

General support questions
User avatar
TrevorH
Forum Moderator
Posts: 28578
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: terminal host name changed

Post by TrevorH » 2020/03/20 14:48:01

It also retrieves it from DNS via reverse lookup.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 2800
Joined: 2007/12/11 08:17:33
Location: Finland

Re: terminal host name changed

Post by jlehtone » 2020/03/20 17:21:56

DHCP server multiple options. At least:
* hand out IP address and name to a client
* get name from client and choose IP address based on that
* hand out (random) IP from pool and notify the DNS that today name X has IP Y

But you have to configure DHCP&DNS for some of that to happen.

DHCP client can request the same IP that it had previously. Windows tends to do that.
DHCP server might hand same address from pool to a client, because it remembers previous lease and address has not been given to others yet.

Lets speculate:
DHCP hands addresses from a pool and they have no names.
Puppy offers a name. DHCP stores it in the lease info.
Same client (MAC) gets same IP as previously, along with other info (like name in previous lease).
CentOS does not offer a name, but is happy to accept one.

Plausible.

pjsr2
Posts: 468
Joined: 2014/03/27 20:11:07

Re: terminal host name changed

Post by pjsr2 » 2020/03/20 17:39:41

My CentOS 7 desktop PC gets an IP address from a DHCP server,
and terminal host name is set to user@dhcp-028053 where 028 and
053 is the last two numbers of the IP address. It is not set
locally, so I guess it must be given by the DHCP server. Just
speculating: I don't know how DHCP works, but it could be that
puppy communicates with the server and the name is stored. When
you start CentOS, the DHCP server may think it's the same PC
(same MAC address?) and it gives out that name.
It is all a little bit depending on the DHCP server version and how that server was configured.

Typically you can configure the DHCP server with a list of names that maps the clients MAC-address to a host name. This is sometimes combined with a fixed IP address for the client.

If a MAC-address isn't found, the DHCP server might refuse to handout a name and IP-address to this unknown client, or it can create a name for the client. Clients can be configured to send a proposal for their host name to the DHCP server. It is up to the DHCP server to accept the name proposed by the client or ignore the proposal. When a DHCP server creates a name, then that is typically done based on the MAC address of the client, as that is the only think the DHCP server knows about the client. The name typically consist of some fixed prefix followed by a decimal or hexadecimal representation of (a part of) the MAC-address, or a decimal or hexadecimal representation of the assigned IP address.

The common set-up is then that the DHCP server registers the name and IP address with a DNS server.

It is also common that DHCP servers remember clients that have accessed it before, so it hands out the same name and tries to avoid sending the same name to different clients.

bonedome
Posts: 152
Joined: 2017/04/22 08:11:04

Re: terminal host name changed

Post by bonedome » 2020/03/20 17:59:20

Thanks again for all the replies, some interesting learning going on at this end.
it could be that
puppy communicates with the server and the name is stored. When
you start CentOS, the DHCP server may think it's the same PC
(same MAC address?) and it gives out that name.
I think this may be the answer, I've just entered my router's settings and this device (laptop) is the only thing connected to it and is known as puppypc31420, with the mac address of my laptop, I'm also not familiar with how DHCP works so don't quite get why CentOS doesn't overwrite that (puppypc) hostname
jlehtone, just seen your latest
Lets speculate:
DHCP hands addresses from a pool and they have no names.
Puppy offers a name. DHCP stores it in the lease info.
Same client (MAC) gets same IP as previously, along with other info (like name in previous lease).
CentOS does not offer a name, but is happy to accept one.

Plausible.
very plausible
Trevor,
It also retrieves it from DNS via reverse lookup.
Do you mean the hostname
I also notice in my router settings for puppypc31420 the hostname is "Not available" when CentOS is running, which suggests that CentOS is not offering/setting a new hostname.
Without frying my brain looking into the inner workings of DHCP (tonight anyway) I'm happy nothing is amiss.
Thanks everyone for your input.
pjsr2 just seen your post and thanks for sharing your knowledge on DHCP

User avatar
TrevorH
Forum Moderator
Posts: 28578
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: terminal host name changed

Post by TrevorH » 2020/03/20 18:32:01

The reverse dns thing is why I suggested running host $ip to see if it was in dns.

You can probably fix all this by adding DHCP_HOSTNAME=centos8 or whatever to your ifcfg file.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 7 - General Support”