Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 937
  • Last Modified:

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.
0
evilrix
Asked:
evilrix
  • 6
  • 3
  • 2
  • +2
1 Solution
 
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
 
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
WatchGuard Case Study: NCR

With business operations for thousands of customers largely depending on the internal systems they support, NCR can’t afford to waste time or money on security products that are anything less than exceptional. That’s why they chose WatchGuard.

 
Glen KnightCommented:
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
 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 6
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now