TCP/IP Protocol: Network News Transfer Protocol (NNTP)


Jarret W. Buse

TCP/IP Protocol: Network News Transfer Protocol (NNTP)

The Network News Transfer Protocol (NNTP) is a news transfer system over a Transmission Control Protocol (TCP) network. NNTP can distribute, query, post and retrieve news items, sometimes called newsgroups. Since it usually uses TCP, it is a guaranteed delivery system. Since the initial use years ago, it may have taken weeks for a news stream to reach all clients on the Internet. With higher bandwidth, news messages can stream in a matter of minutes.

The news messages remain on the News Servers to allow download for any clients which have not been updated. For example, if a client has not connected to the News Server for an hour, the client connects and retrieves only the messages which are new for the last hour. Another client may connect which has not connected to the server for a week. The client has more messages to download since they have been offline longer. For this reason, messages cannot be deleted for those clients who have more out of date information. For an extreme case, someone may connect to a News Server which has not ever connected before. In this case, the client will need to download a good portion of the database.

The Internet has many News Servers, but the News Servers only use NNTP to communicate with clients. The News Servers communicate with one another to update the databases by using Unix-to-Unix Copy (UUCP).

There are two methods for obtaining news messages which are an active and passive method:

  1. Push (active) – The server will push news messages to the attached clients
  2. Pull (passive) – The client will specify the messages it requires and the server will send them
The push method causes a large server load on resources, so it is preferable to use the pull method.

The NNTP uses TCP port 119 between the News Servers and clients. So when a client creates an article (sometimes called a post or news), it is sent to their immediate News Server. That News Server then updates another News Server which in turn updates another. Once a server is updated, it can then update all clients connected to it which are allowed to receive the article.

There are a few NNTP commands which are not case sensitive:

  • ARTICLE – informs the server to send a specific news article
  • HEAD - same as ARTICLE, but sends only the article header
  • BODY – same as ARTICLE, but sends only the article body
  • STAT – same as ARTICLE, but sends only the message ID
  • GROUP –specifies a group to the server which replies with the number of articles in the group
  • HELP – sends help information from News Server to client
  • IHAVE – lets the client inform the server that it has a new message
  • LAST – specifies that the server should set the pointer to the last message in group
  • LIST – retrieves list of groups on server as well as first and last article number in each group
  • NEWGROUPS – retrieves list of new groups from server
  • NEWNEWS – requests a list of all new articles from a set date and time
  • NEXT – move pointer to next article in group
  • POST – informs server that the client has a new message to post
  • QUIT – informs server that the client is terminating the NNTP session
NOTE: There are numerous extensions to add to the command functionality, but these are usually used on specific News Servers.

Once a server receives a command, it sends a response to the client which is a three digit response code. The first digit is translated as follows:

  • 1yz – General information
  • 2yz – Command was successful
  • 3yz – Command is OK, need more information
  • 4yz – Command is OK, execution not successful
  • 5yz – Command invalid
The second digit is translated as follows:
  • x0z – Generic response
  • x1z - Newsgroup selection response
  • x2z – Article Selection response
  • x3z – Message transfer response
  • x4z – Posting message response
  • x5z – Authentication response
  • x8z – Response for use of extension command
  • x9z – Debug message
NNTP daemon

The NNTP daemon (nntpd) is used to create a News Server. You need to create a folder for the new messages to be copied to when they are placed on the server - /usr/spool/news/.tmp/. Set the ownership to the folder for ‘news’.

You will need to check for the line: ‘nntp 119/tcp readnews nntp’ in the ‘/etc/services’ file.
Once the daemon is installed and the above changes are made, you can check the configuration file at ‘/usr/lib/news/nntp_access’. The file allows you to set which remote machines can use the NNTP service on the server. Each line is set up as follows:
sitename read|xfer|both|no post|no except
The first field has the option of:
  • sitename – name of remote machine
The second field has one of these options:
  • read – remote machine can retrieve messages
  • xfer – remote machine can send messages
  • both – remote machine can send and receive messages
  • no - remote machine cannot access messages
The third field has one of these options:
  • post – remote system can post messages, but the server completes the headers
  • no – remote system cannot post articles
The ‘except’ option can specify groups to which the remote machine has no access, multiple groups are separated by commas.

For example, ‘ both post !alt,local’ allows the remote system to send and receive all messages except the ones in the alt and local groups. The remote system can also post messages.


  • slide.jpg
    56.3 KB · Views: 108,268

Members online

Latest posts