echo "127.0.0.1 facebook.com" | sudo tee -a /etc/hosts > /dev/null
works.
But when I use mate-network-properties gui and add 127.0.0.1 facebook.com into ignored-hosts tab, it ignores the address I added, I mean it doesn't block that address. I also ran mate-network-properties
as sudo but nothing is changed.
Do you mean that you used this configuration program?
That program configures network applications to connect through a proxy server. The Ignored Hosts tab contains a list of hosts which should not be contacted through the configured proxy server (if any), and instead should be contacted directly, thus bypassing the proxy server.
Yes, I know it's not very clear that that's what the dialog does, since the application is called mate-network-properties. But that's the way things are right now. For the time being, it's probably better that you set those settings in the /etc/hosts file, or look into iptables and firewalling to block certain hosts.
gnome-network-admin to add blocked domain addresses into /etc/hosts in the past.
So, I confused it with mate-network-properties' blocked-hosts functionality.
Thank you for the clarification.