Your firewall may be blocking outbound HTTP requests. If you have a HTTP proxy (e.g., squid), you can configure the forward proxy as follows.
Edit your config/config.ini.php and add the following:

[proxy]
host =      ; Proxy host: the host name of your proxy server (mandatory)
port =      ; Proxy port: the port that the proxy server listens to. There is no standard default, but 80, 1080, 3128, and 8080 are popular
exclude =       ; Comma separated list of hosts to exclude from proxy: optional; localhost is always excluded
username =      ; Proxy username: optional; if specified, password is mandatory
password =      ; Proxy password: optional; if specified, username is mandatory

Once configured, Matomo will contact external hostnames using this proxy server.

Note: the exclude setting is only available as of Matomo 4.11.0.

Previous FAQ: Why some pages or actions show a lower pageviews metric, but for a longer time period?