When your computer is connected to any network, whether wired, wifi, home, or corporate, it is susceptible to internet based attacks. The best countermeasure for malicious traffic constantly crawling the internet is a firewall. To amplify effectiveness the firewall should use an intrusion detection SYSTEM (IDS) and intrusion Prevention System (IPS).
The Cybersecurity & Infrastructure Security Agency (CISA) does an excellent job of explaining what firewalls do:
“Firewalls provide protection against outside cyber attackers by shielding your computer or network from malicious or unnecessary network traffic. Firewalls can also prevent malicious software from accessing a computer or network via the internet. Firewalls can be configured to block data from certain locations (i.e., computer network addresses), applications, or ports while allowing relevant and necessary data through.”