Chapter 1 Network Address and Mask 1. /etc/hostname.Interface
Interface is the model of the NIC, there is Le, HME, etc. Le is the terminal card, HME is 100M network card, etc. The back is followed by a number, the first terminal is Le0, the second is Le1; the second 100 megaphore network card is HME0, the second is HME1, etc. The content of the file is the name of this network card, such as Sunrise, Sunny. #More /etc/hostname.le0 Sunrise # more /etc/hostname.hme0 sunny
2. / etc / hosts file
System name and IP address mapping with /etc/hostname.interface work together, configuring this unit network card address # more / etc / hosts 127.0.0.1 localhost loghost 172.18.255.1 sunrise 172.18.255.1 sunrise 172.18.255.1 sunrise 172.18.255.1 sunrise
The system name is not a machine name, the machine name is unique, to change the machine name, with the command: hostname. With /tc/hostname.interface and / etc / hosts two files, the system knows how to configure the NIC, such as the first Baigue network name is Sunny, its corresponding address is 172.18.255.1.
3. / etc / netmasks file
To connect the IP address of the network with the network address, you do not need to configure if you are a standard network segment.
Standard network segment: A Category A network: 0-127 (127 for local address) mask: 255..0.0.0 B network: 128-191 mask: 255.255.0.0 C network: 192-223 mask: 255.255.255.0 D network: 224-254 (used for multicast broadcast)
To match a Class B address: 172.16.255.1 Mask is: 255.255.255.0, then write in / etc / netmasks file: 172.16.255.0 255.255.255.0
4. ifconfig command
Detection Network Port Status #ifconfig -A Configuring Network Port Address #ifconfig Le0 172.16.255.1 Netmask 255.255.255.0 Configuring Network Port Status #ifconfig Le0 Up / Down Configuring Network Port Whether #ifconfig Le0 Plumb / Unplumb
5. ping command
Detect network status test network speed
Chapter II Network Service
1. / etc / service file
Network Service Protocol's port number network protocol service type
#CAT / ETC / INET / SERVICES FTP-DATA 20 / TCP FTP 21 / TCP Telnet 23 / TCP SMTP 25 / TCP Mail SunRPC 111 / UDP RPCBIND SUNRPC 111 / TCP RPCBIND ...
Each TCP / IP application layer service such as (ftp, telnet) has a port number in the transport layer. The / etc / service file contains a static port number corresponding to each recognized service protocol. Applications should use uniquely assigned port numbers to identify themselves to the transmission provider and remote peer entity. Each of the files is composed of a service name and its associated port number, and the transfer protocol provider. Some services can run on TCP and UDP. At this time, this service is listed twice.
2. /etc/inetd.conf file
# cat /etc/inet/inetd.conf ftp stream tcp noait root /usr/sbin/in.ftpd in.ftpd telnet stream TCP NOWAIT ROOT /USR/SBIN/IN.TELNETD in.telnetd login stream TCP NOWAIT ROOT / USR / sbin / in .rlogind in. rogind Talk Dgram udp wait root /usr/sbin/in.talkd in.talkd ... UNIX is not letting each service daemon waits for requests on their port, but will represent Each service daemon is waiting for the requested task to hand over a service process called inetd. This will greatly reduce the occupation of system resources. Only when the super service process discovers a service request, it calls the service's daemon. The /etc/inetd.conf configuration file allows INETD to determine which services that will repay it will represent service requests when starting. If a service's daemon is not included in the inetd.conf file, the request is discarded when inetd receives the service's request. File field: service_name This is the flag of the service listed in the file / etc / service. Socket_type is used to mark the type of data transfer service used. The Proto identifies the name of the transfer protocol. It is UPD and TCP Flags that can be set to "Wait" and "Non-Waiting". If set to "Wait" state, inetd is waiting for service protocol to release it to the network when restoring other requests on the listening port. "Non-Waiting" can make inetd immediately listen to other requests. Most TCP protocols use "non-waiting" way, and UDP uses "waiting" way. User represents the username of the call service. Server_pathname indicates the full path name of the service program that Inetd must call when responding to the relevant service request. ARGS This domain includes the command line parameters used by the service. That is, the program name is started, and then follow the user setting parameters.
Chapter III Routing and Gateway
1. / etc / defaulrouter file
Configuring the default gateway to prevent unnecessary routing processes for only one router to communicate with other network segments Single route to occupy smaller routing table resources
This file saves the default route information. There is no file when the system is installed, which is created by the user. The content of the file is the user's address of the default route. #Cat / etc / defaultrouter 172.16.255.254
Advantages: There are fewer resources, only one routing entry.
2. / etc / gateways file
Routing table file NET Gateway Metric Dest. NET Target Web Router's address of the next hop router COUNT hops
3. Route command
Route Add | delete [Host | Net] destination [Gateway] Add a Route #Route Add Net 128.50.3.0 192.168.1.1 1 Delete A Route #Route Delete Net 128.50.2.0 192.168.12.2
4. View routing table
# NetStat -r Routing Table: Destination Gateway Flags Ref Use Interface -------------------- ----- --- --- ----- ---- Localhost Localhost UH 0 2272 LO0 202.96.0.0 192.168.12.1 U3 562 Le0 10.103.0.0 192.168.12.2 U 3 562 Le0 # destination target network or host Gateway forwarding packet host Flags this route status, this The parameter has several options: U port is active (UP) H target is a host, not the number of routing entries with network segment REF, using this route number, for localhost, this The number represents all the received packets Internet interfaces
Chapter 4 DNS Client Settings
1. /etc/resolv.conf file
Record the address of the DNS server and domain Name Keywords: DomainName Nameserver # more /etc/resolv.conf nameserver 172.16.255.3 DomainName Sunrise.com.cn
2. /etc/nsswitch.conf file
Record the search order of the host name and other information. Otherwise It Does Not Use Any Other Naming Service. # "HOSTS:" AND "Services:" in this file area "-" for nametoaddr_libs of "inet" transports.
Passwd: Files Group: Files # you must also set up the /etc/resolv.conf file for dns name # server lookup. See resolv.conf (4). Hosts: Files DNS ipnodes: FILES ...
Configure the HOSTS record of this file to Hosts: Files DNS
3. nslookup command
Used to query DNS servers for verifying client settings for downloading DNS databases
# nslookup default server: ns.zjhzptt.net.cn address: 202.96.96.68
> www.sun.com server: ns.zjhzptt.net.cn address: 202.96.96.68
Non-Authoritative Answer: Name: www.sun.com address: 192.18.97.241
> When startup, NSlookup is default the local server. The name and address of the target server are included in the response. > Is a prompt, which means you can start sending a name service query or configuration