Solved

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

Posted on 2010-09-16
14
920 Views
Last Modified: 2012-05-10
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
Comment
Question by:evilrix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +2
14 Comments
 
LVL 4

Expert Comment

by:JDominguezNY
ID: 33695752
If it's just on a single PC you can enter it into the hosts file.

hostname      0.0.0.0
0
 
LVL 4

Expert Comment

by:JDominguezNY
ID: 33695782
Sorry I misunderstood,

Are you looking to get a hostname so that you can access your network from the internet?
0
 
LVL 9

Expert Comment

by:vanbarsoun
ID: 33695888
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 74

Accepted Solution

by:
Glen Knight earned 500 total points
ID: 33695904
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
 
LVL 40

Author Comment

by:evilrix
ID: 33696178
>> 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
 
LVL 9

Expert Comment

by:vanbarsoun
ID: 33696216
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
 
LVL 40

Author Comment

by:evilrix
ID: 33696297
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
 
LVL 6

Expert Comment

by:crash2000
ID: 33699488
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
 
LVL 40

Author Comment

by:evilrix
ID: 33700835
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
 
LVL 6

Expert Comment

by:crash2000
ID: 33700936
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
 
LVL 40

Author Comment

by:evilrix
ID: 33700979
>> 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
 
LVL 6

Expert Comment

by:crash2000
ID: 33701400
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
 
LVL 40

Author Comment

by:evilrix
ID: 33702676
Ok, thanks Mark.
0
 
LVL 40

Author Closing Comment

by:evilrix
ID: 33719329
Thanks.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question