📄 lsg39.htm
字号:
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<LINK REL="ToC" HREF="index.htm">
<LINK REL="Index" HREF="htindex.htm">
<LINK REL="Next" HREF="lsg40.htm">
<A NAME="I0"></A>
<H2>Linux System Administrator's Survival Guide lsg39.htm</H2>
<P ALIGN=LEFT>
<HR ALIGN=CENTER>
<P>
<UL>
<UL>
<UL>
<LI>
<A HREF="#E68E209" >How NNTP Handles News</A>
<LI>
<A HREF="#E68E210" >Installing the NNTP Server Program</A>
<LI>
<A HREF="#E68E211" >Configuring nntpd</A>
<LI>
<A HREF="#E68E212" > Using INN</A>
<UL>
<LI>
<A HREF="#E69E236" >Installing the INN Software</A>
<LI>
<A HREF="#E69E237" >Configuring INN</A></UL>
<LI>
<A HREF="#E68E213" >Summary</A></UL></UL></UL>
<HR ALIGN=CENTER>
<A NAME="E66E44"></A>
<H1 ALIGN=CENTER>
<CENTER>
<FONT SIZE=6 COLOR="#FF0000"><B>Chapter 39</B></FONT></CENTER></H1>
<BR>
<A NAME="E67E47"></A>
<H2 ALIGN=CENTER>
<CENTER>
<FONT SIZE=6 COLOR="#FF0000"><B>NNTP</B><B> and INN</B></FONT></CENTER></H2>
<BR>
<P>Network News Transfer Protocol (NNTP) is often used for TCP-based newsfeeds. In other words, if you are using a network to connect to a newsfeed, you can use NNTP to download your newsgroups instead of UUCP. Although UUCP users can use NNTP, the C News package is more popular and easier to work with (see <A HREF="lsg40.htm">Chapter 40</A>, "C News") for UUCP transfers as it leaves off the comlexities NNTP adds. The primary advantage of NNTP-based network newsfeeds is the much higher throughput that can be achieved. UUCP is limited to modem speeds, but NNTP can function over fast local area networks at many megabits per second. This capability allows for larger downloads in the same timespan, which can be important if you receive a lot of newsgroups. NNTP is not a stand-alone package; it requires another news server system to be running. NNTP works with both the older B News (which is seldom available for Linux now) and the better C News (discussed in the next chapter).
<BR>
<P>This chapter looks at how you can implement NNTP for a local area network news system. Although this chapter doesn't cover every NNTP option and feature, the information presented here should be sufficient to get an NNTP feed working properly. The end of this chapter looks at INN (Internet News), an alternate package for handling news. INN is a complex package capable of supporting very complex networks and news requirements, but it is often overkill for small Linux systems.
<BR>
<BR>
<A NAME="E68E209"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>How NNTP Handles News</B></FONT></CENTER></H3>
<BR>
<P>NNTP operates in two modes: active and passive. The active mode, often called pushing, is much the same as C News' ihave/sendme protocol in which the sender (server) offers a particular article and waits for the receiver (client) to accept or refuse the article. Pushing has a disadvantage for the server in that it has a high overhead because each article must be checked in turn.
<BR>
<P>In the passive mode, called pulling, the receiving machine requests a list of all articles in a particular newsgroup that have arrived since a specified date. This request is sent through a newnews command. When the receiving machine has all the articles, it then discards any that are duplicated or not wanted using the article command. This mode is much easier for the sending machine because it simply sends a mass of articles, but the server does have to make sure it sends information that is allowed to pass to the receiver for security's sake.
<BR>
<P>NNTP is implemented on a Linux system with the NNTP daemon developed by Stan Barber and Phil Lapsley. This daemon is known almost universally as the reference implementation. Usually, you will only have the source code for the NNTP daemon, which is called nntpd, supplied with a Linux distribution because several site-specific details must be linked into the binary. The nntpd system consists of a server program and two different client programs (one for pushing and one for pulling). In addition, most Linux nntpd systems include a replacement for the inews program.
<BR>
<P>An alternative to nntpd is the INN (InterNet News) package developed by Rich Salz. This package is supplied with many Linux distribution packages. INN allows both UUCP and network-based newsfeeds, but it is really designed for large machines. If you anticipate a lot of newsgroup access, INN may be a better choice than nntpd, although nntpd can handle full newsfeeds almost as well.
<BR>
<P>When NNTP receives an article from a remote machine, it passes it on to one of the news subsystems that must be in place. Usually, this subsystem is rnews or inews. (You can also use NNTP for batching of articles, as explained in <A HREF="lsg40.htm">Chapter 40</A> "C News." In this case, the relaynews program handles the batch of articles.) NNTP uses the /usr/lib/news/history file to properly perform some protocol transfers, so this file must be configured correctly (<A HREF="lsg40.htm">Chapter 40</A> explains how to configure this file).
<BR>
<BR>
<A NAME="E68E210"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Installing the NNTP Server Program</B></FONT></CENTER></H3>
<BR>
<P>The NNTP server, which is called nntpd or in.nntpd, is usually supplied as source code only, as was previously mentioned. In most cases, you must compile it on your machine to include machine-specific information. To configure nntpd, you use a program usually stored as /usr/lib/news/common/conf.h. You can search for the source files with the command:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">find / -name conf.h -print</FONT></PRE>
<P>Run this program (which is a number of macros) and answer all the questions about your system.
<BR>
<P>Begin the NNTP installation process by creating a directory for nntpd to store incoming articles. You should create this directory as /usr/spool/news/.tmp (or /var/spool/news/.tmp). Set the ownership of the directory to news. The two commands to perform these steps are as follows:
<BR>
<PRE>
<FONT COLOR="#000080">mkdir /usr/spool/news/.tmp
chown news.news /usr/spool/news/tmp</FONT></PRE>
<P>You can configure the NNTP server in one of two different modes. The first mode is as a stand-alone daemon, which starts itself from the rc startup files (usually rc.inet2) when the Linux system is booted. Alternatively, you can configure nntpd to be managed through inetd instead of running all the time.
<BR>
<P>If you are configuring nntpd to run as a stand-alone daemon, make sure that no line in the /etc/inetd.conf file calls the daemon. Alternatively, check the /etc/inetd.conf file for potential conflicts if you start the nntpd daemon in the rc files.
<BR>
<P>To configure nntpd to run through inetd, which can reduce the overall load on your system except when news must be processed, you need to add an entry to the inetd configuration file. This file is usually stored as /etc/inetd.conf. Add the following line to this file with an ASCII editor:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">nntp stream tcp nowait news /usr/etc/in.nntpd nntpd</FONT></PRE>
<P>The inetd.conf file may already have a line like this one commented out. In this case, verify that the line reads the same as the preceding one and remove the comment symbol.
<BR>
<P>Whether you are configuring nntpd to run as a stand-alone daemon or to be started by inetd, you need to verify that there is a line for the nntp service in the TCP /etc/services file that looks like the following:
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">nntp 119/tcp readnews untp</FONT></PRE>
<P>This line is commented out when you install most versions of Linux, so remove the comment symbol.
<BR>
<BR>
<A NAME="E68E211"></A>
<H3 ALIGN=CENTER>
<CENTER>
<FONT SIZE=5 COLOR="#FF0000"><B>Configuring nntpd</B></FONT></CENTER></H3>
<BR>
<P>Once the nntpd binaries have been created by running the conf.h file, you can configure the file /usr/lib/news/nntp_access to control which remote machines can use NNTP on your system. The file is organized in a set of lines, one for each remote, using the format
<BR>
<BR>
<PRE>
<FONT COLOR="#000080">sitename read|xfer|both|no post|no except</FONT></PRE>
<P>where sitename is the name of the remote machine, which can be identified by its sitename, a fully qualified domain name, or the IP address. NNTP allows for partial matches of the domain name and IP address, which are useful for providing multiple lines of information about newsgroups. If the remote machine's name or IP address matches the sitename exactly, only that one line is read (the rest of the file is ignored). If the match is only partial, that line is read, and then the rest of the file is examined to find further matches. If you want to match all remote machines, you can use the sitename default.
<BR>
<P>The access permissions for the site are defined in the second field. There are four legal values, which have these meanings:
<BR>
<TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
read
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The remote can retrieve articles (pulling).</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
xfer
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
The remote can send articles (pushing).</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
both
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -