网络常用命令

IP地址的查看

Windows

  1. ipconfig

Linux

  1. ifconfig

或者

  1. ip addr

网络连通性测试

ping命令

  1. PS C:\Users> ping 192.168.178.1
  2. Pinging 192.168.178.1 with 32 bytes of data:
  3. Reply from 192.168.178.1: bytes=32 time=2ms TTL=64
  4. Reply from 192.168.178.1: bytes=32 time=3ms TTL=64
  5. Reply from 192.168.178.1: bytes=32 time=3ms TTL=64
  6. Reply from 192.168.178.1: bytes=32 time=3ms TTL=64
  7. Ping statistics for 192.168.178.1:
  8. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  9. Approximate round trip times in milli-seconds:
  10. Minimum = 2ms, Maximum = 3ms, Average = 2ms
  11. PS C:\Users\Peng Xiao>

telnet命令

测试端口的连通性

  1. ~ telnet www.baidu.com 80
  2. Trying 104.193.88.123...
  3. Connected to www.wshifen.com.
  4. Escape character is '^]'.
  5. HTTP/1.1 400 Bad Request
  6. Connection closed by foreign host.
  7. ~

traceroute

路径探测跟踪

Linux下使用 tracepath

  1. ~ tracepath www.baidu.com
  2. 1?: [LOCALHOST] pmtu 1500
  3. 1: DESKTOP-FQ0EO8J 0.430ms
  4. 1: DESKTOP-FQ0EO8J 0.188ms
  5. 2: 192.168.178.1 3.371ms
  6. 3: no reply
  7. 4: gv-rc0052-cr102-et91-251.core.as33915.net 13.970ms
  8. 5: asd-tr0021-cr101-be156-10.core.as9143.net 19.190ms
  9. 6: nl-ams04a-ri3-ae51-0.core.as9143.net 213.589ms
  10. 7: 63.218.65.33 16.887ms
  11. 8: HundredGE0-6-0-0.br04.sjo01.pccwbtn.net 176.099ms asymm 10
  12. 9: HundredGE0-6-0-0.br04.sjo01.pccwbtn.net 173.399ms asymm 10
  13. 10: 63-219-23-98.static.pccwglobal.net 177.337ms asymm 11
  14. 11: 104.193.88.13 178.197ms asymm 12
  15. 12: no reply
  16. 13: no reply
  17. 14: no reply
  18. 15: no reply
  19. 16: no reply
  20. 17: no reply
  21. 18: no reply
  22. 19: no reply
  23. 20: no reply
  24. 21: no reply
  25. 22: no reply
  26. 23: no reply
  27. 24: no reply
  28. 25: no reply
  29. 26: no reply
  30. 27: no reply
  31. 28: no reply
  32. 29: no reply
  33. 30: no reply
  34. Too many hops: pmtu 1500
  35. Resume: pmtu 1500
  36. ~

Windows下使用 TRACERT.EXE

  1. PS C:\Users\Peng Xiao> TRACERT.EXE www.baidu.com
  2. Tracing route to www.wshifen.com [104.193.88.123]
  3. over a maximum of 30 hops:
  4. 1 4 ms 3 ms 3 ms 192.168.178.1
  5. 2 * * * Request timed out.
  6. 3 21 ms 18 ms 19 ms gv-rc0052-cr102-et91-251.core.as33915.net [213.51.197.37]
  7. 4 14 ms 13 ms 12 ms asd-tr0021-cr101-be156-10.core.as9143.net [213.51.158.2]
  8. 5 23 ms 19 ms 14 ms nl-ams04a-ri3-ae51-0.core.as9143.net [213.51.64.194]
  9. 6 15 ms 14 ms 13 ms 63.218.65.33
  10. 7 172 ms 169 ms 167 ms HundredGE0-6-0-0.br04.sjo01.pccwbtn.net [63.223.60.58]
  11. 8 167 ms 168 ms 168 ms HundredGE0-6-0-0.br04.sjo01.pccwbtn.net [63.223.60.58]
  12. 9 168 ms 173 ms 167 ms 63-219-23-98.static.pccwglobal.net [63.219.23.98]
  13. 10 172 ms 170 ms 171 ms

curl命令

请求web服务的

http://www.ruanyifeng.com/blog/2019/09/curl-reference.html