Common linux network configurations and operations

Source: Internet
Author: User
Tags domain name server nslookup nslookup command

Common Parameters for linux network configuration and ifconfigifconfig are described as follows: -a: view the status of all NICs-V: view the version information of the ifconfig command-s: view the statistical information. Example: Set the IP address of the first Nic to 192.168.0.1ifconfig eth0 192.168.0.1: ifconfig network device name IP address www.2cto.com temporarily disabled or enable Nic disable the first Nic ifconfig eth0 down enable the first Nic ifconfig eth0 up set the subnet mask of the first Nic to 255.255.255.0 ifconfig eth0 netmask 255.255.255.0 format: ifconfig network device name netmask subnet mask www.2cto.com we can also set the IP address and subnet mask ifconfig eth0 192.168.0.1 n Etmask 255.255.255.0 view the status of the first Nic ifconfig eth0 if you want to view the status of all NICs, you can directly use the ifconfig command without parameters to output the status information of ifconfig. Below we will briefly describe several important statuses: whether the UP/DOWN Nic is enabled. If it is DOWN, the number of errors packets in the RX packets cannot be used. If the number of errors packets in the TX packets is too large, the number of errors packets in the NIC is too large. the common netstatnetstat parameters are described as follows: -a: All sockets, including the-c being monitored, are re-displayed every one second until the user interrupts it.-I: The information format of all network interfaces is the same as that of "ifconfig-e"-n. use the network IP address instead of the name to display the network connection situation-r shows the core route table format is the same as "route-e"-t shows T CP connection status-u display UDP connection status-v display ongoing work the function of the www.2cto.com nslookupnslookup command is to query the IP address of a machine and its corresponding domain name. A Domain Name Server provides domain name services. If you have set a Domain Name Server, you can use this command to view the domain name commands corresponding to the IP addresses of different hosts. Syntax: nslookup [IP Address/domain name] example: Execute the nslookup command on the local machine Default Server: name.tlc.com.cn Address: 192.168.1.99> enter the IP address or domain name to be queried after the symbol> and press Enter. If you want to exit the command, enter exit and press Enter. Then, the function of the host command is similar to that of the nslookup command. host [Option] [IP Address/Domain Name/host name] common parameters of host are as follows: "-a shows the domain name or IP address domain to be queried. Example of information about the name or Host Name: [root] # host hahaha.com has address 192.168.1.21 fingerfinger command is used to query user information. Generally, the user name in the system is displayed. If you want to query information such as the user name home directory, the logon time, Logon Time, and shell user Information on the remote machine, the @ host name must be followed by the user name. The [user name @ host name] format is used. However, the network host to be queried must run the finger daemon. The command format is as follows: finger [Option] [user] [user @ host] common finger parameters are as follows: -s: displays the user's registration name, actual name, terminal name, write status, stagnation time, Logon Time, and other information-l in addition to the information displayed using the-s option, it also displays the user's main directory, logon shell, mail status, and other information. the. plan. project and. the contents of the forward File www.2cto.com-p Display. plan file and. in the same example as the-l option except the project file, the user orcale information is displayed in finger oracle. The result is Login: oracle Name: (null) Directory:/home/oracle Shell: /bin/bash On since Fri Feb 6 (CST) on pts/1 from 10.153.21.166 33 seconds idle On since Wed Feb 4 (CST) on pts/2 from 10.153.21.166 1 second idle No mail. no Plan. the Ping command is used to check whether the host on the network is working. It sends an ICMP ECHO_REQUEST packet to the host. If you want to download files from a host on the network, but you do not know whether the host is on, you need to run the ping command to check that the general format of this command is ping [Option] [host name/IP Address] ping common parameters are as follows: -c number: after sending a specified number of packets, stop-d: Set SO_DEBUG option-f: Send network packets to a machine quickly to view its response-I: Set the interval of seconds to send a network packet to a machine, the default value is to send the packet once a second-l the number of times the data is sent to the specified machine in the fastest way within a specified number of times. Only super users can use this option: -q: no packet transmission information is displayed. Only the final result is displayed.-r Directly sends packets to a machine without going through the gateway. Generally, it is used to check whether the network interface of the local machine is faulty-the number of bytes. specifies the number of data bytes sent. The default value is 56, add an 8-byte ICMP header, which is a total of 64ICMP Data byte www.2cto.com common network configuration file introduction in Linux, TCP/IP network is through several texts File configuration, You need to edit these files to complete the networking work. the important network configuration files in the system are:/etc/sysconfig/network/etc/hosts/etc/services/etc/host. conf/etc/nsswitch. conf/etc/resolv. conf/etc/xinetd. conf/etc/modules. the conf/etc/sysconfig/network-scripts/ifcfg-ethN df command is used to view the status information of the Linux File System. information such as the unused capacity and mount points of each partition is displayed, for example: df-k displays information about each partition in kilobytes of KB. df-a displays all partitions, including partitions with a size of 0. df-T displays the partition type (EXT2 or EXT3) and other du commands: used to view the size of a file or folder, for example, du-B/home displays each sub-file in the/home folder in bytes. The folder size du-ks home is displayed in kilobytes of KB. The top command of the total size of the folder in/home is used to view system status information in real time. After running this command, the following information is displayed on the screen: CPU status CPU states includes user process occupation rate system process occupation rate user nice priority process occupation rate and idle CPU resource ratio memory status Mem includes total memory/usage/idle volume and other SWAP partitions the status Swap includes the total number of Swap partitions, usage, idle amount, and other statuses of each process, including the process ID, user name, priority, CPU and memory usage, and the command line that runs the top command when the process is running. the system will automatically refresh the status information once every five seconds. If you want to specify the refresh interval and add the-d parameter at startup, you can start top at www.2cto.com, for example, top-d 5, in addition, after refreshing every 5 seconds and entering the top, press the following button to have the corresponding function: space to immediately refresh the display information M sort by memory usage N sort by process ID P sort by CPU usage c Extend Command Line Information Display complete command line? Display help information q exit top program iostat command statistics and output CPU usage information and specific device or partition IO information iostat-c Only Display CPU usage statistics iostat-d only display device/ partition usage statistics iostat-d 2 device/partition usage statistics, the IO statistics displayed every two seconds are refreshed as follows: number of IO transfer requests received by tps devices per second Blk_read/s number of blocks read by Blk_wrtn/s devices per second total number of blocks read by Blk_read devices Blk_wrtn total number of blocks written by devices Blk_wrtn the CPU statistics displayed by quantity are the same as those of top files and files: the find command is used to find the specified file in the file system. The command format is find. -name 1.txt: Search for the current directory and Its subdirectories File 1.txt find/tmp-name 1.txt find file in/tmpdirectory and its subdirectory find file 1.txt file content SEARCH Command grep command is used to find the specified pattern matching format grep [Command Option] matching mode to be searched [file to be searched] For example, grep cams test.txt searches for the cams string grep-r cams/root/cams in the/root/cams directory and all the files in its subdirectories in the test.txt file. In addition to searching the file can also redirect any output stream to grep for search. For example, ps-ef | grep ora searches for all processes whose names contain "ora ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.