edit: For Ubuntu this should work (one versions from Trusty and newer):
sudo touch /etc/NetworkManager/dnsmasq.d/local
Put these lines into the above file and save:
address=/.facebook.com/127.0.0.1 address=/.fbcdn.net/127.0.0.1 address=/.tfbnw.net/127.0.0.1 address=/.whatsapp.com/127.0.0.1 address=/.instagram.com/127.0.0.1 address=/.fb.com/127.0.0.1 address=/.edgesuite.net/127.0.0.1 address=/.metrix.net/127.0.0.1 address=/.fbsbx.com/127.0.0.1 address=/.fbcdn.com/127.0.0.1 address=/.facebook.net/127.0.0.1 address=/.edgekey.net/127.0.0.1 address=/.cdninstagram.com/127.0.0.1 address=/.akamaihd.net/127.0.0.1 address=/.fb.me/127.0.0.1 address=/.appspot.com/127.0.0.1
edit: For Ubuntu this should work (one versions from Trusty and newer):
sudo touch /etc/NetworkManager/dnsmasq.d/local
Put these lines into the above file and save:
And then: sudo systemctl restart network-manager