I have something like this in /etc/hosts
:
192.168.0.1 example.com
192.168.0.1 *.example.com
example.com
is pinged to 192.168.0.1
as expected but pinging say sub.example.com
outputs:
unknown host sub.example.com
You have answered your own question!
The /etc/hosts
file is a one-to-one mapping between a hostname (not a collection of them) to a particular IP address.
Consider putting this into /etc/hosts
file
127.0.0.1 *.com
man hosts
from a terminal?man hosts | grep '\(aster\|\*\)'
outputs nothing useful.