?? unx37.htm
字號(hào):
#
# The loopback network is used only for intra-machine communication
#
loopback 127
#
# Internet networks
#
arpanet 10 arpa # Historical
subnet 190.109.252
subnet-seg1 190.109.252.32
subnet-seg2 190.109.252.64</PRE>
<H4 ALIGN="CENTER">
<CENTER><A ID="I38" NAME="I38">
<FONT SIZE=3><B>Choosing the Netmask for a Network—</B><B><I>/etc/netmasks</I></B>
<BR></FONT></A></CENTER></H4>
<P>Normally when a netmask is needed, the IP system looks at the address class and chooses a netmask that matches the class of the address. However, as in the subnetting example, often a different netmask is needed. These exceptions to the rule are listed
in the netmasks file as shown in this example:
<BR></P>
<PRE>#
# The netmasks file associates Internet Protocol (IP) address
# masks with IP network numbers.
#
# network-number netmask
#
# Both the network-number and the netmasks are specified in
# "decimal dot" notation, e.g:
#
# 128.32.0.0 255.255.255.0
#
190.109.252.0 255.255.255.0
190.109.252.32 255.255.255.224
190.109.252.64 255.255.255.224</PRE>
<P>A command that needs a netmask can either take the netmask as an override on the command line or consult the netmasks file to determine if there is a specific netmask before resorting to calculating one based on the class of the address.
<BR></P>
<H4 ALIGN="CENTER">
<CENTER><A ID="I39" NAME="I39">
<FONT SIZE=3><B>Mapping Names to Machines—</B><B><I>/etc/ethers</I></B>
<BR></FONT></A></CENTER></H4>
<P>BOOTP and RARP need a file to map EtherNet addresses into IP numbers. This is provided by the ethers file, which maps the EtherNet MAC address into a hostname. Then the hosts file is used to map this into an IP address.
<BR></P>
<PRE>#
# The ethers file associates ethernet addresses with hostnames
#
08:00:20:0e:b9:d3 gateway
08:00:20:11:30:d0 sn1-router
08:00:20:0e:1d:0b sn1-gateway
08:00:20:0b:de:0d sn1-host</PRE>
<P>By placing the IP address in only the hosts file and making use of RARP for assigning network numbers, it is possible to readdress an entire network just by changing the hosts file and rebooting the machines. This makes changes very convenient.
<BR></P>
<H4 ALIGN="CENTER">
<CENTER><A ID="I40" NAME="I40">
<FONT SIZE=3><B>Mapping Names to Interfaces—</B><B><I>/etc/hostname.</I></B><B>??n</B>
<BR></FONT></A></CENTER></H4>
<P>Many UNIX systems have more than one network interface. Each network interface on a host has its own IP address. Because a node name can appear only once in the /etc/hosts file, each interface also has its own node name. So the node, on boot, still
needs to know which name, and therefore which IP address, to use on which network interface.
<BR></P>
<P>This is provided by the file /etc/hostname.<I>??n</I> where <I>??</I> is the name of the interface type, and <I>n</I> is a digit referring to the interface number. On Suns this is usually /etc/hostname.le0 for the first interface, /etc/hostname.le1 for
the second, and so on.
<BR></P>
<P>This file contains just one line with one word on that line, the hostname to use for that particular interface:
<BR></P>
<PRE>fasthost</PRE>
<H5 ALIGN="CENTER">
<CENTER><A ID="I41" NAME="I41">
<FONT SIZE=3><B>Naming Supported Protocols—</B><B><I>/etc/protocols</I></B>
<BR></FONT></A></CENTER></H5>
<P>To enable the diagnostic output of the utilities to list the protocols by name rather than by protocol number, a mapping is kept in the file /etc/protocols. This file is provided by the vendor and should not need changing. Not all the protocols listed
in this file are necessarily supported on your system. An example of the contents of /etc/protocols is as follows:
<BR></P>
<PRE>#
# Internet (IP) protocols
#
ip 0 IP # internet protocol, pseudo protocol number
icmp 1 ICMP # internet control message protocol
ggp 3 GGP # gateway-gateway protocol
tcp 6 TCP # transmission control protocol
egp 8 EGP # exterior gateway protocol
pup 12 PUP # PARC universal packet protocol
udp 17 UDP # user datagram protocol
hmp 20 HMP # host monitoring protocol
xns-idp 22 XNS-IDP # Xerox NS IDP
rdp 27 RDP # "reliable datagram" protocol</PRE>
<H5 ALIGN="CENTER">
<CENTER><A ID="I42" NAME="I42">
<FONT SIZE=3><B>Naming Supported Services—</B><B><I>/etc/services</I></B>
<BR></FONT></A></CENTER></H5>
<P>Programs that wish to connect to a specific port use the services file to map the service name to the port number. This file is shipped from your vendor with all the default services in it. Local services can be added to support databases or any local
extensions desired. The file is large, so the following example is only a small extract. Remember that ports smaller than 1024 are privileged and can only be listened on by processes owned by root.
<BR></P>
<PRE>#
# Network services, Internet style
# This file is never consulted when the NIS are running
#
tcpmux 1/tcp # rfc-1078
echo 7/tcp
echo 7/udp
discard 9/tcp sink null
discard 9/udp sink null
systat 11/tcp users
daytime 13/tcp
daytime 13/udp
netstat 15/tcp
chargen 19/tcp ttytst source
chargen 19/udp ttytst source
ftp-data 20/tcp
ftp 21/tcp
telnet 23/tcp
smtp 25/tcp mail
time 37/tcp timserver
time 37/udp timserver
name 42/udp nameserver
whois 43/tcp nicname # usually to sri-nic
domain 53/udp
domain 53/tcp
hostnames 101/tcp hostname # usually to sri-nic
sunrpc 111/udp
sunrpc 111/tcp
ident 113/tcp auth tap
#
# Host specific functions
#
bootps 67/udp # bootp server
bootpc 68/udp # bootp client
tftp 69/udp
rje 77/tcp
finger 79/tcp
link 87/tcp ttylink
supdup 95/tcp
iso-tsap 102/tcp
x400 103/tcp # ISO Mail
x400-snd 104/tcp
csnet-ns 105/tcp
pop-2 109/tcp # Post Office
auth 113/tcp
uucp-path 117/tcp
nntp 119/tcp usenet # Network News Transfer
ntp 123/tcp # Network Time Protocol
ntp 123/udp # Network Time Protocol
snmp 161/udp
#
# UNIX specific services
#
# these are NOT officially assigned
#
exec 512/tcp
login 513/tcp
shell 514/tcp cmd # no passwords used
printer 515/tcp spooler # line printer spooler
courier 530/tcp rpc # experimental
uucp 540/tcp uucpd # uucp daemon
biff 512/udp comsat
who 513/udp whod
syslog 514/udp
talk 517/udp
ntalk 518/udp
route 520/udp router routed
timed 525/udp timeserver
new-rwho 550/udp new-who # experimental
rmonitor 560/udp rmonitord # experimental
monitor 561/udp # experimental
pcserver 600/tcp # ECD Integrated PC board srvr
kerberos 750/udp kdc # Kerberos key server
kerberos 750/tcp kdc # Kerberos key server</PRE>
<P>The format of the file is the name of the service followed by white space, then the port number, followed by a / and the protocol (either TCP or UDP). This is optionally followed by nicknames for the service. If a service is available both under UDP and
TCP it must be listed twice in the file, once for UDP and once for TCP.
<BR></P>
<H5 ALIGN="CENTER">
<CENTER><A ID="I43" NAME="I43">
<FONT SIZE=3><B>Binding Daemons to Services—</B><B><I>/etc/inetd.conf</I></B>
<BR></FONT></A></CENTER></H5>
<P>Rather than having each task listen for connections on its own ports, UNIX uses a common daemon to listen on many ports at once. This is the Internet services daemon or inetd. It listens on every port listed in its configuration file. When it receives a
connection it forks off and starts the appropriate service daemon. Some services are handled internally by inetd, including daytime and echo.
<BR></P>
<P>When you change the inetd.conf file you need to signal the daemon to reread the file. Sending inetd the HUP signal causes it to reread the file. HUP is the signal 1 so you can use the following commands to have inetd reread the /etc/inetd.conf file:
<BR></P>
<PRE>kill -HUP <I>pid</I></PRE>
<P>Alternatively, you can enter this:
<BR></P>
<PRE>kill -1 <I>pid</I></PRE>
<P>In these commands <I>pid</I> is replaced by the <I>pid</I> of the inetd process, which will cause inetd to reread its configuration file. The following is a small sample of the file to show the format:
<BR></P>
<PRE>#
# Configuration file for inetd(1M). See inetd.conf(4).
#
# To re-configure the running inetd process, edit this file, then
# send the inetd process a SIGHUP.
#
# Syntax for socket-based Internet services:
# <service_name> <socket_type> <proto> <flags> <user> <server_pathname> <args>
#
# Syntax for TLI-based Internet services:
#
# <service_name> tli <proto> <flags> <user> <server_pathname> <args>
#
# Ftp and telnet are standard Internet services.
#
ftp stream tcp nowait root /etc/in.tcpd in.ftpd
telnet stream tcp nowait root /etc/in.tcpd in.telnetd
#
# Shell, login, exec, comsat and talk are BSD protocols.
#
shell stream tcp nowait root /etc/in.tcpd in.rshd
login stream tcp nowait root /etc/in.tcpd in.rlogind
#
#
# RPC services syntax:
# <rpc_prog>/<vers> <endpoint-type> rpc/<proto> <flags> <user> \
# <pathname> <args>
#
# <endpoint-type> can be either "tli" or "stream" or "dgram".
# For "stream" and "dgram" assume that the endpoint is a socket descriptor.
# <proto> can be either a nettype or a netid or a "*". The value is
# first treated as a nettype. If it is not a valid nettype then it is
# treated as a netid. The "*" is a short-hand way of saying all the
# transports supported by this system, ie. it equates to the "visible"
# nettype. The syntax for <proto> is:
# *|<nettype|netid>|<nettype|netid>{[,<nettype|netid>]}
# For example:
# dummy/1 tli rpc/circuit_v,udp wait root /tmp/test_svc test_svc
#
# System and network administration class agent server
#
# This is referenced by number because the admind agent is needed for the
# initial installation of the system. However, on some preinstalled systems
# the SNAG packages may not be present. Referencing the service by number
# prevents error messages in this case.
#
100087/10 tli rpc/udp wait root /usr/sbin/admind admind</PRE>
<H5 ALIGN="CENTER">
<CENTER><A ID="I44" NAME="I44">
<FONT SIZE=3><B
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -