The HOSTALIASES
environment variable allows users to set their own host aliases instead of having to sudoedit
/etc/hosts
(more details, e.g., at http://blog.tremily.us/posts/HOSTALIASES/)
However, with /etc/hosts
I can alias IP addresses to names and names to names, whereas HOSTALIASES
only seems to work with name to name aliasing.
I tried:
cat > .hosts
work 10.10.0.1
g www.google.com
^D
export HOSTALIASES=$PWD/.hosts
and now
curl g #works
curl 10.10.0.1 #works
curl work #doesn't work
Can I make curl work
work without needing to edit a file I don't have write permissions to (/etc/hosts
) ?
curl -v work
andgetent hosts work
?getent hosts g
gets me $? == 0: 2a00:1450:400c:c05::67 www.google.com10.10.0.1
for A record query for domain name10.10.0.1.
, as ifinet_aton()
applied. BIND returns NXDOMAIN for such queries. You can see it byhost 10.10.0.1. <nameserver address>
10.10.0.1
as a domain name as-is, simply queries to libnss resolver modules with it.work 10.10.0.1.xip.io
.