0

I puchased a domain, say fireworks.com, and I would like to call my server ubuntu-18-04.
How am I expected to edit /etc/hosts? Is it possible to add multiple aliases as follows?

127.0.0.1   localhost
127.0.1.1   ubuntu-18-04.fireworks.com fireworks.com ubuntu-18-04
5.247.221.66 ubuntu-18-04.fireworks.com fireworks.com ubuntu-18-04

Usually in documentation the /etc/hosts format has only three records:

1. An IP address
2. A fqdn
3. The hostname

Is it possible (and necessary?) to add a fourth record, as in my previous example, including fireworks.com? I would like to receive mail as sam@fireworks.com other than as sam@ubuntu-18-04.fireworks.com

4

From man hosts:

This manual page describes the format of the /etc/hosts file. This file is a simple text file that associates IP addresses with hostnames, one line per IP address. For each host a single line should be present with the following information:

          IP_address canonical_hostname [aliases...]

Yes, you can add multiple lines of IPs and aliases. But for your mail reception, I'd suggest you use DNS for domain name mapping. Use dnsmasq to make it easier, it resolves from /etc/hosts too

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.