Common linux network configurations and operations

Source: Internet
Author: User
Tags 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.1ifcon... common network configurations and operations for ifconfigifconfig in linux parameters 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 netmask 255.255.255.255.0 to 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 listeners, are displayed. -C is re-displayed every 1 second until the user interrupts it.-I displays the information of all network interfaces in the same format as "ifconfig-e"-n. It is displayed with the network IP address instead of the name. network connection situation-r shows the format of the core route table in the same way as "route-e"-t shows TCP connections-u shows UDP connections-v shows ongoing work www.2cto.com nslookupnslookup the function of the command is to query the IP address of a machine and its corresponding domain name. it usually requires a domain name server to provide domain name service. if the user has set a domain name server, he can use this command to view different hosts. the syntax of the domain name command corresponding to the IP address of is: nslookup [IP Address/domain name] Example: run 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 symbol> and press enter. If you want to exit the command, enter exit and press Enter. the function of the host command is basically the same as that of nslookup. the syntax of the command is host [option] [IP address/domain name/host name] common parameters of host are as follows: "-a shows an example of the queried domain name, IP address domain 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 parameters of finger are as follows: Information such as the logon time when the status is stuck-l in addition to the information displayed with the-s option, the information such as the shell email status of the user's main Directory Logon and the information in the user's main directory. plan. project and. the contents of the forward file are not displayed except www.2cto.com-p. 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 id Le No mail. no Plan. check the group id of a Linux user. the user group user Ping command is used to check whether the host on the network is working, it sends the ICMP ECHO_REQUEST packet to the host. sometimes we want to download files from a host on the network but do not know whether the host is on. we need to run the ping command to check the general format of the command. for ping [option] [host name/IP address], the common parameters for ping 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, the local network connection is viewed. Whether the port is faulty-the number of bytes in s specifies the number of data bytes sent. the default value is 56, plus an 8-byte ICMP header, A total of 64ICMP data byte www.2cto.com common network configuration file introduction in Linux, TCP/IP network is configured through several text files, need to edit these files to complete 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: the unit of df-k is KB. Shows the information of each partition df-a shows all partitions, including partitions with a size of 0 df-T shows the partition type (EXT2 or EXT3) and other du commands: view the size of a file or folder. for example, du-B/home is displayed in bytes. The size of each sub-folder in the/home folder. du-ks home is displayed in KB./home the top command is used to view system status information in real time. after running the 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 automatically refreshes the status information every five seconds. Add the-d parameter to start www.2cto.com, for example, top-d 5, and refresh the top once every 5 seconds. after you press the following Button, the corresponding function will be available: space immediate refresh 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 ".
Related Article

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.