Monday, August 6, 2012

Your local network telephone book.

We need a way to know what device (i.e. computer) is what and or who. That is why we need an internet telephone book. The internet is in some ways still is like a telephone network. You can key in the phone number of someone to call or you can use the phone book to look up their phone number. The internet is sort of the same, but now the directory assistance is built in so to speak. The internet uses an internet protocol address instead of a phone number, to identify which computer is which,

The Google internet protocol address is: 173.194.64.106 in this case.

Computer directory assistance:

$ nslookup www.google.com
Server:        x.x.x.1
Address:    x.x.x.1#xx

Non-authoritative answer:
www.google.com    canonical name = www.l.google.com.
Name:    www.l.google.com
Address: 173.194.64.147
Name:    www.l.google.com
Address: 173.194.64.105
Name:    www.l.google.com
Address: 173.194.64.103
Name:    www.l.google.com
Address: 173.194.64.104
Name:    www.l.google.com
Address: 173.194.64.99
Name:    www.l.google.com
Address: 173.194.64.106


$ dig www.google.com

; <<>> DiG 9.7.0-P1 <<>> www.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24576
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.            IN    A

;; ANSWER SECTION:
www.google.com.        538147    IN    CNAME    www.l.google.com.
www.l.google.com.    248    IN    A    173.194.64.106
www.l.google.com.    248    IN    A    173.194.64.103
www.l.google.com.    248    IN    A    173.194.64.147
www.l.google.com.    248    IN    A    173.194.64.104
www.l.google.com.    248    IN    A    173.194.64.99
www.l.google.com.    248    IN    A    173.194.64.105

;; Query time: 12 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Thu Nov 24 19:28:07 2011
;; MSG SIZE  rcvd: 148

If I typed in  the Google's internet address, I would be able to get to their site. To remember all the internet addresses you might want go to is an extraordinary task. So the internet has directory assistance built in. I just used Google's web site name to get to their site. That is, it goes to a DNS (Domain name server is an internet equivalent of directory assistance) to translate the website name to an internet address and then your browser goes to that numerical address. It usually happens so fast that you may not realize what is going on. Since we will not access the real internet, so for our intranet we will be setting up a crude form of directory assistance of your own. That is unless you want to remember all the numbers.

One last detail:
Like the phone book, the names are listed in a certain way. Usually the last name and the first name. for the internet, this is an over simplification, but the websites can have two or more parts.
www.google.com breaks up into:

www -  world wide web
google - the name of the domian
com- the type of domain it is. .com is a commercial site usually.

Other extensions:
org - non-profit
gov - governmental unit, and etc.

More info at http://en.wikipedia.org/wiki/Domain_Name_System

Your computer also has it's own telephone book. It us generally known as the hosts file (lmhosts on some systems). They basically have the ipaddress and the host name. So if you wanted to add to your telephone directory, you would have to go to every computer and add the information manually.  Generally you have one ipaddress for each host. Typical examples of hosts files you might run into:

For Windows XP or for Windows Server 2003
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
 
For Windows Vista or for Windows Server 2008
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost
::1             localhost
 
For Windows 7
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handle within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost
 


ForMac:

127.0.0.1 mydevsite.local
192.168.1.222 ads.shadycompany.biz
 
For Linux:
 
127.0.0.1 localhost
127.0.1.1 oedt01
192.168.1.31 oesrvr1  www.thesoftserv.com www.thefoodhistory.com 
 www.myposgarage.com www.ohmygalleries.com www.misslizziesworld.com www.oesrvr1.com 
 www.yourdrsmedicalrecords.com www.meetthekentgeeks.com www.theeddiesplace.com 
 www.theeddiestable.com
192.168.1.120   oesrvr3
192.168.1.106 typo1
192.168.1.99 printer
192.168.1.115 oedt01
192.168.1.110 robopet
192.168.1.127  oemsrvr01
192.168.1.128 texttop

# 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
 

For the most part all of the hosts files are alike. In the Linux file we see quite a few hostnames associated with one ipaddress. Why? oesrvr1 is a web server and has several hostnames to support. This is typical of a web server having virtual hosts. The web server will direct you to the correct web page based on the url, you have typed in. Oh yes, I said there was an easier way to keep up with the computer's phone numbers. Generally you do not want the to have your local phone numbers in the big internet phone book. Most commercial home routers have the ability to keep your local internet addresses saved. That way you do not have to list the ipaddresses aka internet telephone numbers on every computing device. You also do not have to memorize the ipaddresses either. Just go to the services tab (if you are running DD-wrt) or the equivalent and you can enter in the information for your equipment.




You need to know one more piece of information to do this. You need what is known as the Mac (media access control) address. Nothing to do with Apple computing, though their computers also have these addresses.  Every network card or device get assigned a unique number so that you can tell what type of network card you are using is.  Just go to your network icon and get the properties. You can also get the same information from the command line by either using ipconfig or ifconfig depending on the system you are using. Sometimes the mac address is known as the hardware address (HWaddr). The format is usually six sets of two numbers with a colon to separate each set of two hexadecimal numbers . I have used a fake one here.

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:192.168.1.115  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:375639 errors:0 dropped:0 overruns:0 frame:0
          TX packets:244524 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:503291368 (503.2 MB)  TX bytes:26630166 (26.6 MB)
          Interrupt:18 Base address:0xb000

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:5216 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5216 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:591225 (591.2 KB)  TX bytes:591225 (591.2 KB)
Your router will generally have an input screen asking for the mac address, the hostname you want to use, and then the ipaddress you want to use.  On a home router, you will need to know the network you are on. Generally it is the first three numbers of the ipaddress. Actually it is more complicated than that, but you can research it.  For the address of this unit 192.168.1.115,  192.168.1 is the network. Your router will have this information.  In this what is known as a class C network, you can use addresses 2-254 for your devices for the fourth number. If you have more than 250 devices, you probably need more sophisticated networking equipment.

I would go to the router and use (enter)
Mac address: 00:ff:e1:35:b4:c3  
Host: oedt01
ipaddress:  192.168.1.115 

Save that information in the router. That means next time anyone can use oedt01 to address that machine instead of having to remember 192.168.1.115.

What if I wanted to know someone elses mac address such as texttop? On a linux machine:

$ ping texttop
PING texttop.homelinux.com (192.168.1.128) 56(84) bytes of data.
64 bytes from texttop (192.168.1.128): icmp_req=1 ttl=64 time=0.594 ms
64 bytes from texttop (192.168.1.128): icmp_req=2 ttl=64 time=0.284 ms
64 bytes from texttop (192.168.1.128): icmp_req=3 ttl=64 time=0.273 ms
64 bytes from texttop (192.168.1.128): icmp_req=4 ttl=64 time=0.247 ms
^C
--- texttop ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 0.247/0.349/0.594/0.143 ms

eddie@oedt01:~$ arp -a
texttop (192.168.1.128) at 00:32:d5:3c:b1:22 [ether] on eth0
textserv (192.168.1.1) at 00:42:28:5b:22:ac [ether] on eth0


You could then take the mac address (00:32:d5:3c:b1:22) and go to http://www.coffer.com/mac_find/ and find out what kind of network card they are using. For instance Dell computers have used 3Com cards a lot. Where I used to work, people would like to come in and use our network for their own purposes. On a network, a computer known as the DHCP server keeps all the information about what is connected. Since we only used one kind of network card, it was easy to see who was definitely not supposed to be connected to the network. They were investigated quickly. You will want to keep a list of all the connection information of your computers and devices for security reasons.


One last hint, you may want to segregate the ipaddresses for your equipment. For example:

192.168.1.1 - 192.168.1.30 would be for routers.
192.168.1.31 - 192.168.1.75 could be for servers.
192.168.1.90 - 192.168.1.99 could be for printers,
192.168.1.100 - 192.168.1.254 would be everything else. 

Easier to tell which equipment has failed by ipaddress. You know where to access the equipment in a hurry.

Update:

You can also block sites from being accessed with the hosts file.  127.0.0.1 is the address for your local computer. So when an address of say www.facebook.com is associated with the local host and then accessed, it will bring you back to your local machine. Good way to keep people off unwanted sites. In fact, you can down load a list of sites that are generally not good for your system at: (you will have to modify it for your needs).

http://winhelp2002.mvps.org/hosts.txt

No comments:

Post a Comment