Skip to main content
More complete instructions are available at SF
Source Link
Stephen Ostermiller
  • 99.9k
  • 18
  • 145
  • 364

Ubuntu is running the service systemd-resolved that maps localhost subdomains to your local IP address.

If you query the DNS using dig you will see that it gets the local IP address (127.0.0.1) from a SERVER running on a localhost IP address (127.0.0.53):

$ dig www.subdomain.localhost
...
www.subdomain.localhost. 0  IN  A   127.0.0.1
...
;; SERVER: 127.0.0.53#53(127.0.0.53)

The configuration file that sets up the DNS servers to use (resolv.conf) specifies to use this local DNS server:

$ cat /etc/resolv.conf 
...
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53

You can verify that the systemd-resolved service is running with

$ sudo service systemd-resolved status
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
     Active: active (running) ...

This service is available on Debian: https://manpages.debian.org/stretch/systemd/systemd-resolved.service.8.en.html but it is not enabled by default. You should be able to start the service on Debian with:

sudo systemctl start systemd-resolved

To make it by following the run by default on system startup, you can useinstructions from this Server Fault question:

sudo systemctl enable systemd-resolved Is that possible for debian users to connect to network through systemd-networkd?

Ubuntu is running the service systemd-resolved that maps localhost subdomains to your local IP address.

If you query the DNS using dig you will see that it gets the local IP address (127.0.0.1) from a SERVER running on a localhost IP address (127.0.0.53):

$ dig www.subdomain.localhost
...
www.subdomain.localhost. 0  IN  A   127.0.0.1
...
;; SERVER: 127.0.0.53#53(127.0.0.53)

The configuration file that sets up the DNS servers to use (resolv.conf) specifies to use this local DNS server:

$ cat /etc/resolv.conf 
...
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53

You can verify that the systemd-resolved service is running with

$ sudo service systemd-resolved status
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
     Active: active (running) ...

This service is available on Debian: https://manpages.debian.org/stretch/systemd/systemd-resolved.service.8.en.html but it is not enabled by default. You should be able to start the service on Debian with:

sudo systemctl start systemd-resolved

To make it the run by default on system startup, you can use:

sudo systemctl enable systemd-resolved

Ubuntu is running the service systemd-resolved that maps localhost subdomains to your local IP address.

If you query the DNS using dig you will see that it gets the local IP address (127.0.0.1) from a SERVER running on a localhost IP address (127.0.0.53):

$ dig www.subdomain.localhost
...
www.subdomain.localhost. 0  IN  A   127.0.0.1
...
;; SERVER: 127.0.0.53#53(127.0.0.53)

The configuration file that sets up the DNS servers to use (resolv.conf) specifies to use this local DNS server:

$ cat /etc/resolv.conf 
...
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53

You can verify that the systemd-resolved service is running with

$ sudo service systemd-resolved status
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
     Active: active (running) ...

This service is available on Debian: https://manpages.debian.org/stretch/systemd/systemd-resolved.service.8.en.html but it is not enabled by default. You should be able to start the service on Debian by following the instructions from this Server Fault question: Is that possible for debian users to connect to network through systemd-networkd?

Source Link
Stephen Ostermiller
  • 99.9k
  • 18
  • 145
  • 364

Ubuntu is running the service systemd-resolved that maps localhost subdomains to your local IP address.

If you query the DNS using dig you will see that it gets the local IP address (127.0.0.1) from a SERVER running on a localhost IP address (127.0.0.53):

$ dig www.subdomain.localhost
...
www.subdomain.localhost. 0  IN  A   127.0.0.1
...
;; SERVER: 127.0.0.53#53(127.0.0.53)

The configuration file that sets up the DNS servers to use (resolv.conf) specifies to use this local DNS server:

$ cat /etc/resolv.conf 
...
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53

You can verify that the systemd-resolved service is running with

$ sudo service systemd-resolved status
● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
     Active: active (running) ...

This service is available on Debian: https://manpages.debian.org/stretch/systemd/systemd-resolved.service.8.en.html but it is not enabled by default. You should be able to start the service on Debian with:

sudo systemctl start systemd-resolved

To make it the run by default on system startup, you can use:

sudo systemctl enable systemd-resolved