Resume to set a domain name in Linux

concepts:

  • FQDN (Fully Qualified Domain Name)

eg:

hostname = server1 // FQDN = server1.example.com

1. First add FQDN to your hostname in /etc/hosts file.

# cat /etc/hosts
10.120.68.23 server1.example.com server1

confirm the FQDN issue the following command:

# hostname -f
server1.example.com

2.1. Configure domain name (Red Hat RHEL, Fedora and CentOS)

From these path add the parameters needs

vi /etc/sysconfig/network
DOMAINNAME=<domainname>
vi /etc/sysctl.conf
kernel.domainname = <domainname>

2.2. figure domain name ( Ubuntu, Debian)

#vi /etc/hostname
server1

Then restart the service:

# service hostname restart

3. add the domain in resolv.conf

vi /etc/resolv.conf
search example.com

4. check up everything is already config:

Your server’s hostname

# hostname
server1

Your FQDN

# hostname -f
server1.example.com

Your domain name of the server!

# dnsdomainname
example.com

Post Based:

Blog