Without using DNS is it possible to give a host name a local alias?

Imagine we have a server called foo.org and this is a fully fledged DNS on the internet. Is it possible for me to set up a local name alias on my Windows 7 home laptop so that I can refer to it as (for example) bar? Is there any way this can be done using just what comes with Windows (ie. I don't want to install and configure a local DNS). I thought about using the hosts file but this requires an IP address in the first field and I don't want to set a fixed IP, I just want to use a local alias.

This seems like such a simple and trivial thing to want to do and yet I can't find a simple answer via Google (and I got bored trying).

Thanks.
LVL 40
evilrixSenior Software Engineer (Avast)Asked:
Who is Participating?
 
Glen KnightConnect With a Mentor Commented:
Saddly this is not possible with simple host files as CNAMES are not supported.

Your best bet is to download a free DNS service like BIND: http://www.isc.org/software/bind and use that.

My preference would be to use a virtual machine but that's your choice :)
0
 
JDominguezNYCommented:
If it's just on a single PC you can enter it into the hosts file.

hostname      0.0.0.0
0
 
JDominguezNYCommented:
Sorry I misunderstood,

Are you looking to get a hostname so that you can access your network from the internet?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
vanbarsounCommented:
You can set up the hosts file with the name you want to use and the actual IP of the server. So you're not setting a fixed IP, you're just telling your computer where to go when your type in your alias.
0
 
evilrixSenior Software Engineer (Avast)Author Commented:
>> You can set up the hosts file with the name you want to use and the actual IP of the server.

I could, but that's not what I want to do :)

Basically, I want to be able to assume the IP isn't fix but the hostname is... but I want to be able to alias it. I could bore the pants off you and explain why but let's just assume I have a good reason for wanting to be able to do this if it is at all possible (it is becoming clear it isn't).

demazter - Bingo, I want to be able to emulate CNAMES (well, just one) without the use of DNS. However, I can see that local DNS may be my only option.

I'll let this stand for a bit to give others a chance to opine otherwise I will accept "it cannot be done" and use Bind as the solution.

Thanks.
0
 
vanbarsounCommented:
You can have the server use Dynamic Dns service (if you have access to it and are willing), then that way you always refer to the server with the same DNS name, even if the actual IP of the server changes.
0
 
evilrixSenior Software Engineer (Avast)Author Commented:
vanbarsoun, thanks but (a) the server is not mine to install DDNS onto and (b) I have a very specific alias name I need to use.
0
 
crash2000Commented:
Hi Evilrix,

OK thinking aloud here. But could you set up a local IIS server on your local machine and have that point to the other server? I think this is called IIS redirections.

Hope that helps

Mark
0
 
evilrixSenior Software Engineer (Avast)Author Commented:
I don't know, could I? :)

I already have IIS set up and hosting development sites. I am not looking for a HTTP alias, it has to be a full blow CNAME alias.
0
 
crash2000Commented:
Hi Evilrix,

It depends on what you want to achieve. But maybe an HTTP alias would do what you wanted.
You could set up a local webserver called "bar".
Then setup a "bar 127.0.0.1" in your hosts file. so it points locally.
Then in IIS set bar to forward to foo.org as per this
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6b855a7a-0884-4508-ba95-079f38c77017.mspx?mfr=true

I have never tried this but I can't see why it won't work.

Mark
0
 
evilrixSenior Software Engineer (Avast)Author Commented:
>> But maybe an HTTP alias would do what you wanted

"I am not looking for a HTTP alias, it has to be a full blow CNAME alias"

I am not trying to redirect HTTP requests... this has nothing to do with HTTP. I need a full hostname alias that will work under all circumstances for all protocols. Like I've said already I want to emulate CNAME without DNS.

http://en.wikipedia.org/wiki/CNAME_record

If I ping bar I want to alias to foo.com.

>> I have never tried this but I can't see why it won't work.

See above.
0
 
crash2000Commented:
Hi Evilrix,

In which case, I beleive it cannot be done. ou have to have DNS in order to use a CName. My solution was just a possible workaround and may have helped. But as you say it is http.

Sorry I can't help further.

Mark
0
 
evilrixSenior Software Engineer (Avast)Author Commented:
Ok, thanks Mark.
0
 
evilrixSenior Software Engineer (Avast)Author Commented:
Thanks.
0
All Courses

From novice to tech pro — start learning today.