2

It sounds like a stupid question but...

If I had a domain such as example.com, could I set the IP address of abc.example.com to 127.0.0.1?

Are there any side effects I should know of? E.G. would it not try to connect to myself? Would it also upset the main site (example.com)?

2
  • Yep, I have to agree with the first part. Perhaps you can tell us what you're hoping to achieve. Then we might be able to give you a useful answer. Jan 1, 2011 at 6:50
  • @John Gardeniers: Its more about research. I mostly wanted to know if it will work (directly an ip address designated for lan or localhost) and side effects. I had localweb.com in my host file now in case i need to use a webaddress not an ip address (which came in handy when testing subdomains) and i was just wondering
    – user274
    Jan 1, 2011 at 15:43

2 Answers 2

3

Anyone trying to reach abc.123.com will always be directed to their local computer. You might have some local effects on the server itself, but probably not since most services will rely on /etc/hosts before resorting to DNS.

1
  • This is mostly usable for Penetration Testing (pen test) where one might be able to do server-side content include using a normally looking URL that in fact connects to localhost. E.g. if server tries to render preview of user submitted links and user submits http://abc.123.example.com/server-status instead of blacklisted http://localhost/server-status and the server renders supposedly internally accessible page visible to the tester. Oct 8, 2019 at 9:29
3

Yes, you can do this, and some people do.

For quite a while there was a running joke where, when someone asked for illegal software, they would be sent to warez.example.com - which had been set up in DNS to point to 127.0.0.1. Hilarity ensues when the person comes back and says something like he had all that software already.

You must log in to answer this question.