This is an extract from Chapter 2 of ripe-153,
which is available from:

<http://www.ripe.net/docs/ripe-153.html>
<ftp://ftp.ripe.net/ripe/docs/ripe-153.ps>
<ftp://ftp.ripe.net/ripe/docs/ripe-153.txt>


For information on creating, updating and deleting
objects in the TEST Database, send e-mail to 
<test-dbm@ripe.net> with HELP in the Subject line.


Database queries and updates:


2.1 Querying the RIPE Database

There are five ways of querying the RIPE database:
whois client, WWW, WAIS, telnet and e-mail.

The choice of which one to use depends on what
resources are available at your site and which one
your find the most appropriate.

Each way of querying the database will now be
explained.



2.1.1  RIPE whois client:

Searching for the names of database objects;


If you wish to look up objects in the RIPE database,
you must use special search keys.  A full list of
the search keys is given below:


OBJECT          KEYS
------------------------------------------------------------------
aut-num         AS number (e.g. AS3333)
as-macro        as-macro name (e.g. AS-EBONE)
community       community name (e.g. HEPNET)
domain          domain name (e.g. over.ripe.net)
inetnum         range of IP addresses e.g 193.0.0.0 - 193.0.0.255;
		network name e.g.RIPE-NCC
inet6num        range of IP version 6 addresses or network name
person          a person's name or NIC-handle
		or e-mail address in RFC822 format.
		e.g. Ambrose Magee or AMRM1-RIPE
		or ambrose@ripe.net
clns object/
domain-prefix   domain-prefix, domain-name
inet-rtr        internet router name (e.g.
limerick        name of limerick
mntner          name of mntner object e.g. AMRM1-RIPE-MNT
route           internet route e.g. 193.0.0.0/24
role            the name, the NIC-handle or the e-mail address 
	        (in RFC822 format) of a role object; e.g. RIPE NCC


If you also want to search for other strings in the
objects, you can use the WAIS interface; however it
doesn't support the special options that are provided 
in the RIPE 'whois' interface.

The RIPE whois client has several options, which may
be used either alone or in combination.

The following is a list, in alphabetical order, of
the available options, which are explained in more
detail below.


Option  Function
------  _______________________________________________
-a      search all databases
-c	include 'changed' attributes in the output from queries
-F	fast raw output (implies -Fr)
-h	search alternate server
-i	inverse look-up
-k	used with the telnet interface
-L	find all Less specific matches
-m	find first level More specific matches
-M	find all More specific matches
-p	connect to other port than the default whois port
-r	turn off recursive lookups
-s	search databases with source "source"
-S	tell server to leave out "syntactic sugar"
-t	requests template for object of type "type"
-v	requests verbose template for object of type "type"
-T	only look for objects of type "type"
-HELP	gives a copy of the current `WHOIS-HELP' document.



A very useful option is "-h", which allows you to
connect directly to the server at the RIPE NCC or to
a "mirror" of the RIPE database elsewhere.

- Example:

$ whois -h whois.ripe.net AMRM1-RIPE



-a option:

Example:

[an-lar] $ whois -h whois.ripe.net -a AMRM1-RIPE

The following databases may be queried in this way:

RIPE, RADB, INTERNIC, ANS, MCI, CANET, APNIC


-c option:

By default queries will not include the 'changed' attributes in any object.

Example:

> whois 193/22

% Rights restricted by copyright. See http://www.ripe.net/db/dbcopyright.html

inetnum:     193.0.0.0 - 193.0.255.255
netname:     EU-ZZ-193-0
descr:       European Regional Registry
descr:       Europe
country:     EU
admin-c:     MK16-RIPE
tech-c:      OPS4-RIPE
status:      ALLOCATED UNSPECIFIED
mnt-by:      RIPE-NCC-HM-MNT
mnt-lower:   RIPE-NCC-HM-MNT
changed:     hostmaster@ripe.net 970506
changed:     roman@ripe.net 980424
source:      RIPE

-F option:

This option generates an output quickly, but with
the abbreviated form of the attributes.  Example:

[an-lar]$ whois -h whois.ripe.net AMRM1-RIPE gives

person:      Ambrose Magee
address:     RIPE Network Co-ordination Centre (NCC)
address:     Kruislaan 409
address:     NL-1098 SJ   Amsterdam
address:     The Netherlands
phone:       +31 20 592 5065
fax-no:      +31 20 592 5090
e-mail:      ambrose@ripe.net
nic-hdl:     AMRM1-RIPE
notify:      ambrose@ripe.net
mnt-by:      AMRM-RIPE-MNT
changed:     ambrose@ripe.net 970115
source:      RIPE



However,

[an-lar]$ whois -F -h whois.ripe.net AMRM1-RIPE
gives

*pn: Ambrose Magee
*ad: RIPE Network Co-ordination Centre (NCC)
*ad: Kruislaan 409
*ad: NL-1098 SJ   Amsterdam
*ad: The Netherlands
*ph: +31 20 592 5065
*fx: +31 20 592 5090
*em: ambrose@ripe.net
*nh: AMRM1-RIPE
*ny: ambrose@ripe.net
*mb: AMRM-RIPE-MNT
*ch: ambrose@ripe.net 970115
*so: RIPE



-i option:

This option allows you to do reverse or inverse
look-ups of particular combinations of attributes
and objects.



The attributes which can be used are:

admin-c, tech-c, zone-c;
notify;
origin;
mnt-by;
author.

The syntax of the usage is:

whois -i <attribute (or list of attributes)> <object>

Examples of how the "-i" option is used are now
given:


[an-lar]$ whois -h whois.ripe.net -i admin-c,tech-
c,zone-c AMRM1-RIPE

finds all objects which cite AMRM1-RIPE as an admin-
c or a tech-c or a zone-c.


inetnum:     193.0.128.0 - 193.0.128.255
netname:     BORK-NET
descr:       Test Allocation
descr:       RIPE Network Coordination Centre
descr:       Amsterdam, Netherlands
country:     NL
admin-c:     AMRM1-RIPE
status:      ASSIGNED PA
notify:      orange@ripe.net
changed:     orange@ripe.net 960821
source:      RIPE




person:      Ambrose Magee
[.......stuff deleted.......]

Any one or more of the three attributes admin-c,
tech-c and zone-c may be used.  Note that if
"Ambrose Magee" was used, no objects would be found
as "Ambrose Magee" is not used anywhere in an admin-
c, tech-c or a zone-c attribute.




*    whois -i notify <RFC822 e-mail address>

You can also find all objects which have a particu-
lar e-mail address in their "notify" attribute;

Example:

[an-lar]$ whois -h whois.ripe.net -i notify
ambrose@ripe.net

finds all objects which have ambrose@ripe.net in
their notify attribute.

mntner:      AMRM1-RIPE-MNT
descr:       Ambrose's mntner.
admin-c:     AMRM1-RIPE
tech-c:      AMRM1-RIPE
upd-to:      ambrose@ripe.net
mnt-nfy:     ambrose@ripe.net
mnt-nfy:     ripe-dbm@ripe.net
auth:        MAIL-FROM Ambrose.Magee@ripe.net
auth:        MAIL-FROM ripe-dbm@ripe.net
remarks:     This is a test mntner.
notify:      ambrose@ripe.net
mnt-by:      AMRM1-RIPE-MNT
changed:     ambrose@ripe.net 960815
changed:     ambrose@ripe.net 960930
source:      RIPE



person:      Ambrose Magee
[.......stuff deleted.......]



*    whois -i origin <AS number>

Example:

[an-lar]$ whois -h whois.ripe.net -i origin AS3333

finds all route objects which specify AS3333 as
their origin.


route:       193.0.0.0/24
descr:       RIPE-NCC
origin:      AS3333
notify:      ops@ripe.net
mnt-by:      RIPE-NCC-MNT
changed:     GeertJan.deGroot@ripe.net 960812
source:      RIPE


route:       193.0.0.0/23
descr:       RIPE-NCC
origin:      AS3333
notify:      ops@ripe.net
mnt-by:      RIPE-NCC-MNT
changed:     GeertJan.deGroot@ripe.net 960812
source:      RIPE



*    whois -i mnt-by <name of mntner-object>

Example
[an-lar] $ whois -h whois.ripe.net -i mnt-by
AMRM1-RIPE-MNT

finds all objects which are maintained by
AMRM1-RIPE-MNT.  (See Section 2.3 for details on
mntner objects).


*    whois -i author <nic-hdl|person's name>

Example:

[an-lar]$whois -h whois.ripe.net -i author
AMRM1-RIPE
finds all limericks written by by AMRM1-RIPE;




The "-r" option:

All the above options do recursive look-ups i.e.
they will look-up any person objects associated with
admin-c, tech-c, zone-c or author attributes.

To disable this recursive look-up, use the "-r"
option.  This may be used with the other options,
including "-i".


Example:
[an-lar]$ whois -h whois.ripe.net -r -i admin-
c,tech-c,zone-c AMRM1-RIPE

Note that the "-r" flag must precede the "-i" flag
and the arguments.


-k option:

This is used in the telnet interface.  See Section
2.1.4(b)


-L option:


Sometimes when doing a look-up on an inetnum object,
you may wish to find the "next objects up" in the
hierarchy i.e. all less specific matches; e.g.

[an-lar]$ whois -h whois.ripe.net -r 193.1.0.0/16

inetnum:     193.1.0.0 - 193.1.255.255
netname:     IE-HEANET-193-1
descr:       DELEGATED BLOCK
descr:       Provider Local Registry
descr:       HEAnet
country:     IE
admin-c:     MN131
tech-c:      MN131
mnt-by:      RIPE-NCC-HM-MNT
changed:     roderik@ripe.net 950315
source:      RIPE



Now compare the above with the output of the follow-
ing:

[an-lar]$ whois -h whois.ripe.net -r -L 193.1.0.0/16

gives

inetnum:     193.1.0.0 - 193.1.255.255
netname:     IE-HEANET-193-1
descr:       DELEGATED BLOCK
descr:       Provider Local Registry
descr:       HEAnet
country:     IE
admin-c:     MN131
tech-c:      MN131
mnt-by:      RIPE-NCC-HM-MNT
changed:     roderik@ripe.net 950315
source:      RIPE
inetnum:     193.0.0.0 - 193.255.255.255
netname:     EU-ZZ-193
descr:       European Regional Registry
descr:       Europe
country:     EU
admin-c:     DK58
tech-c:      DK13-RIPE
status:      ALLOCATED UNSPECIFIED
mnt-by:      RIPE-NCC-HM-MNT
changed:     hostmaster@ripe.net 960123
source:      RIPE



In other words, the inetnum object which "includes"
IE-HEANET-193-1, is also found.  The same process is
implemented for route objects, but not for domain
objects.

There is no "-l" option.  The default behaviour of
the database is to find exactly the object you want
or first less specific match (for inetnum and route
objects).


-m option:


This option allows you to look-up all those objects
which are one level more specific than what you have
given in your query.  In the case of inetnum
objects, this means that you can lookup all those
inetnum objects which are the "children" of the
inetnum object found by an exact match i.e. the
first level more specific match.

Example:

[an-lar]$ whois -h whois.ripe.net -r 193.1.0.0/16


inetnum:     193.1.0.0 - 193.1.255.255
netname:     IE-HEANET-193-1
[.......stuff deleted.......]


But,

[an-lar]$ whois -h whois.ripe.net -r -m 193.1.0.0/16

finds 86 objects; i.e. there are 86 objects which
are directly within the range of IP addresses given
by 193.1.0.0 - 193.1.255.255.


-M option:

Some of the objects found by a "-m" look-up have
"children" themselves; i.e. there are objects
directly within the range of IP addresses specified
by the objects found by a "-m" look-up.

These objects may be found by a "-M" look-up.

Example:

[an-lar]$ whois -h whois.ripe.net -r -M 193.1.0.0/16

finds 97 objects.


-p option:

Normally, when you do a "whois" query, you connect
to port 43 of the server which you specified with
the "-h" option.  However, there are occasions when
you wish to connect to a port different from the
default port.  E.g., if you had a private database,
with a whois daemon of its own, you could connect to
it.

[an-lar]$ whois -h localhost -p 4327

connects to port 4327 on the localhost.

-s option:

The RIPE database contains objects that are from
other databases.  This is indicated by the "source"
attribute in each object.  The sources used in the
RIPE database are RIPE, RADB, INTERNIC, ANS, MCI,
CANET and APNIC.  Not every object type may be found
using a source other than RIPE.  Normally, only
inetnum and aut-num objects may be found using non-
RIPE sources.

Example:

[an-lar]$ whois -h whois.ripe.net -s INTERNIC AS3333

gives

aut-num:     AS3333
descr:       part of AS block AS3154 - AS3353
admin-c:     3353
remarks:     this AS number is assigned by the InterNIC
remarks:     please query whois.internic.net for more information
changed:     ripe-dbm@ripe.net 970103
source:      INTERNIC



-S option:

This option tells the server to leave out text which
is only added to make aut-num objects readable by
humans.  This text is called "Syntactic Sugar".


Example:

[an-lar]$ whois -h whois.ripe.net -r AS3333

gives

aut-num:     AS3333
descr:       RIPE NCC
descr:       European Regional Internet Registry
as-in:       from AS286  120 accept ANY
[........stuff deleted ........]
as-out:      to AS286 announce AS3333
[........stuff deleted ........]


Compare with the output of

[an-lar]$ whois -h whois.ripe.net -r -S AS3333

aut-num:     AS3333
descr:       RIPE NCC
descr:       European Regional Internet Registry
as-in:       AS286  120 ANY
[........stuff deleted ........]
as-out:      AS286 AS3333
[........stuff deleted ........]



The "-t" option:

This option allows you to obtain a template of any
type of object that is accepted by the RIPE
database.  You may specify either the full or the
abbreviated name of the object as follows:




		Full name    Abbreviation
		--------------------------
		aut-num                an
		
		as-macro               am
		
		community              cm
		
		domain                 dn
		
		inetnum                in
		
		inet6num               i6
		
		persons                pn
		
		dom-prefix             dp
		
		inet-rtr               ir
		
		limerick               li
		
		mntner                 mt

		route                  rt
		
		role                   ro
		--------------------------

		
A full list of objects may be obtained by typing
"all" after the "-t" option.

The -t option generates a template that lists each of the attributes 
together with a list of its flags.  Flags are enclosed in square 
brackets and separated within the list by white space. 

The flags are ...

[mandatory] - 	An object MUST NOT contain zero instances of this 
	        attribute.
[optional]  - 	An object MAY contain zero instances of this attribute.
[single]    -   An object MUST NOT contain more than one instance of 
	        this attribute.
[multiple]  -   An object MAY contain more than one instance of this 
	        attribute.
[look-up key] - Attribute  is indexed.
[inverse key] - Attribute is in the 'reverse' index. (use -i)
[primary key] - Attribute is (part of) the primary key.

[primary/look-up key] - Attibute is both indexed and is (part
			of) the primary key.

The "-t" option does not display a list of obsolete
attributes, as before.  The "-v" option must be used.


Example:

[an-lar]$ whois -h whois.ripe.net -t person

person:      [mandatory]  [single]	[primary/look-up key]
address:     [mandatory]  [multiple]	[ ]
phone:       [mandatory]  [multiple]	[ ]
fax-no:      [optional]   [multiple]	[ ]
e-mail:      [optional]   [multiple]	[look-up key]
nic-hdl:     [optional]   [single]	[primary/look-up key]
remarks:     [optional]   [multiple]	[ ]
notify:      [optional]   [multiple]	[inverse key]
mnt-by:      [optional]   [multiple]	[inverse key]
changed:     [mandatory]  [multiple]	[ ]
source:      [mandatory]  [single]	[ ]





[an-lar]$ whois -h whois.ripe.net -t pn

gives the same output.


The "-v" option:

This option displays a detailed ("verbose") template
of any type of object that is accepted by the RIPE
database.  Each attribute of the object is briefly
described.

A full list of objects is available by typing
"all" after the "-v" option.


Example:

[an-lar] whois -h whois.ripe.net -v person


The person object:

The person object contains information on how to
contact those people who are responsible for
network operations or RIPE Database objects.

person:      [mandatory]  [single]     [primary/look-up key]    
address:     [mandatory]  [multiple]   [ ]                      
[...........Remainder of basic template deleted............]


The content of the attributes of the person object are defined below:

person
	The full name of an adminstrative, technical or zone
	contact person specified in another object.
	[..........Remainder deleted......................]


Note: obsoleted attributes are only displayed using the "-v"
option.




The "-T" option:

If you know the type of the object for which you are
looking, you can restrict the search to that type
only.  This option is useful when different types of
object have the same KEYS.


Example:

[an-lar]$ whois -h whois.ripe.net -r 193.0.0.0/24

gives

inetnum:     193.0.0.0 - 193.0.0.255
netname:     RIPE-MEETING
descr:       RIPE Meeting Terminal Room
descr:       Amsterdam, Netherlands
country:     NL
admin-c:     GJG1-RIPE
tech-c:      GJG1-RIPE
changed:     GeertJan.deGroot@ripe.net 970110
source:      RIPE


route:       193.0.0.0/24
descr:       RIPE-NCC
origin:      AS3333
notify:      ops@ripe.net
mnt-by:      RIPE-NCC-MNT
changed:     GeertJan.deGroot@ripe.net 960812
source:      RIPE



cf. the output of

[an-lar] $ whois -h whois.ripe.net -r -T inetnum
193.0.0.0/24

inetnum:     193.0.0.0 - 193.0.0.255
netname:     RIPE-MEETING
descr:       RIPE Meeting Terminal Room
descr:       Amsterdam, Netherlands
country:     NL
admin-c:     GJG1-RIPE
tech-c:      GJG1-RIPE
changed:     GeertJan.deGroot@ripe.net 970110
source:      RIPE



In this situation, only the inetnum object is found.
Note that when using the "-T" option, the abbrevi-
ated form of the object names may be used; e,g, "in"
can be used instead of "inetnum".

-HELP option:

The output of this option is an up-to-date copy of
the appropriate section of ripe-153.

Example:

[an-lar]$ whois -h whois.ripe.net HELP

gives

		This is an extract from Chapter 2 of ripe-153,
		which is available from:
		
		<http://www.ripe.net/docs/ripe-153.html>
		<ftp://ftp.ripe.net/ripe/docs/ripe-153{.ps|.txt}>
		
		
		
		Database queries and updates:
		
		
		2.1 Querying the RIPE Database
		[...stuff deleted...]


To summarise, the syntax of the usage of the "whois"
command is as follows:

Usage: whois [-aFrSv] [-h host] [-s source] [-T
type] [-t type] [-L|-m|-M] <search string>


Using non-RIPE `whois' clients:

Please note that most of the options are NOT under-
stood by non RIPE 'whois' client programs.  Some-
times the following work-around will work :

Instead of

[an-lar] $ whois -h whois.ripe.net -T person AMRM1-RIPE

you can use

[an-lar] $ whois -h whois.ripe.net "-T person AMRM1-RIPE"



2.1.2     WWW:


http://www.ripe.net/db/

This is a web-based interface to the whois server;
therefore you can only do a search on the KEYS
listed in Section 2.1.1


2.1.3     WAIS:

You should create a directory with a name like
"wais-sources".  In this directory, you can put all
source files for WAIS applications.

You should then create a file with a name like
"ripe-database.src".  The contents of the file
should be this:


(:source
:version  3
:ip-name "wais.ripe.net"
:tcp-port 210
:database-name "ripe-database"
:cost 0
:cost-unit :free
:maintainer "ripe-dbm@ripe.net"
:description "This WAIS database contains
the RIPE Network Management
Database which is also available at:
ftp://ftp.ripe.net/ripe/dbase")



Now at your command line prompt, type "swais".  You
will now see a menu ("Source Selection") and a list
of all the sources in your wais-sources directory.
Follow the instructions.  Note that you can search
for any keyword, including addresses and telephone
numbers.

The "q" character allows to close the process: "?"
gives you a list of all the keywords.



2.1.4     telnet

There are currently two ways to telnet to the RIPE
Database.

(a) The first is to simply telnet "whois.ripe.net"
and enter one of the options listed in Section
2.1.1(b), followed by one of the KEYS listed in Sec-
tion 2.1.1(a).  You are not required to type
"whois".

Example:

[an-lar]$ telnet whois.ripe.net

gives

Trying 193.0.0.198...
Connected to bsdbase.ripe.net.
Escape character is '^]'.
********************************************************
* RIPE NCC
*
* Telnet-Whois Interface to the RIPE Database
*
* Most frequently used keys are: IP address or pre-
fix (classless),
* network name, persons last, first or complete
name, NIC handle,
* and AS<number>.
*
* Use 'help' as key to get general help on the RIPE
database.
* Contact <ncc@ripe.net> for further help or to
report problems.
********************************************************

Enter search key [q to quit]: Ambrose Magee

person:      Ambrose Magee
address:     RIPE Network Co-ordination Centre (NCC)
[....stuff deleted....]

Enter search key [q to quit]: -T route 193.0.0.0/23

route:       193.0.0.0/23
[....stuff deleted....]

Enter search key [q to quit]: q
Connection closed by foreign host.
[an-lar]$


(b) The second is to telnet to "whois.ripe.net 43".
This is a very basic interface to the whois server.
You do not type "whois" in your query; you only type
the whois option (e.g. "-r") and then the KEY.

Example:

[an-lar] $ telnet whois.ripe.net 43

gives

Trying 193.0.0.198...
Connected to bsdbase.ripe.net.
Escape character is '^]'.
-T rt 193.0.0.0/23

route:       193.0.0.0/23
[....stuff deleted....]

Connection closed by foreign host.
[an-lar] $


The connection is closed immediately after one
query.  If you wish to do more than one look-up dur-
ing the same telnet session, you should use the "-k"
option as shown:

Example:

Trying 193.0.0.194...
Connected to dbase.ripe.net.
Escape character is '^]'.
-k -T rt 193.0.0.0/24

% Server is running at low priority for -M, -m and
-k queries

route:       193.0.0.0/24
descr:       RIPE-NCC
[....stuff deleted....]


-r -T in 193.0.0.0/24

inetnum:     193.0.0.0 - 193.0.0.255
netname:     RIPE-NCC
[....stuff deleted....]


-k


Connection closed by foreign host.
[an-lar] $

Note: "-k" is typed first, before any other charac-
ters.  Typing "-k" alone closes the session.


2.1.5     E-mail:


(a) Send mail to <whois@ripe.net> with in the body
text:

whois KEY,

where KEY is one of the KEYS from Section 2.1.1(a).
"whois" must be at the beginning of a new line in
the body of the message.  Separate queries must be
on separate lines.  The "Subject:" line will not be
interpreted.

Example:

An e-mail with the following in the body of the mes-
sage

whois 193.0.0.0/24

whois AMRM1-RIPE


gets the following mail:

> Dear mail whois user,
>
> The requested RIPE database queries gave the fol-
lowing results:
>
> ------
> Query: 193.0.0.0/24
>
>

> inetnum:     193.0.0.0 - 193.0.0.255
> netname:     RIPE-NCC
> [.....stuff deleted.....]
>
> route:       193.0.0.0/24
> descr:       RIPE-NCC
> [.....stuff deleted.....]
>
> ------
> Query: AMRM1-RIPE
>
>
> person:      Ambrose Magee
> address:     RIPE Network Co-ordination Centre (NCC)
> [.....stuff deleted.....]
>
> Regards
> The RIPE NCC whois service (e-mail department)




Important !


*    This method doesn't support the whois options !


*    Separate queries must be on separate lines.




2.1.6     Means of querying other databases

To query the InterNIC database, use

[an-lar] $ whois -h whois.internic.net <search
string>

All the databases that are mirrored by the RIPE NCC
may be directly queried in this way.


The databases that may be mirrored are:

RIPE, RADB, INTERNIC, ANS, MCI, CANET, APNIC



