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

📄 lsg31.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 3 页
字号:


<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="lsg32.htm">



















<A NAME="I0"></A>







<H2>Linux System Administrator's Survival Guide lsg31.htm</H2>







<P ALIGN=LEFT>







































<HR ALIGN=CENTER>







<P>







<UL>







<UL>







<UL>







<LI>







<A HREF="#E68E172" >Setting Up the Dummy Interface</A>







<LI>







<A HREF="#E68E173" >Setting Up SLIP</A>







<UL>







<LI>







<A HREF="#E69E199" >Configuring SLIP</A>







<LI>







<A HREF="#E69E200" >Using dip</A></UL>







<LI>







<A HREF="#E68E174" >Setting Up PPP</A>







<UL>







<LI>







<A HREF="#E69E201" >Setting Up a PPP Account</A>







<LI>







<A HREF="#E69E202" >Dialing Out: chat</A>







<LI>







<A HREF="#E69E203" >Running ppd</A>







<LI>







<A HREF="#E69E204" >Checking Problems</A>







<LI>







<A HREF="#E69E205" >PPP Authentication</A></UL>







<LI>







<A HREF="#E68E175" >Using DNS for SLIP and PPP</A>







<LI>







<A HREF="#E68E176" >Summary</A></UL></UL></UL>







<HR ALIGN=CENTER>







<A NAME="E66E35"></A>







<H1 ALIGN=CENTER>







<CENTER>







<FONT SIZE=6 COLOR="#FF0000"><B>Chapter 31</B></FONT></CENTER></H1>







<BR>







<A NAME="E67E38"></A>







<H2 ALIGN=CENTER>







<CENTER>







<FONT SIZE=6 COLOR="#FF0000"><B>Configuring SLIP and PPP</B></FONT></CENTER></H2>







<BR>







<P>This chapter looks at the configuration and setup required to use either SLIP (Serial Line Internet Protocol) or PPP (Point to Point Protocol) on your Linux system. This follows the general TCP/IP configuration performed in the previous chapter. Both SLIP and PP work over a dialup modem, essentially establishing a normal modem link with a remote system, then invoking either the SLIP or PPP protocols. In many ways, SLIP and PPP are like PLIP interfaces; even though SLIP and PPP use a serial modem port, they are really point-to-point interfaces involving two machines. Unfortunately, SLIP and PPP are more complicated to configure than PLIP.







<BR>







<P>You can do the SLIP and PPP configuration when you are configuring the general TCP/IP files, or you can wait until you need to set them up for SLIP or PPP access. Since not all installations will require SLIP or PPP, you can quite easily wait. However, most Internet service providers prefer SLIP or PPP access from small systems, because they provide fast, efficient transfers.







<BR>







<BR>







<A NAME="E68E172"></A>







<H3 ALIGN=CENTER>







<CENTER>







<FONT SIZE=5 COLOR="#FF0000"><B>Setting Up the Dummy Interface</B></FONT></CENTER></H3>







<BR>







<P>What's a dummy interface? It's a bit of a trick to give your machine an IP address to work with when it uses only SLIP and PPP interfaces. A dummy interface solves the problem of a stand-alone machine (no network cards connecting it to other machines) whose only valid IP address to which data can be sent is the loopback driver (127.0.0.1). While SLIP and PPP may be used for connecting your machine to the outside world, when the interface is not active you have no internal IP address that applications can use.







<BR>







<P>The problem arises with some applications that require a valid IP address to work. Some word processors and desktop layout tools, for example, require the TCP/IP system to be operational with an IP address for the target machine. The dummy interface essentially sets an IP address for your local machine that is valid as far as TCP/IP is concerned, but doesn't really get used except to fool applications.







<BR>







<P>Creating a dummy interface using the loopback driver is very simple. If your machine has an IP address already assigned for it in the /etc/hosts file, all you need to do is set up the interface and create a route. The following two commands are required:







<BR>







<PRE>







<FONT COLOR="#000080">ifconfig lo 127.0.0.1







route add 127.0.0.1</FONT></PRE>







<P>The lo portion of the ifconfig command indicates that the line refers to the loopback driver. This line creates a link to the IP address 127.0.0.1. If you do not have an IP address for the localhost already in the /etc/hosts file, add one before you create the dummy interface. To create the loopback interface, edit the /etc/hosts file so it includes a line like the following:







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">127.0.0.1 localhost</FONT></PRE>







<P>This line sets up your local machine to use the IP address 127.0.0.1 as the localhost interface. You can verify that the loopback interface is working properly after you have used the ifconfig command by using the ifconfig command with the interface name to show statistics:







<BR>







<PRE>







<FONT COLOR="#000080">merlin $ ifconfig lo







lo Link encap:Local Loopback 







 inet addr:127.0.0.1 Bcast:127.255.255.255 Mask:255.0.0.0







 UP BROADCAST LOOPBACK RUNNING MTU:2000 Metric:1







 RX packets:0 errors:0 dropped:0 overruns:0







 TX packets:12 errors:0 dropped:0 overruns:0</FONT></PRE>







<P>The statistics show that the loopback interface is running, has been assigned the IP address 127.0.0.1, and has the broadcast mask of 255.0.0.0.







<BR>







<P>After you add the loopback driver to the routing table using the route command, you can use the ping command to check that the interface is responding properly:







<BR>







<PRE>







<FONT COLOR="#000080">merlin $ ping localhost







PING localhost (127.0.0.1): 56 data bytes







64 bytes from 127.0.0.1: icmp_seq=0 ttl=255 time=0.8 ms







64 bytes from 127.0.0.1: icmp_seq=1 ttl=255 time=0.7 ms







64 bytes from 127.0.0.1: icmp_seq=2 ttl=255 time=0.7 ms







64 bytes from 127.0.0.1: icmp_seq=3 ttl=255 time=0.7 ms







64 bytes from 127.0.0.1: icmp_seq=4 ttl=255 time=0.7 ms







--- localhost ping statistics ---







5 packets transmitted, 5 packets received, 0% packet loss







round-trip min/avg/max = 0.7/0.7/0.8 ms</FONT></PRE>







<P>You must interrupt the ping command with a Ctrl+C to stop it. The output above shows that the packets destined for the localhost machine were properly delivered and replies were almost immediate. If you receive output anything like this output, your interface is properly set up. If you receive an unknown host message, your localhost name is not recognized. Check the /etc/hosts file and use ifconfig to verify that the loopback driver is installed properly.







<BR>







<BR>







<A NAME="E68E173"></A>







<H3 ALIGN=CENTER>







<CENTER>







<FONT SIZE=5 COLOR="#FF0000"><B>Setting Up SLIP</B></FONT></CENTER></H3>







<BR>







<P>SLIP can be used with many dial-up Internet service providers, as well as for networking with other machines. When a modem connection is established, you don't get to see a shell prompt, but SLIP takes over and maintains the session for you. The SLIP driver is usually configured as part of the Linux kernel. The Linux SLIP driver also handles CSLIP, a compressed SLIP version that is available with some implementations.







<BR>







<P>For most Linux systems that use SLIP, a serial port has to be dedicated to the device. This means that a serial port must be specifically configured to use SLIP and cannot be used for any other purpose. The kernel uses a special program called SLIPDISC (SLIP discipline) to control the serial port, and blocks other non-SLIP applications from using it.







<BR>







<P>The Linux SLIP driver is installed into the kernel usually by default, but some versions of Linux require you to rebuild the kernel and answer y to a question about SLIP and CSLIP usage. Once you have the kernel SLIP drivers in place, you can configure the serial port to be used for SLIP.







<BR>







<BR>







<A NAME="E69E199"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Configuring SLIP</B></FONT></CENTER></H4>







<BR>







<P>The easiest way to dedicate a serial port for SLIP is to use the slattach program. This takes the device name of the serial port as an argument. For example, to dedicate the second serial port (/dev/cua1) to SLIP, you would issue the command:







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">slattach /dev/cua1 &amp;</FONT></PRE>







<P>The command is set into background mode by the ampersand. Failure to send to background means the terminal or console the command was issued from is not usable until the process is terminated. You can embed the slattach command in a startup file if you want.







<BR>







<P>Once the attachment has succeeded, the port is set to the first SLIP device /dev/sl0. If you are using more than one serial port for SLIP lines, you need to issue the command for each line. Subsequent SLIP devices (/dev/sl1, /dev/sl2, and so on) will be assigned by slattach. Most versions of Linux will support up to eight SLIP lines.







<BR>







<P>By default, most Linux systems set the SLIP port to use CSLIP. If you want to override this default, use the -p option and the slip name:







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">slattach -p slip /dev/cua1 &amp;</FONT></PRE>







<P>You can use modes other than slip and cslip to follow the -p option: slip6 (a six-bit version of SLIP) and adaptive (for adaptive SLIP, which adjusts to whatever is at the other end of the connection).







<BR>







<P>You must make sure that both ends of the connection use the same form of SLIP. For example, you cannot set your device for CSLIP and communicate with another machine running SLIP. If the versions of SLIP don't match, commands such as ping will fail.







<BR>







<P>Once the serial port has been set for SLIP usage, you can configure the network interface using the same procedure used for normal network connections (including the dummy interface set up earlier). The commands used are ifconfig and route. For example, if your machine is called merlin and you are calling arthur, issue the commands:







<BR>







<PRE>







<FONT COLOR="#000080">ifconfig sl0 merlin-slip pointopoint arthur







route add arthur</FONT></PRE>







<P>The ifconfig command above configures the interface merlin-slip (the local address of the SLIP interface) to be a point-to-point connection to arthur. The route command adds the remote machine called arthur to the routing tables. You can also issue another route command to set the default route to arthur as a gateway:







<BR>







<BR>







<PRE>







<FONT COLOR="#000080">route add default gw arthur</FONT></PRE>







<P>If you want to use the SLIP port for access to the Internet, it has to have an IP address and an entry in the /etc/hosts file. That gives the SLIP system a valid entry on the Internet. A better approach is to use DNS, but the configuration is more complex (see &quot;Using DNS for SLIP and PPP,&quot; below).







<BR>







<P>Once the ifconfig and route commands have been executed, you can test and use your SLIP network. If you decide to remove the SLIP interface in the future, you must remove the routing entry, use ifconfig to take down the SLIP interface, and then kill the slattach process. The first two steps are done with these commands:







<BR>







<PRE>







<FONT COLOR="#000080">route del arthur







⌨️ 快捷键说明

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