1

I need to use the a custom URL name which is accessible from all devices in a LAN.

I know that it can be set in the /etc/hosts file

127.0.0.1   myname
127.0.1.1   system09-System-Product-Name

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

While entering the myname hosts it is available to access myname/urlpath . It is accessible only for my system. How can I make this available systems in my LAN too?

2 Answers 2

3

Localhost as its name says can only be accessed from your local system.

If you need other users to access yout custom URL you need to map your system IP address with the name used and then add this entry on all your LAN workstations by editing theirs /etc/hosts files for example:

127.0.0.1         <custom_name> # this is for localhost
<your_ip_address> <custom_name> # this is to be added to other workstations in the LAN

Other solution is to use a DNS server in your local LAN and create an A record for your custom name that will allow other users in you LAN to access your link.

2
  • 192.168.1.16 sul - I updated in the host file but it is accessible to access sul/folder from my name system but not from another system which is in lan. Should i restart the system ?
    – Explorer
    May 14, 2014 at 7:43
  • If you access this custom url from a remote lan machine you should type in your browser http:/sul/folder and if you added 192.168.1.16 sul in your remote machine /etc/hosts file it should work. I have tested your scenario now using a local Linux machine and a remote machine and can access the name sul from the remote machine web browser. There's no need to restart the system
    – cioby23
    May 14, 2014 at 7:59
1

The name localhost is only meant to be accessible locally.
On another note, you shouldn't remove localhost from /etc/hosts either. You will see lots of issues if you try and do so.

From this point you have 3 options.

  1. Create an entry in the /etc/hosts file of all the neighboring PCs
  2. Set up a DNS server on your network and add the entries to it. Most home routers have a built in DNS server/proxy, and many of those allow adding custom entries.
  3. Use mDNS. mDNS is part of zeroconf networking. It allows a machine to automatically resolve other hosts on the local network without having to manually configure a DNS server with those hosts. It does this by sending out a broadcast request, and waiting for a response.
    The exact procedure for setting it up varies by OS, but Arch Linux has a good guide.
     
    Once you have it running, all you have to do is refer to the neighboring hosts as foo.local (for a host called foo).
     
    This solution is cross plaform, as it is supported on both OS-X & Windows (and I think enabled by default on both as well).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .