Routing Table to Control Access to Sites
A packet will only be created if the destination server IP is present in the routing table.
Here you can see that all outbound connections (0.0.0.0) are allowed.
Let us delete that rule.
Now ping to the internet
Nope. Won't work. Since no rule in the routing table for sites nor DNS Resolving.
Add rules to the routing table
Have a look at https://www.gstatic.com/ipranges/goog.json for Google IPs.
Lets add a few that are resolved on my system.
Ping 172.217.163.164 (Google IP) and 157.240.23.35 (Facebook IP) and check
You can see that packet for Google IP was sent but the Facebook packet wasn't formed since the rule doesn't exist in the routing table.
DNS RESOLUTION
But if we ping google.com, it will not work since DNS server resolution isn't allowed in the routing table.
So now, if we ping www.google.com, it will resolve and send packet but not for facebook.com