lsg32.htm

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTM 代码 · 共 3,863 行 · 第 1/4 页

HTM
3,863
字号




<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Use this argument to enable Address Resolution Protocol to detect physical address on network machines. This argument is set to on by default.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-arp







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This argument disables ARP. It sets characteristic flag NOARP.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







broadcast







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Followed by the broadcast address of the network, this argument sets the address used to address all machines on the network. This argument is used if the broadcast address is different than the normal address calculated by TCP/IP based on the Class type of the network.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







down







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This argument makes the interface unusable by the IP software until taken up again.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







metric







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This argument sets the metric value for the interface. Although Linux doesn't use this argument, it is included for compatibility with older TCP/IP implementations.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







mtu







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Followed by a value in bytes, this argument sets the Maximum Transmission Unit size (the number of octets the interface can handle in one datagram). System defaults are usually accurate. (Ethernet defaults to 1500, SLIP to 296.)</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







netmask







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Followed by a mask value, this argument sets the subnet mask.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







pointopoint







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This argument is used for point-to-point IP (PLIP) interfaces connecting two machines through the parallel port</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







promisc







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This argument sets the interface to promiscuous mode (receives all packets, whether they're for that machine's IP address or not). Used for analyzing network traffic, this argument sets the characteristic flag PROMISC.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-promisc







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







This argument turns off promiscuous mode.</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







up







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Implied when an address is given, the up argument makes the interface available to the IP software. When active, the interface has the characteristics of UP and RUNNING.</FONT>







</TABLE><P>You can use most of these arguments when you use the ifconfig command, although most are not necessary for a well-configured network.







<BR>







<BR>







<A NAME="E68E180"></A>







<H3 ALIGN=CENTER>







<CENTER>







<FONT SIZE=5 COLOR="#FF0000"><B>The inetd Daemon</B></FONT></CENTER></H3>







<BR>







<P>When a networked Linux machine is started, it activates TCP/IP and immediately accepts connections at its ports, spawning a process for each. To control the processes better, the inetd program was developed to handle the port connections itself, offloading that task from the server. The primary difference is that inetd creates a process for each connection that is established, whereas the server would create a process for each port (which leads to many unused processes). On many systems, some of the test programs and status information utilities are run through inetd.







<BR>







<P>The inetd program uses the configuration file /etc/inetd.conf. The following code is an extract of a sample /etc/inetd.conf file. The first column shows the service name (which corresponds to an entry in the services file such as /etc/services), the socket type (stream, raw, or datagram), protocol name, whether inetd can accept further connections at the same port immediately (nowait) or must wait for the server to finish (wait), the login that owns the service, the server program name, and any optional parameters needed for the server program.







<BR>







<PRE>







<FONT COLOR="#000080">#inetd.conf







ftp stream tcp nowait NOLUID /etc/ftpd ftpd







telnet stream tcp nowait NOLUID /etc/telnetd telnetd







shell stream tcp nowait NOLUID /etc/rshd rshd







login stream tcp nowait NOLUID /etc/rlogind rlogind







exec stream tcp nowait NOLUID /etc/rexecd rexecd







finger stream tcp nowait nouser /etc/fingerd fingerd







comsat dgram udp wait root /etc/comsat comsat







ntalk dgram udp wait root /etc/talkd talkd







echo stream tcp nowait root internal







discard stream tcp nowait root internal







chargen stream tcp nowait root internal







daytime stream tcp nowait root internal







time stream tcp nowait root internal







echo dgram udp wait root internal







discard dgram udp wait root internal







chargen dgram udp wait root internal







daytime dgram udp wait root internal







time dgram udp wait root internal</FONT></PRE>







<P>The actual /etc/inetd.conf file may be much longer, but the extract above shows the general format of the file. The /etc/inetd.conf file is read when the server is booted and every time a hangup signal is received from an application. This allows dynamic changes to the file, as any modifications would be read and registered on the next file read.







<BR>







<BR>







<A NAME="E68E181"></A>







<H3 ALIGN=CENTER>







<CENTER>







<FONT SIZE=5 COLOR="#FF0000"><B>The netstat Command</B></FONT></CENTER></H3>







<BR>







<P>The netstat program provides comprehensive information about the local system and its TCP/IP system. Administrators commonly use this program to quickly diagnose a problem with TCP/IP. Although netstat's format and specific information differ with the version of Linux, netstat usually supplies the following important summaries, each of which is covered in more detail later:







<BR>







<UL>







<LI>Communications end points







<BR>







<BR>







<LI>Network interface statistics







<BR>







<BR>







<LI>Routing table information







<BR>







<BR>







<LI>Protocol statistics







<BR>







<BR>







</UL>







<P>With some later versions, information about the interprocess communications and other protocol stacks may be appended as well. The information to be displayed can usually be toggled with a command line option. The following are valid options for most versions of netstat are:







<BR>















<TABLE  BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-a







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displayd information about all interfaces</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-c







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays continuously, updating every few seconds</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-i







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays information about the interfaces</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-n







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays IP addresses instead of symbolic names</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-o







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays additional information about timer states, expiration times, and backoff times</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-r







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays information about the kernel routing table</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-t







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays information about TCP sockets only</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-u







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays information about UDP sockets only</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-v







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays version information</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-w







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays information about raw sockets only</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-x







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Displays information about sockets</FONT>







</TABLE><P>The output from a typical Linux installation that uses the netstat command is shown in the next few sections, which discuss netstat and its output in more detail. As already mentioned, the output and meaning may be different with other versions, but the general purpose of the diagnostic tool remains the same.







<BR>







<BR>







<A NAME="E69E210"></A>







<H4 ALIGN=CENTER>







<CENTER>







<FONT SIZE=4 COLOR="#FF0000"><B>Communications End Points</B></FONT></CENTER></H4>







<BR>







<P>The netstat command with no options provides information on all active communications end points. To display information about a particular type of end point, use the letter of the type from the following list:







<BR>















<TABLE  BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 WIDTH="100%" CELLPADDING=2 >







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-a







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







All connections</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-t







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







TCP connections only</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-u







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







UDP connections only</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-w







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







RAW connections only</FONT>







<TR>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







-x







</FONT>







<TD VALIGN=top  BGCOLOR=#80FFFF ><FONT COLOR=#000080>







Socket connections only</FONT>







</TABLE><P>To display all end points that are waiting for a connection (in addition to the sockets specified by one of the above flags), netstat uses the -a option. The -a option by itself will display all sockets.







<BR>







<P>The output is formatted into columns showing the protocol (Proto), the amount of data in the receive and send queues (Recv-Q and Send-Q), the local and remote addresses, and the current state of the connection. The following is a truncated sample output:







<BR>







<PRE>







<FONT COLOR="#000080">$ netstat -ta







Active Internet connections (including servers)







Proto Recv-Q Send-Q Local Address Foreign Address (state)







ip 0 0 *.* *.*







tcp 0 2124 tpci.login merlin.1034 ESTABL.







tcp 0 0 tpci.1034 prudie.login ESTABL.







⌨️ 快捷键说明

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