📄 slip.html
字号:
you might get:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">ifconfig sl0</kbd>sl0: flags=10<POINTOPOINT> inet 136.152.64.181 --> 136.152.64.1 netmask ffffff00</pre></li><li><p>If you get ``<tt class="ERRORNAME">no route to host</tt>'' messages from ping, theremay be a problem with your routing table. You can use the <tt class="COMMAND">netstat-r</tt> command to display the current routes :</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">netstat -r</kbd>Routing tablesDestination Gateway Flags Refs Use IfaceMTU Rtt Netmasks:(root node)(root node)Route Tree for Protocol Family inet:(root node) =>default inr-3.Example.EDU UG 8 224515 sl0 - -localhost.Exampl localhost.Example. UH 5 42127 lo0 - 0.438inr-3.Example.ED water.CS.Example.E UH 1 0 sl0 - -water.CS.Example localhost.Example. UGH 34 47641234 lo0 - 0.438(root node)</pre><p>The preceding examples are from a relatively busy system. The numbers on your systemwill vary depending on network activity.</p></li></ul></div></div><div class="SECT2"><h2 class="SECT2"><a id="SLIPS" name="SLIPS">21.7.2 Setting Up a SLIP Server</a></h2><p>This document provides suggestions for setting up SLIP Server services on a FreeBSDsystem, which typically means configuring your system to automatically startupconnections upon login for remote SLIP clients.</p><div class="SECT3"><h3 class="SECT3"><a id="SLIPS-PREREQS" name="SLIPS-PREREQS">21.7.2.1Prerequisites</a></h3><p>This section is very technical in nature, so background knowledge is required. It isassumed that you are familiar with the TCP/IP network protocol, and in particular,network and node addressing, network address masks, subnetting, routing, and routingprotocols, such as RIP. Configuring SLIP services on a dial-up server requires aknowledge of these concepts, and if you are not familiar with them, please read a copy ofeither Craig Hunt's <span class="emphasis"><i class="EMPHASIS">TCP/IP NetworkAdministration</i></span> published by O'Reilly & Associates, Inc. (ISBN Number0-937175-82-X), or Douglas Comer's books on the TCP/IP protocol.</p><p>It is further assumed that you have already set up your modem(s) and configured theappropriate system files to allow logins through your modems. If you have not preparedyour system for this yet, please see the tutorial for configuring dialup services; if youhave a World-Wide Web browser available, browse the list of tutorials at <ahref="../../../../docs.html" target="_top">http://www.FreeBSD.org/docs.html</a>. You mayalso want to check the manual pages for <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=sio&sektion=4"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">sio</span>(4)</span></a> for informationon the serial port device driver and <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ttys&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ttys</span>(5)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=gettytab&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">gettytab</span>(5)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=getty&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">getty</span>(8)</span></a>, & <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=init&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">init</span>(8)</span></a> forinformation relevant to configuring the system to accept logins on modems, and perhaps <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=stty&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">stty</span>(1)</span></a> forinformation on setting serial port parameters (such as <var class="LITERAL">clocal</var>for directly-connected serial interfaces).</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN31476" name="AEN31476">21.7.2.2 Quick Overview</a></h3><p>In its typical configuration, using FreeBSD as a SLIP server works as follows: a SLIPuser dials up your FreeBSD SLIP Server system and logs in with a special SLIP login IDthat uses <tt class="FILENAME">/usr/sbin/sliplogin</tt> as the special user's shell. The<tt class="COMMAND">sliplogin</tt> program browses the file <ttclass="FILENAME">/etc/sliphome/slip.hosts</tt> to find a matching line for the specialuser, and if it finds a match, connects the serial line to an available SLIP interfaceand then runs the shell script <tt class="FILENAME">/etc/sliphome/slip.login</tt> toconfigure the SLIP interface.</p><div class="SECT4"><h4 class="SECT4"><a id="AEN31483" name="AEN31483">21.7.2.2.1 An Example of a SLIP ServerLogin</a></h4><p>For example, if a SLIP user ID were <tt class="USERNAME">Shelmerg</tt>, <ttclass="USERNAME">Shelmerg</tt>'s entry in <tt class="FILENAME">/etc/master.passwd</tt>would look something like this:</p><pre class="PROGRAMLISTING">Shelmerg:password:1964:89::0:0:Guy Helmer - SLIP:/usr/users/Shelmerg:/usr/sbin/sliplogin</pre><p>When <tt class="USERNAME">Shelmerg</tt> logs in, <tt class="COMMAND">sliplogin</tt>will search <tt class="FILENAME">/etc/sliphome/slip.hosts</tt> for a line that had amatching user ID; for example, there may be a line in <ttclass="FILENAME">/etc/sliphome/slip.hosts</tt> that reads:</p><pre class="PROGRAMLISTING">Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp</pre><p><tt class="COMMAND">sliplogin</tt> will find that matching line, hook the serial lineinto the next available SLIP interface, and then execute <ttclass="FILENAME">/etc/sliphome/slip.login</tt> like this:</p><pre class="PROGRAMLISTING">/etc/sliphome/slip.login 0 19200 Shelmerg dc-slip sl-helmer 0xfffffc00 autocomp</pre><p>If all goes well, <tt class="FILENAME">/etc/sliphome/slip.login</tt> will issue an <ttclass="COMMAND">ifconfig</tt> for the SLIP interface to which <ttclass="COMMAND">sliplogin</tt> attached itself (slip interface 0, in the above example,which was the first parameter in the list given to <tt class="FILENAME">slip.login</tt>)to set the local IP address (<tt class="HOSTID">dc-slip</tt>), remote IP address (<ttclass="HOSTID">sl-helmer</tt>), network mask for the SLIP interface (<ttclass="HOSTID">0xfffffc00</tt>), and any additional flags (<varclass="LITERAL">autocomp</var>). If something goes wrong, <ttclass="COMMAND">sliplogin</tt> usually logs good informational messages via the <varclass="LITERAL">daemon</var> syslog facility, which usually logs to <ttclass="FILENAME">/var/log/messages</tt> (see the manual pages for <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=syslogd&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">syslogd</span>(8)</span></a> and <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=syslog.conf&sektion=5"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">syslog.conf</span>(5)</span></a> andperhaps check <tt class="FILENAME">/etc/syslog.conf</tt> to see to what <ttclass="COMMAND">syslogd</tt> is logging and where it is logging to).</p><p>OK, enough of the examples -- let us dive into setting up the system.</p></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN31521" name="AEN31521">21.7.2.3 Kernel Configuration</a></h3><p>FreeBSD's default kernels usually come with two SLIP interfaces defined (<ttclass="DEVICENAME">sl0</tt> and <tt class="DEVICENAME">sl1</tt>); you can use <ttclass="COMMAND">netstat -i</tt> to see whether these interfaces are defined in yourkernel.</p><p>Sample output from <tt class="COMMAND">netstat -i</tt>:</p><pre class="SCREEN">Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Colled0 1500 <Link>0.0.c0.2c.5f.4a 291311 0 174209 0 133ed0 1500 138.247.224 ivory 291311 0 174209 0 133lo0 65535 <Link> 79 0 79 0 0lo0 65535 loop localhost 79 0 79 0 0sl0* 296 <Link> 0 0 0 0 0sl1* 296 <Link> 0 0 0 0 0</pre><p>The <tt class="DEVICENAME">sl0</tt> and <tt class="DEVICENAME">sl1</tt> interfacesshown from <tt class="COMMAND">netstat -i</tt> indicate that there are two SLIPinterfaces built into the kernel. (The asterisks after the <var class="LITERAL">sl0</var>and <var class="LITERAL">sl1</var> indicate that the interfaces are ``down''.)</p><p>However, FreeBSD's default kernel does not come configured to forward packets (bydefault, your FreeBSD machine will not act as a router) due to Internet RFC requirementsfor Internet hosts (see RFCs 1009 [Requirements for Internet Gateways], 1122[Requirements for Internet Hosts -- Communication Layers], and perhaps 1127 [APerspective on the Host Requirements RFCs]). If you want your FreeBSD SLIP Server to actas a router, you will have to edit the <tt class="FILENAME">/etc/rc.conf</tt> file andchange the setting of the <var class="LITERAL">gateway_enable</var> variable to <varclass="OPTION">YES</var>.</p><p>You will then need to reboot for the new settings to take effect.</p><p>You will notice that near the end of the default kernel configuration file (<ttclass="FILENAME">/sys/i386/conf/GENERIC</tt>) is a line that reads:</p><pre class="PROGRAMLISTING">pseudo-device sl 2</pre><p>This is the line that defines the number of SLIP devices available in the kernel; thenumber at the end of the line is the maximum number of SLIP connections that may beoperating simultaneously.</p><p>Please refer to <a href="kernelconfig.html">Chapter 8</a> on Configuring the FreeBSDKernel for help in reconfiguring your kernel.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN31553" name="AEN31553">21.7.2.4 SliploginConfiguration</a></h3><p>As mentioned earlier, there are three files in the <ttclass="FILENAME">/etc/sliphome</tt> directory that are part of the configuration for <ttclass="FILENAME">/usr/sbin/sliplogin</tt> (see <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=sliplogin&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">sliplogin</span>(8)</span></a> for theactual manual page for <tt class="COMMAND">sliplogin</tt>): <ttclass="FILENAME">slip.hosts</tt>, which defines the SLIP users and their associated IPaddresses; <tt class="FILENAME">slip.login</tt>, which usually just configures the SLIPinterface; and (optionally) <tt class="FILENAME">slip.logout</tt>, which undoes <ttclass="FILENAME">slip.login</tt>'s effects when the serial connection is terminated.</p><div class="SECT4"><h4 class="SECT4"><a id="AEN31566" name="AEN31566">21.7.2.4.1 <ttclass="FILENAME">slip.hosts</tt> Configuration</a></h4><p><tt class="FILENAME">/etc/sliphome/slip.hosts</tt> contains lines which have at leastfour items separated by whitespace:</p><ul><li><p>SLIP user's login ID</p></li><li><p>Local address (local to the SLIP server) of the SLIP link</p></li><li><p>Remote address of the SLIP link</p></li><li><p>Network mask</p></li></ul><p>The local and remote addresses may be host names (resolved to IP addresses by <ttclass="FILENAME">/etc/hosts</tt> or by the domain name service, depending on yourspecifications in the file <tt class="FILENAME">/etc/nsswitch.conf</tt> onFreeBSD 5.X, in <tt class="FILENAME">/etc/host.conf</tt> if you useFreeBSD 4.X), and the network mask may be a name that can be resolved by a lookupinto <tt class="FILENAME">/etc/networks</tt>. On a sample system, <ttclass="FILENAME">/etc/sliphome/slip.hosts</tt> looks like this:</p><pre class="PROGRAMLISTING">## login local-addr remote-addr mask opt1 opt2 # (normal,compress,noicmp)#Shelmerg dc-slip sl-helmerg 0xfffffc00 autocomp</pre><p>At the end of the line is one or more of the options.</p><ul><li><p><var class="OPTION">normal</var> -- no header compression</p></li><li><p><var class="OPTION">compress</var> -- compress headers</p></li><li><p><var class="OPTION">autocomp</var> -- compress headers if the remote end allows it</p></li><li><p><var class="OPTION">noicmp</var> -- disable ICMP packets (so any ``ping'' packets willbe dropped instead of using up your bandwidth)</p></li></ul><p>Your choice of local and remote addresses for your SLIP links depends on whether youare going to dedicate a TCP/IP subnet or if you are going to use ``proxy ARP'' on yourSLIP server (it is not ``true'' proxy ARP, but that is the terminology used in thissection to describe it). If you are not sure which method to select or how to assign IPaddresses, please refer to the TCP/IP books referenced in the SLIP Prerequisites (<ahref="slip.html#SLIPS-PREREQS">Section 21.7.2.1</a>) and/or consult your IP networkmanager.</p><p>If you are going to use a separate subnet for your SLIP clients, you will need toallocate the subnet number out of your assigned IP network number and assign each of yourSLIP client's IP numbers out of that subnet. Then, you will probably need to configure astatic route to the SLIP subnet via your SLIP server on your nearest IP router.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -