Click on Start > Settings > Update and Security > Windows Security, and then click on Firewall and Network Protection.
Open the Windows Security settings.
Select a network profile.
In Microsoft Defender Firewall, change the setting to Enabled.
To disable it, set the setting to Off.