How to Prevent Network Attacks Install antivirus software. One of the first lines of defense against malware and other viruses is to install antivirus software on all devices connected to a network (Roach & Watts, 2021). ... Create strong passwords. ... Enforce security policies. ... Use firewalls. ... Monitor activity.