69

Since the previous answers to this question were written, there have been a couple of RFCs that alter the guidance somewhat. RFC 6761 discusses special-use domain names without providing specific guidance for private networks. RFC 6762 still recommends not using unregistered TLDs, but also acknowledges that there are cases where it will be done anyway. ...


55

Using an IP address ensures that you are not relying on a DNS server. It also has the benefit of preventing attacks through DNS spoofing. Using a FQDN instead of an IP address means that, if you were to migrate your service to a server with a different IP address, you would be able to simply change the record in DNS rather than try and find everywhere that ...


49

You can change the kernel's idea of the hostname on a systemd-based system using the hostnamectl tool. For example: hostnamectl set-hostname whatever You can view the system's current idea of the hostname with: hostnamectl # equivalent to hostnamectl status Keep in mind that this does not change a running process's idea of the hostname. Such ...


47

It's brute force. They have looked up the IP addresses of every domain name they can find, and then compiled the results into their own database.


41

DNS is not just FQDN = IP The important thing about DNS is that it provides more than just A records (hostname = IP). DNS provides different types of records such as MX, CNAME, TXT, etc... that may be required by some software, sometimes. It allows multiple address records, IPv4 + IPv6 records, dynamic addresses, load balancing, geo location based ...


39

Possibly you could use mod_headers in conjunction with mod_proxy. I haven't tested it though. So for your app-dev vhost you could have: RequestHeader set Host "app.internal.domain" and then you would add: ProxyPreserveHost On


37

RFC 1123 relaxes a constraint of RFC 952 which specifies a legacy of the Hostname Server Protocol (described in RFC 953) replaced by DNS. So a fully numeric hostname would be valid per these RFCs. RFC 1123 itself discusses consequences when it comes to IP versus hostname parsing : If a dotted-decimal number can be entered without such identifying delimiters,...


33

Found the problem. The base AMI on EC2 for Debian Jessie, does not have dbus installed. hostnamectl seems to need dbus. So the fix is to: apt-get update && apt-get install -y dbus And then: hostname=myname echo "127.0.0.1 $hostname" >> /etc/hosts hostnamectl set-hostname "$hostname" echo "$hostname" > /etc/hostname # uneeded This ...


22

Host names do not correspond to an {ipaddress,port} tuple. A host name is only the name of a server, which should be resolvable to one or more IP addresses. Ports have nothing to do with host names at all.


22

You can change the in-kernel hostname using: hostname NEWNAME On Linux this is practically equal to either of the following: sysctl kernel.hostname=NEWNAME echo NEWNAME > /proc/sys/kernel/hostname This does not depend on systemd (unlike hostnamectl which requires systemd-hostnamed) or any other non-standard tools, and often (especially in shellscript-...


20

As always there are de jure and de facto standards. While "nonprofit" ICANN plays in politics and money we, common people, suffer. IETF once introduced .home (RFC 7788) for personal home intranets but they don't have power over only-for-pofit IANA players and reintroduced domain under .home.arpa (RFC 8375) as IETF controls only .arpa. Appendix G of ...


15

I was curious myself, and i didnt like any of the other answer because they didnt seem to answer what i was looking for atleast. The Answer: Looking back at this doc it almost appears as if Thomas was stating is "giving it another dedicated ip on the loopback allows it to be canonical". Both point to your loopback. Using the following 127.0.1.1 is ...


15

Originally the hostname couldn't start with a digit or underscore (RFC 952) but the new specification RFC 1123, as you mentioned, allows it. Concerning the call to isValid(), in this case, the full domain name should be passed in parameter: InternetDomainName.isValid("8server.com");


15

To understand what's going on, you need to know a little about DNS. When a client wants to connect to a service on a given host, it looks up the hostname through its local DNS infrastructure, and receives an IP address in response. It then connects to that IP address, and requests the service in the manner prescribed by the procotol it's built to implement. ...


14

It's going to be rough for people to answer this question because it starts with a simpler premise and proceeds to go down a deep rabbit hole from there. Let's start from the beginning. Host file vs. DNS I don't think this needs much explanation, so I'll keep it brief. The purpose of the hosts file is to define host to IP address mappings that do not rely ...


12

Here's a little systemd service that lets you specify an alias for your current machine like test.local in addition to hostname.local (assuming your machine is called hostname). Setup First install avahi-utils, if you haven't already: sudo apt-get install avahi-utils Then put the following into /etc/systemd/system/avahi-alias@.service [Unit] Description=...


11

You need to do two things (but have only done one of them): Set the hostname in /etc/hostname. Edit /etc/cloud/cloud.cfg and set preserve_hostname to True. (You can also pass this option in with your user data.) The second step is required because Fedora uses cloud-init to bring in user data from the EC2 environment to provision the instance, and cloud-...


11

nslookup (name server lookup) doesn't work with entries in the host file, instead it queries the DNS system, which doesn't know about names defined in your local hosts file. Try to just ping the name or access it in the web browser.


10

I've just had this here at work. DNS should be case insensitive.... the RFC specifies that .https://tools.ietf.org/html/rfc4343 but doesn't say it MUST be lower case. So we had the pleasure of troubleshooting a host that didn't resolve things right for our internal domain "t.local" p123$ ping p123-db.t.local PING p123-db.t.local (192.168.106....


10

In haproxy >= 1.7, you should be able to use the init-addr option, specifying none to prevent DNS resolution at startup. From the docs: init-addr {last | libc | none | <ip>},[...]* Indicate in what order the server's address should be resolved upon startup if it uses an FQDN. Attempts are made to resolve the address by applying in turn each of ...


9

Use getent ahosts, for instance: $ getent ahosts www.google.com | sed -n 's/ *STREAM.*//p' 216.58.210.196 2a00:1450:4006:803::2004 You'll get all IPv4 and IPv6 addresses, via the glibc resolver (thus using /etc/hosts first, as usually configured in /etc/nsswitch.conf). Do not use getent hosts, as it will give you either IPv6 or IPv4 addresses (not both), ...


9

Yes. RFC 1123 clearly allows it and here's an example: http://9292.nl/ It's the route planner for Dutch public transportation.


9

I usually would just ping starting whichever hostname I think is available and increase/decrease the number until i find an open hostname. You're doing this the hard way. It would be easier to use a spreadsheet to track the computer names you've assigned. If you have a team that is responsible for naming computers a shared Google Sheets or the equivalent ...


9

A "virtual host" is simply a feature of a piece of software which takes advantage of extra context in a request to act differently. An important thing to note is that TCP/IP itself does not know anything about host names; their main purpose is as a way to find IP addresses. The classic example is an HTTP Server using name-based virtual hosting, which works ...


8

It's probably not going to break much of anything on your local machine, assuming no Windows domain nor DHCP is involved. However, the identifier 'localhost' specifically and always is defined to mean the local machine. This means that any other computer that wants to connect to you by name will be unable to do so, because attempting to connect to '...


8

You've got a PTR record mapping 162.254.149.186 to host2.sparkdojo.com, which is fine, But there's no A record for host2.sparkdojo.com, so the lookup the other way is not working. You need both of them to work.


8

/etc/hosts is not DNS. Please use the right tool to test; nslookup and dig always consult DNS and never use the entries in /etc/hosts (or for that matter NIS, LDAP or other alternative hosts databases). The fact that the /etc/hosts file is used at all by your system and the priority it has is determined by the Name Service Switch libraries configured in /...


8

1) A hostname can be resolved to more than one IP address; this is called DNS round robin and can be used for load distribution, load balancing, or fault tolerance. 2) Host names are not in any way related to ports, they only map to one or more IP addresses.


8

There are a couple of mechanisms that could be at work here. Firstly, a system will often include its locally-configured hostname as a DHCP Client Identifier, and the router (which is also the DHCP and DNS server) will dynamically add a DNS record for that client ID matching the IP it gave out for that request. The other likely case is that the system is ...


7

The delegation points to these nameservers: buycott.com. 172800 IN NS ns-178.awsdns-22.com. buycott.com. 172800 IN NS ns-591.awsdns-09.net. buycott.com. 172800 IN NS ns-1381.awsdns-44.org. buycott.com. 172800 IN NS ns-2015.awsdns-59.co.uk. But those servers claim that ...


Only top voted, non community-wiki answers of a minimum length are eligible