curl-library
RE: Ignore DNS
Date: Wed, 12 Jun 2002 14:12:06 -0400
Here's a trick I use all the time:
All computers that implement TCP/IP (that I know of) offer a trick
called the hosts file. This is independent of any programming code
related to libcurl (that I know of). (Libcurl doesn't force DNS
resolution does it?)
If you want to force a name to resolve to a specific IP address you just
add it's entry to the hosts file. It uses the format:
IPADDR NAME
Entries in this file will be accepted as-is with out any DNS lookup.
On linux/unix, it's usually called /etc/hosts, in windows it can be in
either of two places:
Win95,98,ME: \windows\hosts
NT, 2000, XP: \windows\system32\drivers\etc\hosts
(where \windows is %windir%)
On windows, the file may be called hosts.sam (short for hosts.sample)
and will need to be renamed to just hosts (no extension). You can do
this in notepad by going to save as, for the name, put "hosts" (include
the quotes) and then change files of type to All *.*
If you put a # sign at the beginning of a line in the hosts file, that
line will be completely ignored so you can change your settings on the
fly. All operating systems I know of respect the change instantly (but
some programs like IE/Netscape may cache these settings)
Some applications absolutely will not honor the hosts file such as mail
servers and dns servers. Typically these applications are dependant
upon DNS servers for more than just name resolution (for example, mail
servers need MX info which can only be attained through a DNS query).
Matthew Nuzum
www.followers.net
matt_at_followers.net
> -----Original Message-----
> From: curl-library-admin_at_lists.sourceforge.net [mailto:curl-library-
> admin_at_lists.sourceforge.net] On Behalf Of Warrick FitzGerald
> Sent: Wednesday, June 12, 2002 1:08 PM
> To: libcurl Mailing list
> Subject: Ignore DNS
>
> Hi All,
>
> I very often would like to make a request to a specific IP Address,
but
> keep
> the host header etc exactly as if curl had done the lookup via DNS.
>
> For eample if I have 3 web servers behind a load ballancer, I would
like
> to
> be able to make a request directly to Machine1's private address, with
> excly
> the same header as if it had resolved to the LoadBallanced IP.
>
> Is it possible to do something like curl www.mysite.com --user-this-ip
> 10.10.10.5 ?
>
> Thanks
> Warrick FitzGerald
>
>
>
> _______________________________________________________________
>
> Sponsored by:
> ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________________________
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
Received on 2002-06-12