Linux Network commands, linux commands
IfconfigCommand: Command to view and configure the network status
Ifdown Nic device name: Disable this Nic Device
Ifup Nic device name: Enable this Nic Device
Netstat Option: Query the network status
Option:-t: List TCP ports
-U: List UDP ports
-N: the IP address and port number are used instead of the domain name and service name.
-L: only list network services in the listener status
-A: lists all network connections.
Note: These parameters can be used in combination, such as netstat-tuln // query the port service enabled by the computer or netstat-an // check who is connected to my server
Route-n: View the route list (you can see the gateway)
Route add default gw 192.168.1.1: Set the temporary gateway 192.168.1.1
Service network restart: Restart the network service
Nslookup host or IP: Domain name and IP Address Resolution
Ping host domain name or IP address: Test the network status of the specified IP address or domain name
For example, ping 115.159.66.51 is always pinged in Linux, but only four times in Windows
Ping xiongchao.net.cn when the ping is a domain name, the IP address of the domain name will be resolved first, and the ping will continue as per the IP address. Note: ping is allowed only when the host allows ping. ping is disabled on the host.
Note: in Linux, you can set the number of ping times, for example, ping 115.159.66.51-c 3.
Traceroute host domain name or IP address: Route tracking command
Difference between traceroute and ping:
Traceroute and ping send ICMP packets. The difference is that the ICMP packet sent by traceroute does not need to be returned, and the TTL increases constantly. The ICMP packet sent by ping must have a return packet, and the TTL remains unchanged.
Telnet domain name or IP [port]: Remote Management and port test commands
Example: telnet 115.159.66.51 // Remote Management 115.159.66.51
Telnet 115.159.66.51 3306 // check whether port 3306 of 115.159.66.51 is Enabled [common]
Note: For remote management, telnet is an unencrypted protocol and ssh is an encrypted protocol. Generally, ssh is used. Therefore, telnet is usually used to test whether the port is enabled (if the port cannot be detected, the firewall may block the port)
Wget url: Download command
Example: wget http://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz
Tcpdump-I eth0-nnX port 21: Packet Capture command
Option:-I indicates the NIC interface.
-Nn converts the domain name and service in the data packet into IP address and port
-X displays the data packet content in hexadecimal format and ASCII code.
Port specifies the listening port
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.