I am setting up an Ubuntu-Server-16 as a DHCP server and internet gateway router. One of the first things I did was to setup the hostname, domain name and FQDN(fully qualified domain name).
Here are my server specs:
1) First, I set static IP-addressing for the server like this:
CONFIGURE PRIMARY NETWORK INTERFACE
#The Primary network interface
auto enp0s3
address 172.16.1.2
netmask 255.255.255.0
network 172.16.1.0
gateway 172.16.1.1
2) Configure Hostname:
edit the "hostname" file at: /etc/hostname
for example: your hostname is: ubuntu-DHCPSERVER
3) Configure FQDN:
edit the "hosts" file at: /etc/hosts
template:
127.0.0.1 localhost.domain localhost
127.0.1.1 hostname.domainname hostname
yourip hostname.domainname hostname
example:
127.0.0.1 localhost.mywebdomain.com localhost
127.0.1.1 ubuntu-DHCPSERVER.mywebdomain.com ubuntu-DHCPSERVER
172.16.1.2 ubuntu-DHCPSERVER.mywebdomain.com ubuntu-DHCPSERVER
4) Activate Hostname and changes:
command: sudo hostname -F/etc/hostname
5) Verify configurations with this commands:
hostname --short
hostname --domain
hostname --fqdn
hostname --ip-address
thats all folks