-5

Every answer I've found about this is too generic and assumes both systems are unix-like.

I have localhost set up on my computer (Ubuntu) and I was wondering what I need to do to access it from my other computer (Windows 7)?

2 Answers2

6

You can't access localhost from another computer because localhost is, as the name implies, localhost/loopback/127.0.0.1. You need to access it via it's LAN ip address.

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

joeqwerty
  • 108,377
  • 6
  • 80
  • 171
2

The loopback interface is special in that it does not route traffic outside the device itself. The entire 127.0.0.0/8 block is reserved for this purpose, and traffic with such an address may not transit a network (even a LAN, or a virtual network). Localhost also isn't really set up by anything, except in the most pedantic sense.

If you want, you can use iptables (you are using ubuntu after all) to do NAT to access whatever service it is you are serving on localhost. The rule will look something like this:

iptables -t nat -A PREROUTING -i $LAN_INTERFACE -p tcp --dport $SERVICE_PORT -j DNAT --dnat-to 127.0.0.1:$SERVICE_PORT

I'm not sure why you would want to do that, though. Usually it is easier to have the service listen on the LAN.

Falcon Momot
  • 24,975
  • 13
  • 61
  • 92