如果你的日常搬砖工作不是与底层协议栈紧密相关, 知道这些也没有什么用,并且很快就会忘记,其中任何一个分支领域都不容易,关联的知识也会非常多。

连接

image.png

连接的洪水攻击

image.png

断开

image.png

TCP/IP状态图详解

image.png

TCP socket 状态表

State Endpoint Description
LISTEN Server Waiting for a connection request from any remote TCP end-point.
SYN-SENT Client Waiting for a matching connection request after having sent a connection request.
SYN-RECEIVED Server Waiting for a confirming connection request acknowledgment after having both received and sent a connection request.
ESTABLISHED Server and client An open connection, data received can be delivered to the user. The normal state for the data transfer phase of the connection.
FIN-WAIT-1 Server and client Waiting for a connection termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent.
FIN-WAIT-2 Server and client Waiting for a connection termination request from the remote TCP.
CLOSE-WAIT Server and client Waiting for a connection termination request from the local user.
CLOSING Server and client Waiting for a connection termination request acknowledgment from the remote TCP.
LAST-ACK Server and client Waiting for an acknowledgment of the connection termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request).
TIME-WAIT Server or client Waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request.[e]
CLOSED Server and client No connection state at all.

Linux查看连接状态

  1. [java@node101 ~]$ netstat -anp
  2. (Not all processes could be identified, non-owned process info
  3. will not be shown, you would have to be root to see it all.)
  4. Active Internet connections (servers and established)
  5. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
  6. tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
  7. tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN -
  8. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
  9. tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
  10. tcp6 0 0 :::111 :::* LISTEN -
  11. tcp6 0 0 :::22 :::* LISTEN -
  12. tcp6 0 0 ::1:631 :::* LISTEN -
  13. udp 0 0 0.0.0.0:111 0.0.0.0:* -
  14. udp 0 0 0.0.0.0:5353 0.0.0.0:* -
  15. udp 0 0 0.0.0.0:37142 0.0.0.0:* -
  16. udp 0 0 192.168.122.1:53 0.0.0.0:* -
  17. udp 0 0 0.0.0.0:67 0.0.0.0:* -
  18. udp6 0 0 :::111 :::* -
  19. udp6 0 0 :::5353 :::* -
  20. udp6 0 0 :::43914 :::* -
  21. Active UNIX domain sockets (servers and established)
  22. Proto RefCnt Flags Type State I-Node PID/Program name Path
  23. unix 2 [ ACC ] STREAM LISTENING 19622 - /run/rpcbind.sock
  24. unix 2 [ ACC ] STREAM LISTENING 41131 1999/gnome-session- @/tmp/.ICE-unix/1999
  25. unix 2 [ ACC ] STREAM LISTENING 20718 - @/org/kernel/linux/storage/multipathd
  26. unix 2 [ ACC ] STREAM LISTENING 42515 2134/ibus-daemon @/tmp/dbus-Dhv0BQv6
  27. unix 2 [ ACC ] STREAM LISTENING 26396 - /var/run/vmware/guestServicePipe
  28. unix 2 [ ACC ] STREAM LISTENING 25367 - @irqbalance789.sock
  29. unix 2 [ ACC ] STREAM LISTENING 29726 - /run/gssproxy.sock
  30. unix 2 [ ACC ] STREAM LISTENING 41223 2106/Xwayland @/tmp/.X11-unix/X0
  31. unix 2 [ ACC ] STREAM LISTENING 42033 - /run/user/1001/keyring/ssh
  32. unix 2 [ ACC ] STREAM LISTENING 25434 - /var/lib/sss/pipes/private/sbus-monitor
  33. unix 2 [ ACC ] STREAM LISTENING 26993 - /var/lib/sss/pipes/private/sbus-dp_implicit_files.834

什么是IP分片

IP数据途径较小传输负载网络时的不断分片示意图

image.png

参考资料