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

📄 slip.html

📁 FreeBSD操作系统的详细使用手册
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!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>Using SLIP</title><meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" /><link rel="HOME" title="FreeBSD Handbook" href="index.html" /><link rel="UP" title="PPP and SLIP" href="ppp-and-slip.html" /><link rel="PREVIOUS" title="Using PPP over ATM (PPPoA)" href="pppoa.html" /><link rel="NEXT" title="Electronic Mail" href="mail.html" /><link rel="STYLESHEET" type="text/css" href="docbook.css" /></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 Handbook</th></tr><tr><td width="10%" align="left" valign="bottom"><a href="pppoa.html"accesskey="P">Prev</a></td><td width="80%" align="center" valign="bottom">Chapter 21 PPP and SLIP</td><td width="10%" align="right" valign="bottom"><a href="mail.html"accesskey="N">Next</a></td></tr></table><hr align="LEFT" width="100%" /></div><div class="SECT1"><h1 class="SECT1"><a id="SLIP" name="SLIP">21.7 Using SLIP</a></h1><i class="AUTHORGROUP"><span class="CONTRIB">Originally contributed by</span> SatoshiAsami.</i> <i class="AUTHORGROUP"><span class="CONTRIB">With input from</span> Guy Helmerand Piero Serini.</i> <div class="SECT2"><h2 class="SECT2"><a id="SLIPC" name="SLIPC">21.7.1 Setting Up a SLIP Client</a></h2><p>The following is one way to set up a FreeBSD machine for SLIP on a static hostnetwork. For dynamic hostname assignments (your address changes each time you dial up),you probably need to have a more complex setup.</p><p>First, determine which serial port your modem is connected to. Many people set up asymbolic link, such as <tt class="FILENAME">/dev/modem</tt>, to point to the real devicename, <tt class="FILENAME">/dev/cuaaN</tt>. This allows you to abstract the actual devicename should you ever need to move the modem to a different port. It can become quitecumbersome when you need to fix a bunch of files in <tt class="FILENAME">/etc</tt> and<tt class="FILENAME">.kermrc</tt> files all over the system!</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> <tt class="FILENAME">/dev/cuaa0</tt> is <tt class="DEVICENAME">COM1</tt>,<tt class="FILENAME">cuaa1</tt> is <tt class="DEVICENAME">COM2</tt>, etc.</p></blockquote></div><p>Make sure you have the following in your kernel configuration file:</p><pre class="PROGRAMLISTING">pseudo-device   sl      1</pre><p>Under FreeBSD&nbsp;5.X, use instead the folowing line:</p><pre class="PROGRAMLISTING">device   sl</pre><p>It is included in the <tt class="FILENAME">GENERIC</tt> kernel, so this should not bea problem unless you have deleted it.</p><div class="SECT3"><h3 class="SECT3"><a id="AEN31313" name="AEN31313">21.7.1.1 Things You Have to Do OnlyOnce</a></h3><div class="PROCEDURE"><ol type="1"><li><p>Add your home machine, the gateway and nameservers to your <ttclass="FILENAME">/etc/hosts</tt> file. Mine looks like this:</p><pre class="PROGRAMLISTING">127.0.0.1               localhost loghost136.152.64.181          water.CS.Example.EDU water.CS water136.152.64.1            inr-3.CS.Example.EDU inr-3 slip-gateway128.32.136.9            ns1.Example.EDU ns1128.32.136.12           ns2.Example.EDU ns2</pre></li><li><p>Make sure you have <var class="OPTION">hosts</var> before <varclass="OPTION">bind</var> in your <tt class="FILENAME">/etc/host.conf</tt> on FreeBSDversions prior to 5.0. Since FreeBSD&nbsp;5.0, the system uses the file <ttclass="FILENAME">/etc/nsswitch.conf</tt> instead, make sure you have <varclass="OPTION">files</var> before <var class="OPTION">dns</var> in the <varclass="OPTION">hosts</var> line of this file. Without these parameters funny things mayhappen.</p></li><li><p>Edit the <tt class="FILENAME">/etc/rc.conf</tt> file.</p><ol type="1"><li><p>Set your hostname by editing the line that says:</p><pre class="PROGRAMLISTING">hostname="myname.my.domain"</pre><p>Your machine's full Internet hostname should be placed here.</p></li><li><p>Add <tt class="DEVICENAME">sl0</tt> to the list of network interfaces by changing theline that says:</p><pre class="PROGRAMLISTING">network_interfaces="lo0"</pre><p>to:</p><pre class="PROGRAMLISTING">network_interfaces="lo0 sl0"</pre></li><li><p>Set the startup flags of <tt class="DEVICENAME">sl0</tt> by adding a line:</p><pre class="PROGRAMLISTING">ifconfig_sl0="inet ${hostname} slip-gateway netmask 0xffffff00 up"</pre></li><li><p>Designate the default router by changing the line:</p><pre class="PROGRAMLISTING">defaultrouter="NO"</pre><p>to:</p><pre class="PROGRAMLISTING">defaultrouter="slip-gateway"</pre></li></ol></li><li><p>Make a file <tt class="FILENAME">/etc/resolv.conf</tt> which contains:</p><pre class="PROGRAMLISTING">domain CS.Example.EDUnameserver 128.32.136.9nameserver 128.32.136.12</pre><p>As you can see, these set up the nameserver hosts. Of course, the actual domain namesand addresses depend on your environment.</p></li><li><p>Set the password for <tt class="USERNAME">root</tt> and <tt class="USERNAME">toor</tt>(and any other accounts that do not have a password).</p></li><li><p>Reboot your machine and make sure it comes up with the correct hostname.</p></li></ol></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN31369" name="AEN31369">21.7.1.2 Making a SLIPConnection</a></h3><div class="PROCEDURE"><ol type="1"><li><p>Dial up, type <tt class="COMMAND">slip</tt> at the prompt, enter your machine name andpassword. What is required to be entered depends on your environment. If you use kermit,you can try a script like this:</p><pre class="PROGRAMLISTING"># kermit setupset modem hayesset line /dev/modemset speed 115200set parity noneset flow rts/ctsset terminal bytesize 8set file type binary# The next macro will dial up and logindefine slip dial 643-9600, input 10 =&gt;, if failure stop, -output slip\x0d, input 10 Username:, if failure stop, -output silvia\x0d, input 10 Password:, if failure stop, -output ***\x0d, echo \x0aCONNECTED\x0a</pre><p>Of course, you have to change the hostname and password to fit yours. After doing so,you can just type <tt class="COMMAND">slip</tt> from the kermit prompt to connect.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> Leaving your password in plain text anywhere in the filesystem isgenerally a <span class="emphasis"><i class="EMPHASIS">bad</i></span> idea. Do it at yourown risk.</p></blockquote></div></li><li><p>Leave the kermit there (you can suspend it by <b class="KEYCAP">Ctrl</b>-<bclass="KEYCAP">z</b>) and as <tt class="USERNAME">root</tt>, type:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">slattach -h -c -s 115200 /dev/modem</kbd></pre><p>If you are able to <tt class="COMMAND">ping</tt> hosts on the other side of therouter, you are connected! If it does not work, you might want to try <varclass="OPTION">-a</var> instead of <var class="OPTION">-c</var> as an argument to <ttclass="COMMAND">slattach</tt>.</p></li></ol></div></div><div class="SECT3"><h3 class="SECT3"><a id="AEN31398" name="AEN31398">21.7.1.3 How to Shutdown theConnection</a></h3><p>Do the following:</p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbdclass="USERINPUT">kill -INT `cat /var/run/slattach.modem.pid`</kbd></pre><p>to kill <tt class="COMMAND">slattach</tt>. Keep in mind you must be <ttclass="USERNAME">root</tt> to do the above. Then go back to kermit (by running <ttclass="COMMAND">fg</tt> if you suspended it) and exit from it (<ttclass="COMMAND">q</tt>).</p><p>The <tt class="COMMAND">slattach</tt> manual page says you have to use <ttclass="COMMAND">ifconfig sl0 down</tt> to mark the interface down, but this does not seemto make any difference for me. (<tt class="COMMAND">ifconfig sl0</tt> reports the samething.)</p><p>Some times, your modem might refuse to drop the carrier (mine often does). In thatcase, simply start kermit and quit it again. It usually goes out on the second try.</p></div><div class="SECT3"><h3 class="SECT3"><a id="AEN31414" name="AEN31414">21.7.1.4 Troubleshooting</a></h3><p>If it does not work, feel free to ask me. The things that people tripped over sofar:</p><ul><li><p>Not using <var class="OPTION">-c</var> or <var class="OPTION">-a</var> in <ttclass="COMMAND">slattach</tt> (This should not be fatal, but some users have reportedthat this solves their problems.)</p></li><li><p>Using <var class="OPTION">s10</var> instead of <var class="OPTION">sl0</var> (might behard to see the difference on some fonts).</p></li><li><p>Try <tt class="COMMAND">ifconfig sl0</tt> to see your interface status. For example,

⌨️ 快捷键说明

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