IP addresses and man
[This post follows a discussion with my operations team about different IP address formats: dotted decimal, hex, octal, etc, and how DHCP-assigned hostnames work at Virginia Tech.]
As a follow up to today’s tutorial on IP address number formats, it is fair to ask “where did you learn this?” Honest, I wasn’t born insane; it has taken years of striving effort to amass the esoterica that is my brain. But, the answer is one of the true beauties of Unix and today is such a lost concept: the manual – yes, Virginia, there is a manual! (Significantly, it is not “from the RFC” or “from the spec” … for comparison, I encourage you to read the IP RFC some time.)
One of the greatest innovations of the Unix revolution was the online manual. In 1971, Thompson (he wrote what became Unix in 1969) and Ritchie (with Brian Kernighan, he invented C and ported Ken’s system to it in 1970 or so) were coerced by their manager Doug McIlroy into writing the system documentation, notably “Unix Programmer’s Manual” for Unix version 1. The way typesetting was done for this manual was a markup language (in the same vein that HTML is a markup language): roff (for “run off”, as the pages were run off the typeset printing press). There were two formatting engines for roff: troff for high quality camera ready printing devices and nroff for character mode terminals and similar devices (terminals at the time were not CRTs, but were often paper printer, more like a typewriter with a big continuous spool of paper feeding into it.) So, since the manual had to be written, and since it was written in a manner that equally allowed it to be typeset on high quality paper or lo-fi paper terminals, the on-line manual was born. Later, the “man” command would automatically go find the entry from the manual you desired, format it through nroff, and display the formatted entry to your terminal.
One of the first computer systems I used (or at least one of the first I used to accomplish real work) was a Prime 9650 mini-computer. Like any system at the time, the system documentation was essential; it was also voluminous. There was some online help, but If you wanted to know how something worked you were walking across campus to one of the rooms where the manuals were kept (literally bolted to a large chest-high table.) What Ken and Dennis had done though, was take this many volume set for Unix (Prime didn’t run Unix) and put it *all* at the fingertips of any Unix user. Arguably, this more than any other of the numerous (sometimes brilliantly elegant, sometimes half-assed kludge) innovations has had more to do with the ultimate success of Unix-type systems. [The relatively poor quality of much of the Linux man pages for years was part of what led many of us old-timers to dismiss it as a serious Unix-type OS – this has thankfully largely changed. Some time you can get me to rant about “info” vs “man”.]
Now, when I say all of the documentation, I mean *all* — from the lowly “who” command to the deep arcana of the C library kernel system calls … even to the intro page itself. There it was; you just typed “man intro” and you had a few screens on what Unix was; “man who” and you learned that “who –m” was the same thing as “who am I”; “man signal” showed you how to use the signal kernel function in your C program as well as inventorying the signals you can send processes and which create core dumps. It was truly magical. And, after 4.2BSD in 1983 (this all pre-dates me, btw), you could even type “man inet” and learn about this new internet thingy (note the lower case “i”).
So what does it look like? http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=inet (btw, section=3 indicates this is the “programmers guide” volume of the manual).
Note the section on INTERNET ADDRESS, and we have today’s lesson.
Pretty freaking cool, eh?
Enjoy
By the way, if you do some googling, you can find some interesting articles about how obscure IP address formats are used in phishing and similar escapades.
INTERNET ADDRESSES
Values specified using the `.' notation take one of the following forms:
a.b.c.d
a.b.c
a.b
a
When four parts are specified, each is interpreted as a byte of data and
assigned, from left to right, to the four bytes of an Internet address.
Note that when an Internet address is viewed as a 32-bit integer quantity
on the VAX the bytes referred to above appear as ``d.c.b.a''. That is,
VAX bytes are ordered from right to left.
When a three part address is specified, the last part is interpreted as a
16-bit quantity and placed in the right-most two bytes of the network
address. This makes the three part address format convenient for speci-
fying Class B network addresses as ``128.net.host''.
When a two part address is supplied, the last part is interpreted as a
24-bit quantity and placed in the right most three bytes of the network
address. This makes the two part address format convenient for specify-
ing Class A network addresses as ``net.host''.
When only one part is given, the value is stored directly in the network
address without any byte rearrangement.
All numbers supplied as ``parts'' in a `.' notation may be decimal,
octal, or hexadecimal, as specified in the C language (i.e., a leading 0x
or 0X implies hexadecimal; otherwise, a leading 0 implies octal; other-
wise, the number is interpreted as decimal).
The inet_aton() and inet_ntoa() functions are semi-deprecated in favor of
the addr2ascii(3) family. However, since those functions are not yet
widely implemented, portable programs cannot rely on their presence and
will continue to use the inet(3) functions for some time.
Filed under: VTTI Technical Discussions | 1 Comment
Search
-
Blogroll