The basic task of firewall software is to inspect if the incoming and outgoing connection is to allowed or blocked. Most firewall software has pre-configured firewall rules to help block known attacks on particular ports or service and application. It will block a connection or computer if it detects port scan activity and other type of attacks (e.g. Denial of Service attacks, IP spoofing, IP flooding, duplicate IP addresses and other vulnerabilities in a system that has not been patched or is known to be attacked often by hackers or malicious users and many other type of attacks).
Advanced firewall software will provide extra protection by protecting the firewall itself (from malware adept at bypassing firewall security measures). If the firewall has failed to protect itself or it failed a leak test, your network and computer could be in deep trouble. Your IP address can be spoofed, your information is accessible to the intruder, and your system can be infected.
Some firewall software will provide privacy and web protection by allowing your private data or your connection and computers to be accessed only by trusted network and devices. In some firewall programs, there is an option to block or allow only a set of IPs or named websites. This is known as filtering feature. Other firewall software offers host protection by controlling which applications or system file sare allowed to access one another. This function in a firewall is quite useful in preventing known or unknown spyware or malware on a system from pretending to be another processes or service.