[ Pobierz całość w formacie PDF ]
.Routeis used to create and modify entries in the routing table.For most configurations, anrc.inet1file that looks like the following should work.You will, of course, have to edit this for your own system.Do not use the sample IP andnetwork addresses listed here for your own system; they correspond to an actual machineon the Internet.#!/bin/sh# This is /etc/rc.d/rc.inet1 -- Configure the TCP/IP interfaces# First, configure the loopback device 256 Advanced FeaturesHOSTNAME= host name/etc/ifconfig lo 127.1 # uses default netmask 255.0/etc/route add 127.1 # a route to point to the loopback device# Next, configure the ethernet device.If you re only using loopback or# SLIP, comment out the rest of these lines.# Edit for your setup.IPADDR="128.253.154.32" # REPLACE with YOUR IP addressNETMASK="255.255.255.0" # REPLACE with YOUR netmaskNETWORK="128.253.154.0" # REPLACE with YOUR network addressBROADCAST="128.253.154.255" # REPLACE with YOUR broadcast address, if you# have one.If not, leave blank and edit below.GATEWAY="128.253.154.1" # REPLACE with YOUR gateway address!/etc/ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}# If you don t have a broadcast address, change the above line to just:# /etc/ifconfig eth0 ${IPADDR} netmask ${NETMASK}/etc/route add ${NETWORK}# The following is only necessary if you have a gateway; that is, your# network is connected to the outside world./etc/route add default gw ${GATEWAY} metric 1# End of Ethernet ConfigurationAgain, you may have to tweak this file somewhat to get it to work.The above shouldbe sufficient for the majority of simple network configurations, but certainly not all.rc.inet2starts up various servers used by the TCP/IP suite.The most important ofthese isinetd.Inetdsits in the background and listens to various network ports.Whena machine tries to make a connection to a certain port (for example, the incomingtelnetport), inetdforks off a copy of the appropriate daemon for that port (in the case of thetelnetport,inetdstartsin.telnetd).This is simpler than running many separate,standalone daemons (e.g., individual copies oftelnetd, ftpd, and so forth) inetdstarts up the daemons only when they are needed.Syslogd is the system logging daemon it accumulates log messages from vari- TCP/IP Networking 257ous applications and stores them into log files based on the configuration information in/etc/syslogd.conf.routed is a server used to maintain dynamic routing infor-mation.When your system attempts to send packets to another network, it may requireadditional routing table entries in order to do so.routedtakes care of manipulating therouting table without the need for user intervention.Our example rc.inet2, below, only starts up the bare minimum of servers.Thereare many other servers as well many of which have to do with NFS configuration.Whenattempting to setup TCP/IP on your system, it s usually best to start with a minimal config-uration and add more complex pieces (such as NFS) when you have things working.Note that in the below file, we assume that all of the network daemons are held in/etc.As usual, edit this for your own configuration.#! /bin/sh# Sample /etc/rc.d/rc.inet2# Start syslogdif [ -f /etc/syslogd ]then/etc/syslogdfi# Start inetdif [ -f /etc/inetd ]then/etc/inetdfi# Start routedif [ -f /etc/routed ]then/etc/routed -qfi# Done!Among the various additional servers that you may want to start in rc.inet2 isnamed.Namedis a name server it is responsible for translating (local) IP addresses tonames, and vice versa.If you don t have a name server elsewhere on the network, or wantto provide local machine names to other machines in your domain, it may be necessary to 258 Advanced Featuresrunnamed.(For most configurations it is not necessary, however.) Namedconfigurationis somewhat complex and requires planning; we refer interested readers to a good book onTCP/IP network administration.The /etc/hosts file./etc/hosts contains a list of IP addresses and the hostnames that they correspond to.In general, /etc/hostsonly contains entries for yourlocal machine, and perhaps other  important machines (such as your name server or gate-way).Your local name server will provide address-to-name mappings for other machineson the network, transparently.For example, if your machine is loomer.vpizza.com with the IP address128.253.154.32, your/etc/hostswould look like:127.1 localhost128.253.154.32 loomer.vpizza.com loomerIf you re only using loopback, the only line in/etc/hostsshould be for 127.1, withbothlocalhostand your host name after it.The /etc/networks file.The /etc/networks file lists the names and ad-dresses of your own, and other, networks.It is used by theroutecommand, and allowsyou to specify a network by name, should you so desire.Every network you wish to add a route to using theroutecommand (generally calledfromrc.inet1 see above) must have an entry in/etc/networks.As an example,default 0.0 # default route - mandatoryloopnet 127.0 # loopback network - mandatorymynet 128.253.154.0 # Modify for your own network addressThe /etc/host.conffile.This file is used to specify how your system will re-solve host names.It should contain the two lines:order hosts,bindmulti onThese lines tell the resolve libraries to first check the/etc/hostsfile for any names tolookup, and then to ask the name server (if one is present).The multientry allows youto have multiple IP addresses for a given machine name in/etc/hosts. TCP/IP Networking 259The /etc/resolv.conffile.This file configures the name resolver, specifyingthe address of your name server (if any) and your domain name.Your domain name is yourfully-qualified host name (if you re a registered machine on the Internet, for example), withthe host name chopped off.That is, if your full host name isloomer.vpizza.com, yourdomain name is justvpizza.com.For example, if your machine is goober.norelco.com, and has a name server atthe address 128.253.154.5, your/etc/resolv.confwould look like:domain norelco.comnameserver 127.253.154.5You can specify more than one name server each must have anameserverline of itsown inresolv.conf.Setting your host name.You should set your system host name with thehostnamecommand.This is usually called from /etc/rc or /etc/rc.local; simply searchyour system rc files to determine where it is invoked.For example, if your (full) hostname isloomer.vpizza.com, edit the appropriatercfile to execute the command:/bin/hostname loomer.vpizza.comNote that thehostnameexecutable may not be found in/binon your system.Trying it out.Once you have all of these files set up, you should be able to rebootyour new kernel and attempt to use the network.There are many places where things cango wrong, so it s a good idea to test individual aspects of the network configuration (e.g.,it s probably not a good idea to test your network configuration by firing up Mosaic over anetwork-based X connection).You can use thenetstatcommand to display your routing tables; this is usually thesource of the most trouble.The netstat man page describes the exact syntax of thiscommand in detail.In order to test network connectivity, we suggest using a client suchastelnetto connect to machines both on your local subnetwork and external networks.This will help to narrow down the source of the problem [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • hanula1950.keep.pl