⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 network-inetd.html

📁 这是很好的学习嵌入式LINUX的文章
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta name="generator" content="HTML Tidy, see www.w3.org" /><title>inetd 超级服务器</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD 使用手册" href="index.html" /><link rel="UP" title="Network Servers" href="network-servers.html" /><link rel="PREVIOUS" title="Network Servers" href="network-servers.html" /><link rel="NEXT" title="Network File System (NFS)" href="network-nfs.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /><meta http-equiv="Content-Type" content="text/html; charset=GB2312" /></head><body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"alink="#0000FF"><div class="NAVHEADER"><table summary="Header navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><th colspan="3" align="center">FreeBSD 使用手册</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="network-servers.html"accesskey="P">后退</a></td><td width="80%" align="center" valign="bottom">章 23. Network Servers</td><td width="10%" align="right" valign="bottom"><a href="network-nfs.html"accesskey="N">前进</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="NETWORK-INETD" name="NETWORK-INETD">23.2. <bclass="APPLICATION">inetd</b> ``超级服务器''</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Contributed by</span> Chern Lee.</i> <div class="SECT2"><h2 class="SECT2"><a id="NETWORK-INETD-OVERVIEW" name="NETWORK-INETD-OVERVIEW">23.2.1.总览</a></h2><p><span class="CITEREFENTRY"><span class="REFENTRYTITLE">inetd</span>(8)</span>被称为``Internet Super-Server'', 因为它管理几个守护程序的链接。提供网络服务的程序被称为守护进程。<b class="APPLICATION">inetd</b>作为一个为其他daemon的管理服务器,当一个被<b class="APPLICATION">inetd</b>收到后,它将决定连接将前往哪个程序,然后拉起对应的守护进程, 并将socket转交过去。比起来将所有守护进程以stand-alone模式 运行,运行单个<bclass="APPLICATION">inetd</b>实例可以降低 系统开销。</p><p>一般说来,<b class="APPLICATION">inetd</b> 被用来拉起其他守护进程,不过有些细碎的协议被直接接管,比如<b class="APPLICATION">chargen</b>, <bclass="APPLICATION">auth</b>,和 <b class="APPLICATION">daytime</b>。</p><p>这一部分将通过命令行选项和<tt class="FILENAME">/etc/inetd.conf</tt> 文件来介绍配置<bclass="APPLICATION">inetd</b> 的基础知识。</p></div><div class="SECT2"><h2 class="SECT2"><a id="NETWORK-INETD-SETTINGS" name="NETWORK-INETD-SETTINGS">23.2.2.设置</a></h2><p><b class="APPLICATION">inetd</b> 通过 <tt class="FILENAME">/etc/rc.conf</tt>系统进行初始化。<var class="LITERAL">inetd_enable</var> 选项默认被设定为 <varclass="LITERAL">NO</var>,不过可以通过<b class="APPLICATION">sysinstall</b>打开,如果选用中等安全的模板。在<tt class="FILENAME">/etc/rc.conf</tt>中设定:</p><pre class="PROGRAMLISTING">inetd_enable="YES"</pre><pre class="PROGRAMLISTING">inetd_enable="NO"</pre>可以激活或者禁止<b class="APPLICATION">inetd</b>在启动时加载。<br /><br /><p>此外,可以通过<var class="LITERAL">inetd_flags</var>把不同的 命令行参数传给<bclass="APPLICATION">inetd</b>。</p></div><div class="SECT2"><h2 class="SECT2"><a id="NETWORK-INETD-CMDLINE" name="NETWORK-INETD-CMDLINE">23.2.3.命令行选项</a></h2><p><b class="APPLICATION">inetd</b> 语法:</p><p><var class="OPTION">inetd [-d] [-l] [-w] [-W] [-c maximum] [-C rate] [-a address |hostname] [-p filename] [-R rate] [configuration file]</var></p><div class="VARIABLELIST"><dl><dt>-d</dt><dd><p>打开调试选项。</p></dd><dt>-l</dt><dd><p>纪录成功的连接</p></dd><dt>-w</dt><dd><p>为外部服务打开TCP Wrapping(默认).</p></dd><dt>-W</dt><dd><p>为<b class="APPLICATION">inetd</b>的内置服务打开TCP Wrapping (默认)。</p></dd><dt>-c maximum</dt><dd><p>指定单个服务的最大并发访问数量,默认为不限。 也可以在此服务的具体配置里面通过<varclass="OPTION">max-child</var>改掉。</p></dd><dt>-C rate</dt><dd><p>指定单个服务一分钟内能被单个IP地址调用的最大次数,默认不限。也可以在此服务的具体配置里面通过<varclass="OPTION">max-connections-per-ip-per-minute</var> 改掉.</p></dd><dt>-R rate</dt><dd><p>指定单个服务一分钟内能被调用的最大次数,默认为256。 设为0 则允许不限次数调用。</p></dd><dt>-a</dt><dd><p>Specify one specific IP address to bind to. Alternatively, a hostname can bespecified, in which case the IPv4 or IPv6 address which corresponds to that hostname isused. Usually a hostname is specified when <b class="APPLICATION">inetd</b> is run insidea <span class="CITEREFENTRY"><span class="REFENTRYTITLE">jail</span>(8)</span>, in whichcase the hostname corresponds to the <span class="CITEREFENTRY"><spanclass="REFENTRYTITLE">jail</span>(8)</span> environment.</p><p>When hostname specification is used and both IPv4 and IPv6 bindings are desired, oneentry with the appropriate protocol type for each binding is required for each service in<tt class="FILENAME">/etc/inetd.conf</tt>. For example, a TCP-based service would needtwo entries, one using <var class="LITERAL">tcp4</var> for the protocol and the otherusing <var class="LITERAL">tcp6</var>.</p></dd><dt>-p</dt><dd><p>Specify an alternate file in which to store the process ID.</p></dd></dl></div><p>These options can be passed to <b class="APPLICATION">inetd</b> using the <varclass="LITERAL">inetd_flags</var> option in <tt class="FILENAME">/etc/rc.conf</tt>. Bydefault, <var class="LITERAL">inetd_flags</var> is set to <var class="LITERAL">-wW</var>,which turns on TCP wrapping for <b class="APPLICATION">inetd</b>'s internal and externalservices. For novice users, these parameters usually do not need to be modified or evenentered in <tt class="FILENAME">/etc/rc.conf</tt>.</p><div class="NOTE"><blockquote class="NOTE"><p><b>注:</b> An external service is a daemon outside of <bclass="APPLICATION">inetd</b>, which is invoked when a connection is received for it. Onthe other hand, an internal service is one that <b class="APPLICATION">inetd</b> has thefacility of offering within itself.</p></blockquote></div></div><div class="SECT2"><h2 class="SECT2"><a id="NETWORK-INETD-CONF" name="NETWORK-INETD-CONF">23.2.4. <ttclass="FILENAME">inetd.conf</tt></a></h2><p>Configuration of <b class="APPLICATION">inetd</b> is controlled through the <ttclass="FILENAME">/etc/inetd.conf</tt> file.</p><p>When a modification is made to <tt class="FILENAME">/etc/inetd.conf</tt>, <bclass="APPLICATION">inetd</b> can be forced to re-read its configuration file by sendinga HangUP signal to the <b class="APPLICATION">inetd</b> process as shown:</p><div class="EXAMPLE"><a id="NETWORK-INETD-HANGUP" name="NETWORK-INETD-HANGUP"></a><p><b>例子 23-1. Sending inetd a HangUP Signal</b></p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">kill -HUP `cat /var/run/inetd.pid`</kbd></pre></div><p>Each line of the configuration file specifies an individual daemon. Comments in thefile are preceded by a ``#''. The format of <tt class="FILENAME">/etc/inetd.conf</tt> isas follows:</p><pre class="PROGRAMLISTING">service-namesocket-typeprotocol{wait|nowait}[/max-child[/max-connections-per-ip-per-minute]]user[:group][/login-class]server-programserver-program-arguments</pre><p>An example entry for the <b class="APPLICATION">ftpd</b> daemon using IPv4:</p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -