A question about hostname.

Issues related to configuring your network
Post Reply
hack3rcon
Posts: 663
Joined: 2014/11/24 11:04:37

A question about hostname.

Post by hack3rcon » 2020/09/02 07:54:22

Hello,
What is wrong about below configuration?

Code: Select all

$ hostname
mydomain.example

$ hostnamectl
	Static hostname: mydomain
	Transient hostname: mydomain.example
	Operating System: CentOS Linux 8 (Core)
	CPE OS Name: cpe:/o:centos:centos:8
        Kernel: Linux 4.18.0-193.14.2.el8_2.x86_64
        Architecture: x86-64

$ cat /etc/hosts
192.168.1.1   www.mydomain.example    mydomain.example

$ cat /etc/hostname
mydomain
Any opinion welcomed.

Thank you.

User avatar
KernelOops
Posts: 322
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: A question about hostname.

Post by KernelOops » 2020/09/02 20:46:15

there is nothing wrong.

if you run: hostnamectl set-hostname mydomain.example, then thats exactly what you get...

essentially, your top level domain is "example" and your hostname is "mydomain".

did you expect something else?
--
I love my computer - all my friends live there.
--

hack3rcon
Posts: 663
Joined: 2014/11/24 11:04:37

Re: A question about hostname.

Post by hack3rcon » 2020/09/03 14:11:02

KernelOops wrote:
2020/09/02 20:46:15
there is nothing wrong.

if you run: hostnamectl set-hostname mydomain.example, then thats exactly what you get...

essentially, your top level domain is "example" and your hostname is "mydomain".

did you expect something else?
For a website with the name "mydomain.net" what is the values of "hostname" and "hosts" must be?
"Hostname" must be "mydomain" or "mydomain.net" ?

User avatar
KernelOops
Posts: 322
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: A question about hostname.

Post by KernelOops » 2020/09/03 22:08:17

usually, the server has its own subdomain, for example:

server.mydomain.net = the server itself identifying as "server"

then everything else would point to a service, for example:

mydomain.net = web (apache)
www.mydomain.net = alias of the above
ftp.mydomain.net = ftp (vsftpd)
irc.mydomain.net = irc (ircd)
pop.mydomain.net = pop3 (dovecot)
imap.mydomain.net = imap (dovecot)
...etc...

in practice, they are all just names, you can just use "mydomain.net" to listen for everything and not bother with subdomains.

hack3rcon wrote:
2020/09/03 14:11:02
For a website with the name "mydomain.net" what is the values of "hostname" and "hosts" must be?
"Hostname" must be "mydomain" or "mydomain.net" ?
--
I love my computer - all my friends live there.
--

hack3rcon
Posts: 663
Joined: 2014/11/24 11:04:37

Re: A question about hostname.

Post by hack3rcon » 2020/09/03 22:21:45

KernelOops wrote:
2020/09/03 22:08:17
usually, the server has its own subdomain, for example:

server.mydomain.net = the server itself identifying as "server"

then everything else would point to a service, for example:

mydomain.net = web (apache)
www.mydomain.net = alias of the above
ftp.mydomain.net = ftp (vsftpd)
irc.mydomain.net = irc (ircd)
pop.mydomain.net = pop3 (dovecot)
imap.mydomain.net = imap (dovecot)
...etc...

in practice, they are all just names, you can just use "mydomain.net" to listen for everything and not bother with subdomains.

hack3rcon wrote:
2020/09/03 14:11:02
For a website with the name "mydomain.net" what is the values of "hostname" and "hosts" must be?
"Hostname" must be "mydomain" or "mydomain.net" ?
For a web site with the name "example-test.net" and "192.168.1.2" IP address Is below configuration OK?

Code: Select all

# cat /etc/hostname
#localhost.localdomain
example-test.net
And:

Code: Select all

# cat /etc/hosts
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.2   example-test.net   example-test

User avatar
KernelOops
Posts: 322
Joined: 2013/12/18 15:04:03
Location: xfs file system

Re: A question about hostname.

Post by KernelOops » 2020/09/05 06:10:48

Ideally, you would use a subdomain for the server, like: server.example-test.net
--
I love my computer - all my friends live there.
--

hack3rcon
Posts: 663
Joined: 2014/11/24 11:04:37

Re: A question about hostname.

Post by hack3rcon » 2020/09/05 08:46:32

KernelOops wrote:
2020/09/05 06:10:48
Ideally, you would use a subdomain for the server, like: server.example-test.net
Thank you.
Thus, my current setting is OK too.

Post Reply

Return to “CentOS 8 - Networking Support”