460-463.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 171 行
HTML
171 行
<HTML>
<HEAD>
<TITLE>Using Linux:Managing Network Connections</TITLE>
<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>
-->
<!--ISBN=0789716232//-->
<!--TITLE=Using Linux//-->
<!--AUTHOR=William Ball//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=27//-->
<!--PAGES=460-463//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="455-460.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="463-465.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P><FONT SIZE="+1"><B><I>Configuring <I>win</I>
</I></B></FONT></P>
<DL>
<DD><B>1.</B> Click the <B>Start</B> menu, click <B>Settings</B>, and then choose <B>Control Panel</B> to open the Control Panel window.
<DD><B>2.</B> Click the <B>Network</B> icon to open the Network window.
<DD><B>3.</B> Click the <B>Identification</B> tab.
<DD><B>4.</B> Click the Computer Name field and type the name of the computer (I’ve typed <TT><B>win</B></TT> in this example).
<DD><B>5.</B> Click the <B>Protocols</B> tab.
<DD><B>6.</B> If TCP/IP Protocol is displayed in the list of network protocols, double-click it. If not, click the <B>Add</B> button and select <B>TCP/IP Protocol</B>. Return to the <B>Protocols</B> tab, and then double-click the newly added <B>TCP/IP Protocol</B> entry.
<DD><B>7.</B> In the ensuing Microsoft TCP/IP Properties dialog box, click the <B>Specify an IP address</B> option.
<DD><B>8.</B> Click the IP Address field and type the computer’s IP address (in this case, I entered 10.8.11.7).
<DD><B>9.</B> Click the Subnet Mask field and type the computer’s subnet mask. (in this case, I entered 255.255.255.0).
<DD><B>10.</B> Click the Default Gateway field and type the computer’s gateway, which is the machine through which all packets are routed (I entered 10.8.11.2 because win’s gateway is <TT>kanchi</TT>).
<DD><B>11.</B> Click <B>OK</B> in the Microsoft TCP/IP Properties window, and then click <B>OK</B> in the Network window.
<DD><B>12.</B> Click <B>Yes</B> in the window that asks whether you want to reboot the machine for the new network configuration.
</DL>
<P>After the machine reboots, the network will be properly configured (I used the <TT>dos</TT> shell and the PING program to test this).</P>
<H3><A NAME="Heading14"></A><FONT COLOR="#000077">Enabling the Network File System Service</FONT></H3>
<P>The Network File System (NFS) provides for the mounting of directories across a network. Directories on a remote machine mounted via NFS on the local machine appear to be part of the local machines file system.
</P>
<P>Configuring the NFS service involves two parts:</P>
<DL>
<DD><B>•</B> <I>Configuring the NFS server</I>. This is the machine from which a directory is mounted. In my sample network, the NFS server is <TT>kanchi</TT>.
<DD><B>•</B> <I>Configuring the NFS client</I>. This is the machine mounting the directory. In my sample network, the NFS client is <TT>melkote</TT>.
</DL>
<P>This example demonstrates how to mount the <TT>kanchi</TT>’s <TT>/home</TT> directory on <TT>melkote</TT> so that users have the same <TT>/home</TT> directory on both machines.</P>
<P><FONT SIZE="+1"><B><I>Configuring an NFS server</I></B></FONT></P>
<DL>
<DD><B>1.</B> As root, open the file <TT>/etc/exports</TT> in your editor. If the file existed prior to opening it in the editor, its contents will be displayed in your editor’s window. If the file did not exist when you opened it, your editor will create the file and display a blank screen.
<DD><B>2.</B> A shorthand for allowing everyone to mount a directory is to simply give the permissions and not list any host names. Let’s take a look at a sample:
<!-- CODE SNIP //-->
<PRE>
# exports file for kanchi
/mnt/cdrom (ro)
/mnt/zip (rw)
/store/pub (rw)
</PRE>
<!-- END CODE SNIP //-->
<BR>This is the <TT>/etc/exports</TT> file on <TT>kanchi</TT>; the three entries in it correspond to directories that can be mounted by NFS clients. In this case, all three directories are mountable by everyone. The permissions are clearly seen in this file:
<DL>
<DD><B>•</B> <TT>(ro)</TT> This indicates read-only permissions.
<DD><B>•</B> <TT>(rw)</TT> This indicates read and write permissions.
</DL>
<DD><B>3.</B> Make the <TT>/home</TT> directory available for NFS mounting on <TT>melkote</TT> by entering the following line:
<!-- CODE SNIP //-->
<PRE>
<B>/home melkote(rw)</B>
</PRE>
<!-- END CODE SNIP //-->
<BR>This indicates that <TT>melkote</TT> can mount <TT>/home</TT> with read and write permissions.
</DL>
<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD>
<P><B>The syntax of <TT>/etc/exports</TT></B><BR>The syntax of the <TT>/etc/exports</TT> file is simple. The directories available for NFS mounting are specified one per line. On each line, the first entry is the directory that you want to mount. The next two entries are a pair. The first entry in this pair is the name of a machine that should be capable of mounting this directory; the second entry in this pair is the permissions with which this machine can mount the directory. As many host and permission pairs can exist as you want.</TABLE>
</P>
<P>Now that you have configured the NFS server <TT>kanchi</TT>, you can configure the NFS client <TT>melkote</TT>. To the client, mounting an NFS directory is the same as mounting any other type of device, such as a hard drive or CD-ROM.</P>
<P><FONT SIZE="+1"><B><I>Configuring an NFS client</I></B></FONT></P>
<DL>
<DD><B>1.</B> For <TT>melkote</TT> to mount <TT>/home</TT> properly, you must add an entry to its <TT>/etc/fstab</TT> file. In this case, the entry is as follows:
<!-- CODE SNIP //-->
<PRE>
<B>kanchi:/home /home NFS</B>
</PRE>
<!-- END CODE SNIP //-->
<DD><B>2.</B> After you have added this entry, you can mount <TT>kanchi</TT>’s <TT>/home</TT> directory as root by typing the following:
<!-- CODE SNIP //-->
<PRE>
<B>mount kanchi:/home</B>
</PRE>
<!-- END CODE SNIP //-->
<DD><B>3.</B> Now anyone who logs on to <TT>melkote</TT> will get the same <TT>/home</TT> directory as on <TT>kanchi</TT>.
</DL>
<H3><A NAME="Heading15"></A><FONT COLOR="#000077">Enabling Dial-In Service</FONT></H3>
<P>Enabling dial-in service on a Linux system requires two programs:
</P>
<DL>
<DD><B>•</B> The PPP daemon (PPPD), which is used to detect incoming connections and to shut down active PPP links when a connection terminates.
<DD><B>•</B> The <TT>getty</TT> program, which handles modem communications intelligently. This chapter gives an overview of the format of the file, <TT>/etc/gettydefs</TT>, used to handle logon process for a dial-up user.
</DL>
<P>These programs are available on every Red Hat Linux installation.
</P>
<P>The process in which a user establishes a PPP link is as follows:</P>
<DL>
<DD><B>1.</B> The phone number of the modem connected to the Linux system (the PPP server) is dialed from a remote host (the PPP client).
<BR>The user logs on to the server with a valid username and password.
<DD><B>2.</B> At the shell prompt, the user issues the following command to start PPP on the server:
<!-- CODE SNIP //-->
<PRE>
exec /usr/sbin/pppd ñdetach
</PRE>
<!-- END CODE SNIP //-->
<DD><B>3.</B> The user starts PPP on the client.
</DL>
<H4 ALIGN="LEFT"><A NAME="Heading16"></A><FONT COLOR="#000077">Setting Up the PPP Options Files</FONT></H4>
<P>Two files must be present to grant PPP access to a Linux system. The first file, <TT>/etc/ppp/options</TT>, contains the common PPP options required for modem connections. These options are listed one per line in the file as shown here:</P>
<!-- CODE SNIP //-->
<PRE>
asyncmap 0
netmask 255.255.255.0
proxyarp
lock
crtscts
modem
</PRE>
<!-- END CODE SNIP //-->
<P>The line for <TT>netmask</TT> should be modified to be the netmask for your Linux system’s IP address.</P>
<P>The second file that must be created is the <TT>/etc/ppp/options.tty01</TT> file. This file contains a list of IP addresses or hostnames and the PPP interfaces with which they are associated. For example, if the <TT>/etc/ppp/options.tty01</TT> file contained the following line</P>
<!-- CODE SNIP //-->
<PRE>
srv-ss2:ppp0
</PRE>
<!-- END CODE SNIP //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="455-460.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="463-465.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?