netstat and ifconfig commands

Netstat:
Netstat is a command console, is a very useful tool for monitoring a TCP / IP network, and displaying the status of the routing table, the actual network connections, and each network interface device information. Netstat for displaying IP, TCP UDP and ICMP statistics related generally to network connection of each port of the unit test.
Recv-Q: Receive Queue
Send-Q: a transmit queue
Proto: connection protocol
RefCnt: ​​connected to the socket of the process ID
Types: type socket
State: The current state of the socket
Path: connection to other processes using the socket pathname
TCP network state (State column):
netstat common parameters:
-a (all) to display all the options, not displayed by default LISTEN related.
-t (tcp) only show tcp options.
-u (udp) show only udp options.
-n alias rejection display can show all converted into digital numbers.
-l Only lists service status in Listen (listen) is.
 
-p displays the name of the program to establish links
-r Displays the routing information, routing table
-e displays extended information, like e.g. uid
-s statistics by individual agreement
-c every fixed time, the netstat command execution.
 
Related common netstat command:
1, #netstat -a list all ports
 
2. List all tcp ports #netstat -at
 
3, lists all the udp port #netstat -au
 
4, show only listening port #netstat -l
 
5, only lists all listening tcp port #netstat -lt
 
6, listening udp only list all ports #netstat -lu
 
7, lists all UNIX listening port #netstat -lx
 
8, display statistics #netstat -s all ports
 
9, display TCP or UDP port statistics #netstat -st or -su
 
10, showing the PID and process name #netstat -p output
 
11, continuous output netstat information #netstat -c
 
12, find out the port #netstat -ap running | grep ': 80'
 
Ifconfig:
ifconfig 是一个用来查看、配置、启用或禁用网络接口的工具,这个工具极为常用的。可以用这个工具来临时性的配置网卡的IP地址、掩码、广播地址、网关等。也可以把它写入一个文件中(比如/etc/rc.d/rc.local),这样系统引导后,会读取这个文件,为网卡设置IP地址
lo表示主机的环回地址,一般用来在本地主机上测试某个网络程序。
wlp0s20f3表示网卡,显示了该主机IP/MAC地址,广播地址和子网掩码等。
ifconfig常用参数:
Ifconfig lo  //查看某个端口状态
Ifconfig 网络端口 ip地址 hw MAC地址 netmask 掩码地址 broadcast 广播地址 //配置网络接口

Guess you like

Origin www.cnblogs.com/zxy1122/p/11947727.html