How can I redirect *.localhost to 127.0.0.1 in Ubuntu 14.04?
7,648
As @Danatela mentioned, you need to have dnsmasq
installed in order for that approach to work. You can check if it is installed using apt-cache policy
command:
$ apt-cache policy dnsmasq
dnsmasq:
Installed: (none)
Candidate: 2.68-1
Version table:
2.68-1 0
500 http://ru.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
Use these commands to install it:
sudo apt-get update
sudo apt-get install dnsmasq
Alternatively, you can edit your /etc/hosts
file and add the following entries:
127.0.0.1 foo.localhost
127.0.0.1 bar.localhost
Related videos on Youtube
Author by
Alex Henrie
Updated on September 18, 2022Comments
-
Alex Henrie almost 2 years
I used to be able to make
foo.localhost
,bar.localhost
, etc. resolve to 127.0.0.1 by addingaddress=/localhost/127.0.0.1
to
/etc/dnsmasq.conf
But
dnsmasq.conf
doesn't exist in Ubuntu 14.04, and just creating it and adding the line doesn't work. Creating/etc/dnsmasq.d/star-dot-localhost
with the line doesn't work either. So how do I do wildcard DNS redirection in Ubuntu 14.04?-
Alex Henrie about 10 yearsOh. I thought it was installed by default. Thanks!
-
-
lrkwz over 8 yearsIs there any way to achieve the same result with "default" sw installed i.e. w/out dnsmasq?
-
Gomzy almost 5 yearsIs it possible to create a dynamic host like if I enter xyz.localhost or pqr.localhost or etc.localhost then it will open the same?