Running `ping facebook.com` multiple times doesn't give the same IP

I am learning some basics of net commands in linux. I was trying to ping a connection to facebook.com, so I write:

ping -c 1 facebook.com

And the result is:

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

Now if I try again:

ping -c 1 facebook.com

The result changes:

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

Note this: the IP changes every ping command, why? The IP address of the server was originally (first ping) 157.240.14.35, but when I did the second ping, the IP was 31.13.67.35. I've tried with Google and another websites and IP is every time the same, but was happend with Facebook? Is just an improvement of security or what? This is because Facebook distribute the connections with they multiple servers?

2 Answers

Facebook has many many many public facing IP's, not just one. Each time you restart the command it does a lookup for facebook.com and pings the first address it gets.

You can check the fact it has many ip's by doing a hostname lookup.

nslookup facebook.com

Each time you'll get different results.

2

There are literally hundreds of IP's associated with Facebook.com, their Facebook Crawler page notes the proper (Linux) command to view the entire list of IP's:

whois -h whois.radb.net -- '-i origin AS32934' | grep ^route

Which will change on a regular basis, the current output list as of this posting is:

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*

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like