No. The hosts file doesn't affect any routing. It only affects name lookups. Since
188.8.131.52 is an IP address, the system won't look it up in the hosts table.
Read here for more info on the hosts file: http://manpages.ubuntu.com/manpages/trusty/man5/hosts.5.html
If you want to block connections to an IP address from your system, there are a couple of ways to do that, like:
Blackhole traffic using the
route add 184.108.40.206 gw 127.0.0.1 lo
Reject traffic using the
route add -host 220.127.116.11 reject
Null route using the
ip route add blackhole 18.104.22.168/32
Now, if you want to block traffic to a system by name, you can add a fake entry to your hosts file pointing that name to the loopback address:
Then any traffic trying to get to that host from your system will be faked out – as long as your system is set to use the hosts file lookup prior to DNS. Any specifically DNS based lookups will still work, although you could use a DNSMASQ server like a Pi Hole to block even DNS lookups.
Make sure you read the man pages for the
ip commands, so you'll understand how to make these commands persistent across reboots if you need them to be.