我正在学习 Linux 中网络命令的一些基础知识。我试图 ping 到 facebook.com 的连接,因此我写道:
ping -c 1 facebook.com
结果是:
PING facebook.com (157.240.14.35) 56(84) bytes of data.
64 bytes from edge-star-mini-shv-02-mia3.facebook.com (157.240.14.35):
icmp_seq=1 ttl=128 time=50.3 ms
--- facebook.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 50.369/50.369/50.369/0.000 ms
现在如果我再试一次:
ping -c 1 facebook.com
结果改变:
PING facebook.com (31.13.67.35) 56(84) bytes of data.
64 bytes from edge-star-mini-shv-01-mia3.facebook.com (31.13.67.35):
icmp_seq=1 ttl=128 time=58.0 ms
--- facebook.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 58.077/58.077/58.077/0.000 ms
注意:每次执行 ping 命令时 IP 都会改变,这是为什么?服务器的 IP 地址最初是(第一次 ping)157.240.14.35
,但当我执行第二次 ping 时,IP 是31.13.67.35
。我尝试过使用 Google 和其他网站,每次 IP 都相同,但 Facebook 也发生过这种情况吗?这只是安全性的改进还是什么?这是因为 Facebook 将连接分散到多个服务器吗?
答案1
Facebook 有很多很多面向公众的 IP,不只有一个。每次重新启动命令时,它都会查找 facebook.com 并 ping 它获得的第一个地址。
您可以通过主机名查找来检查它是否具有多个 IP。
nslookup facebook.com
每次你都会得到不同的结果。
答案2
实际上有数百个 IP 与 Facebook.com 相关联,它们的Facebook 爬虫页面注明了查看完整 IP 列表的正确 (Linux) 命令:
whois -h whois.radb.net -- '-i origin AS32934' | grep ^route
它会定期更改,截至本文发布时的当前输出列表如下:
route: 204.15.20.0/22
route: 69.63.176.0/20
route: 66.220.144.0/20
route: 66.220.144.0/21
route: 69.63.184.0/21
route: 69.63.176.0/21
route: 74.119.76.0/22
route: 69.171.255.0/24
route: 173.252.64.0/18
route: 69.171.224.0/19
route: 69.171.224.0/20
route: 103.4.96.0/22
route: 69.63.176.0/24
route: 173.252.64.0/19
route: 173.252.70.0/24
route: 31.13.64.0/18
route: 31.13.24.0/21
route: 66.220.152.0/21
route: 66.220.159.0/24
route: 69.171.239.0/24
route: 69.171.240.0/20
route: 31.13.64.0/19
route: 31.13.64.0/24
route: 31.13.65.0/24
route: 31.13.67.0/24
route: 31.13.68.0/24
route: 31.13.69.0/24
route: 31.13.70.0/24
route: 31.13.71.0/24
route: 31.13.72.0/24
route: 31.13.73.0/24
route: 31.13.74.0/24
route: 31.13.75.0/24
route: 31.13.76.0/24
route: 31.13.77.0/24
route: 31.13.96.0/19
route: 31.13.66.0/24
route: 173.252.96.0/19
route: 69.63.178.0/24
route: 31.13.78.0/24
route: 31.13.79.0/24
route: 31.13.80.0/24
route: 31.13.82.0/24
route: 31.13.83.0/24
route: 31.13.84.0/24
route: 31.13.85.0/24
route: 31.13.86.0/24
route: 31.13.87.0/24
route: 31.13.88.0/24
route: 31.13.89.0/24
route: 31.13.90.0/24
route: 31.13.91.0/24
route: 31.13.92.0/24
route: 31.13.93.0/24
route: 31.13.94.0/24
route: 31.13.95.0/24
route: 69.171.253.0/24
route: 69.63.186.0/24
route: 31.13.81.0/24
route: 179.60.192.0/22
route: 179.60.192.0/24
route: 179.60.193.0/24
route: 179.60.194.0/24
route: 179.60.195.0/24
route: 185.60.216.0/22
route: 45.64.40.0/22
route: 185.60.216.0/24
route: 185.60.217.0/24
route: 185.60.218.0/24
route: 185.60.219.0/24
route: 129.134.0.0/16
route: 157.240.0.0/16
route: 157.240.8.0/24
route: 157.240.0.0/24
route: 157.240.1.0/24
route: 157.240.2.0/24
route: 157.240.3.0/24
route: 157.240.4.0/24
route: 157.240.5.0/24
route: 157.240.6.0/24
route: 157.240.7.0/24
route: 157.240.9.0/24
route: 157.240.10.0/24
route: 157.240.16.0/24
route: 204.15.20.0/22
route: 69.63.176.0/20
route: 69.63.176.0/21
route: 69.63.184.0/21
route: 66.220.144.0/20
route: 69.63.176.0/20
route6: *deleted IPv6 list*