How to set / change FQDN to Ubuntu 20.04 Linux

How do I set/change my server’s Totally Certified Area Identify (FQDN) on Ubuntu 20.04 LTS “Focal Fossa” Linux?

An FQDN is an acronym for a completely certified area identify. Often known as an absolute area identify. For instance, server1.cyberciti.biz is FQDN. It’s a part of DNS (Area identify System). This web page explains how one can view, set/change FQDN on an Ubuntu Linux 20.04 LTS server or desktop system.

ADVERTISEMENTS

 

Viewing hostname together with FQDN

The hostname command and hostnamectl command reveals the Ubuntu system’s totally certified host identify together with FQDN. Open the terminal utility after which kind:
$ hostname
nixcraft-wks01.candy.residence
$ hostnamectl standing

Static hostname: nixcraft-wks01.candy.residence
Icon identify: computer-laptop
Chassis: laptop computer
Machine ID: 7e163c7b219a4bed8968e482b3c3fa30
Boot ID: 84e3a955a6a14bd8975f44c6bd8b681c
Working System: Ubuntu 20.04.1 LTS
Kernel: Linux 5.4.0-42-generic
Structure: x86-64

The /and many others/hostname file

A static hostname for the Ubuntu field is all the time set within the /and many others/hostname file. Use the cat command to show it:
$ cat /and many others/hostname

server1.cyberciti.biz

In fact, we will use a textual content editor to switch the file. For instance:
$ sudo vim /and many others/hostname
## OR ##
$ sudo nano /and many others/hostname

Setting or altering FAQDN on Ubuntu 20.04 LTS per interface (superior config)

Nevertheless, the beneficial method is to make use of the hostnamectl command to edit/and many others/hostname file. The syntax is:
$ sudo hostnamectl set-hostname only-host
$ hostnamectl set-hostname host.your-fqdn-here
$ hostnamectl set-hostname server1.cyberciti.biz
Confirm it:
$ hostnamectl standing
# Present the Ubuntu system’s DNS area identify #
$ dnsdomainname

How to set / change FQDN to Ubuntu 20.04 Linux
Please notice that if /and many others/hostname file doesn’t exist on Ubuntu Linux, the host identify is about by a reverse DNS question when the community interface will get an IP handle assigned.

Set or change FQDN ( area identify ) on Ubuntu 20.04 Focal Fossa Linux

You may set or change the system FQDN utilizing community interface config file too. For instance, right here is config for my eth0 interface:
# cat /and many others/systemd/community/010-eth0.community

#The community file incorporates a [Match] part, which determines if a given community file could also be utilized
#to a given machine; and a [Network] part specifying how the machine ought to be configured.
[Match] Identify=eth0[Network] DHCP=no
DNS=192.168.2.254 10.8.0.1

#The Domains= defines a whitespace-separated listing of domains which ought to be resolved utilizing
#the DNS servers on eth0. Every merchandise within the listing ought to be a site identify. The domains with the
#prefix are referred to as “routing-only domains”. The domains with out the prefix are referred to as “search domains”
#and are first used as search suffixes for extending single-label hostnames (hostnames containing no dots)
#to grow to be totally certified domains (FQDNs).
Domains=server1.cyberciti.biz
IPv6PrivacyExtensions=false

## IPv4 stuff ##
Gateway=192.168.2.254
Deal with=192.168.2.25/24
Deal with=10.8.0.2/24

See systemd documentation for extra info.

Testing DNS identify decision

FQDN, corresponding to server1.cyberciti.biz, will solely work in the event you replace your DNS and level out to your Ubuntu server’s IPv4/IPv6. In different phrases, arrange DNS A and AAAA entries for server1.cyberciti.biz. Use the dig command or host command to check DNS server connectivity together with FQDN:
$ dig server1.cyberciti.biz
$ host server1.cyberciti.biz
We are able to use the ping command to see community connectivity:
$ ping server1.cyberciti.biz

Conclusion

We use the hostnamectl command to alter the host identify and replace /and many others/hostname file on Ubuntu Linux 20.04 LTS field.

Posted by: Vivek Gite

The writer is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a coach for the Linux working system/Unix shell scripting. Get the most recent tutorials on SysAdmin, Linux/Unix and open supply matters through RSS/XML feed or weekly e mail publication.

ADVERTISEMENTS

ubuntu 20.04 set fqdn,ubuntu 18.04 set fqdn,change fqdn ubuntu,ubuntu 20.04 set domain name,how to set domain name in linux,ubuntu 20.04 set dns server,linux change hostname permanently ubuntu,change localhost to domain name ubuntu