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

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

Accessing a computer by name in hosts instead of IP?

Hi There,

I've got a confusing situation but I think it boils down to basic theory, heres the situation first:

I'm developing local websites on my Mac and running Parallels (virtualization software), in it I am running Windows XP, in Windows XP I want to access my Mac's local websites.

I can do this by editing the hosts file on the WinXP machine and telling it to look for dummy.website.test at my Mac's IP address and it works a treat. However the Mac's IP address always changes...

Can you think of some way that will make it work without me having to edit the hosts file every time I change networks?

Thanks,
Ant
0
antum
Asked:
antum
  • 3
  • 2
1 Solution
 
giltjrCommented:
Is this your home or work network?  

Is this using private or public IP addressing?
0
 
rhickmottCommented:
yes use http://127.0.0.1/

This is your loopback address and will always show the local content on that machine regardless of what IP addresses it has and you wont even need to edit the hosts file for it.
0
 
rhickmottCommented:
or in the hosts file point

dummy.website.test  at 127.0.0.1 ( you will see there is also an entry for "localhost" pointing at the same IP )

You can also use http://localhost/ works the same :)
0
 
giltjrCommented:
Nope, that won't work guys.  The websever is on one computer (the MAC) and he wants to get to it from another computer (Windows).

If he puts 127.0.0.1 on the Windows box it will try and get to the Windows box, not the MAC.
0
 
rhickmottCommented:
Oh sorry I misread the question.

There is going to be no easy way of doing this other than assigning the MAC a static IP Address if your own your network system then this is easy as you can add an entry in the DHCP table of your router or simply assign it one under the network properties and enter your routers gateway address.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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