Change IP to domain name on linux
8,113
Solution 1
you can add a line like
127.0.0.1 my.host whatever.com
to /etc/hosts if you want to bind a hostname to an IP. In most default configurations this file is consulted first.
Solution 2
I'n not sure exactly what you're asking, but if you just want to know how to look up a domain name associated with an IP address, you can use dig -x
to do a reverse DNS lookup:
$ dig +short -x 69.59.196.211
stackoverflow.com.
Note that this won't always work, because there may be multiple domain names pointing at a single IP address, and it's not always the case that every IP address has a reverse DNS mapping.
Related videos on Youtube
Author by
Hulk
Updated on September 17, 2022Comments
-
Hulk over 1 year
All,
How is that we can convert an IP to a domain name address on linux machine.
Suppose i always access my Pc with http://127.0.0.1 from the browser
I want to change this to my.com
Thanks....
-
balpha over 14 yearsThis belongs on superuser. But take a look at
man hosts
-