Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to lure a website from the web server without relying on DNS records? Windows IIS WebServer was working with headers, Linux is working with virtual server names etc.

Imagine this situation:

  • Server (linux + apache) directly accessible from the internet with his own IP (123.45.67.89). With default page like: "It's working!"
  • In Apache(httpd) a Virtual server is set like: server name: www.site.net , listening to any address default port.
  • I don't have DNS record saying like: www.stie.net - M -> 123.45.67.89
  • I don't have my own DNS server set up and dont want to route sites on different ports.

How can I access stored websites with only IP address and known hosted site name?

share|improve this question

migrated from stackoverflow.com Jun 14 '11 at 16:27

This question came from our site for professional and enthusiast programmers.

4 Answers 4

I would advice against changing your /etc/hosts or setting up local DNS servers.
You will run into caching issues, forget to disable it, etc. Use curl:

curl -H"Host:www.site.net" http://123.45.67.89

Or if you want to see the content rendered, use a Firefox Plugin (http://livehttpheaders.mozdev.org/).
Livehttpheaders allows you to change any header and "replay" them.
Change the Host header and it does what you want.

share|improve this answer

Edit your local hosts file.

In Linux it's on:

/etc/hosts

For windows it should be

%SystemRoot%\system32\drivers\etc\

Check that reference wikipedia page to find yours.

This will act as a local-only DNS for your development workstation, add # before the lines when you want to comment a line (when DNS will be active).

Edit: You can of course have several names for the same IP, this way:

192.168.0.1 foo.bar.com foobar.nenet.com

or this way:

192.168.0.1 foo.bar.com 
192.168.0.1 foobar.nenet.com
share|improve this answer

Check the Dnsmasq program, which could be used as an effective local DNS cache.

Dnsmasq is a lightweight, easy to configure DNS forwarder and DHCP server.

...

Dnsmasq provides the following features:

  • The DNS configuration of machines behind the firewall is simple and doesn't depend on the details of the ISP's dns servers

...

You can find a nice tutorial on how-to use dnsmasq as local DNS cache here.

share|improve this answer

As I understand you want to type IP address in browser and access web server that runs there (e.g. http://123.123.123.123/).

If so -- Yes, you can do it but, obviously, it will be one site per IP:port combination.

I cannot really tell you how this can be done on Apache (don't have much experience configuring it) but for Microsoft IIS 7.x it can be done in this way:

1) Select the site entry and bring "Site Bindings" dialogue.

2) Type, IP address & port number -- select desired settings; Host name -- leave blank

3) Save settings and try the results. If does not work then you must be done something wrong (or such binding already exists).

Microsoft IIS 6 can be configured in a similar way -- just different path/buttons to press.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.