1

i want make server ip mapping to localhost? should i vim /etc/hosts 127.0.0.1 localhost

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.51.101.35 iZ25kpavw8zZ
localhost 123.442.23

i want to do a reverse name lookup to compare the IP (123.442.23) and the hostname (localhost) to determine if they are the same machine.

how to do it?

  • I don't understand what you want to achieve. Do you want to set localhost to your public IP, or are you just looking for a way to find your public IP? I assume you are on EC2, and just see a private IP of your interface, not the public one? – noleti Nov 5 '15 at 9:00
0

I am guessing that you want to find your public IP, and you are on EC2 machine that does not directly let you access this information. A solution is given here. Execute this on the machine

wget -qO- http://instance-data/latest/meta-data/public-ipv4

it will give you your public IP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.