Forum OpenACS Q&A: Response to why cannot see the pages outside of my machine?

Collapse
Posted by S. Y. on

The whole point of DNS and NIS (formerly YP) to prevent having to use a local file (/etc/hosts) and make network administrators' lives easier. However, putting IP addresses and hostnames in local files (e.g., /etc/hosts) works great if you've set up your own internal network, etc. That's why in /etc/nsswitch.conf you can see that hostnames can be resolved in a variety of ways (files, nis, dns).

Typically DNS is used to communicate information about domains, hence its name. NIS is used within organizations once network administrators get tired to managing a master /etc/hosts file that needs to be rcp/scp'ed to other machines; maybe this is thirty or forty machines or when a second subnet gets thrown in.

The basic reason for having hostnames in the first place is to make it convenient for humans to remember, i.e., so you don't *have* to type in IP addresses.

A sample master /etc/hosts:

    192.0.2.1  router gateway gw mail smtp
    102.0.2.11 server www web
    192.0.2.21 workstation1 ws1 john
    192.0.2.22 workstation2 ws2 chris
    192.0.2.101 laptop1 lt1 jane
    192.0.2.102 laptop2 lt2 pat
    192.0.2.103 laptop3 lt3 sam
    192.0.2.200 printer laserjet lj
    

Note that in the above example, I deliberately matched computer "IDs" (e.g., workstation1) with the last digit of its IP address. If I had mismashed the entire thing, it gets harder to remember.

In isolated networks at conferences I've used state names plus a few cities (we actually had fifty clients plus a few miscellaneous admin/instructor boxes).

    192.0.2.11 alabama al
    192.0.2.12 alaska ak
    192.0.2.13 arizona az
    ...
    192.0.2.101 sanfrancisco sf
    192.0.2.102 sanjose sj
    192.0.2.103 chicago
    

We actually put this file on a master drive (along with demo content, etc.) and cloned the entire drive as prep work. Boot single user, change the appropriate networking stuff, and boot up multi-user under the correct individual hostname/IP address.

Also I've done this stuff on a limited basis with /etc/passwd and /etc/group as well.

This is basic TCP/IP networking stuff that is covered in any *nix system administration manual. None of this is Web specific; it's just basic networking. Assuming you haven't disabled these services, you should be able to ping, traceroute, and (maybe) telnet to machines in your network by IP address and hostname. If you can't, your network is misconfigured, not your web server.

Note on AOLserver: if left undeclared, nsd (just like Apache) will listen on all configured network interfaces, and on all IP addresses. The main reason is declare IP addresses, etc. is to make sure that the web server doesn't listen on a particular interface (e.g., a second Ethernet card). That's also why if you're running the nscp module, that you have it configured to only listen on localhost, forcing you to telnet/slogin to the server, and (hopefully), confirming that you're a legitimate user and not some random loser.

It's helpful to play with a small 2-3 machine network setup; by learning the concepts of basic and correct TCP/IP networking, you will find that your local network will be a much easier place to inhabit.