IP地址的查看
Windows:
ipconfig
Linux、Mac:
ifconfig
Mac 中沒有 ip 命令,可使用brew install
ip command in Mac OS X terminal
brew install iproute2mac
ip addr
網絡連通性測試
ping命令:
ping 192.XXX.XXX.XXX
測試端口的連通性
telnet命令
mac M1需安裝telnet:
brew install telnet
測試連接google的80port如下
$ telnet www.google.com.tw 80
Trying 172.217.163.35...
Connected to www.google.com.tw.
Escape character is '^]'.
traceroute
可顯示封包在IP網路經過的路由器的IP位址。
Windwos平台指令
tracert
Linux平台指令:
traceroute
tracepath
traceroute連接到google如下:
$ traceroute www.google.com.tw
traceroute to www.google.com.tw (142.251.43.3), 64 hops max, 52 byte packets
1 192.168.100.1 (192.168.100.1) 6.143 ms 5.137 ms 4.805 ms
2 192.168.1.1 (192.168.1.1) 6.382 ms 7.177 ms 6.312 ms
3 h254.s98.ts.hinet.net (168.95.98.254) 12.624 ms 7.280 ms 9.544 ms
4 * * *
5 203-75-90-146.hinet-ip.hinet.net (203.75.90.146) 19.812 ms 7.768 ms 6.890 ms
6 tpdt-3308.hinet.net (168.95.81.6) 8.898 ms 7.564 ms 31.192 ms
7 tpdt-3032.hinet.net (220.128.27.94) 14.086 ms
tpdb-3031.hinet.net (220.128.1.102) 8.078 ms 8.284 ms
8 * * *
9 pcpd-3211.hinet.net (220.128.12.241) 13.199 ms
pcpd-3211.hinet.net (220.128.13.85) 9.528 ms
pcpd-3211.hinet.net (220.128.12.189) 7.593 ms
10 72.14.218.140 (72.14.218.140) 9.797 ms 9.633 ms 10.930 ms
11 * * *
12 209.85.243.196 (209.85.243.196) 9.198 ms
142.251.226.170 (142.251.226.170) 28.471 ms
216.239.48.134 (216.239.48.134) 10.657 ms
13 142.251.77.85 (142.251.77.85) 8.641 ms 17.196 ms
tsa03s08-in-f3.1e100.net (142.251.43.3) 8.052 ms
curl命令
請求web服務的
- -v :顯示請求詳細信息
curl quietbo.com -v
- -X :指定请求方式(GET or POST)
curl -X Get URL
curl -X POST URL
- -H :指定頭部類型&Cookie
curl -H "Content-Type:application/json"
curl -H "Cookie:username=XXX" URL
- -d :使用POST向server發送數據,下方可以省略-X POST
curl -H "Content-Type:application/json" -d '{"name":"bocky","date":"2022/1/13"}' URL -v
可參考更多網路文章,文章