A properly configured firewall can block malicious traffic and prevent WannaCry from spreading across your network. Make sure your firewall is up-to-date and restrict access to unnecessary services like SMBv1.