. Firewall can be a software or hardware or both which protects our device from external issues.
    . It can be Windows Firewall in the Operating system or filtering set in the router.
    . Acts as a gatekeeper for all incoming and outgoing traffic.

   Software Firewall:

        . A software Firewall runs within your computer.
        . When your computer is connected to internet, it is necessary to have software firewall which protects from threats.
        . Windows has Firewall by default.
        . We must ensure that it is enabled.
        . If it is not enabled, it is like opening doors of your home and allowing threatful strangers to come in.
        . If any device within the network is infected, Software Firewalls protects your computer.

           . To enable Windows Firewall, in the control panel Turn on the Windows Firewall.

     Hardware Firewall:

          . Routers work as Hardware Firewalls.
          . Routers use Network Address Translator (NAT) to share common IP from ISP to all the computers in the network.
          . Since Software Firewall is present within computer, any virus in computer may effect Software Firewall but not Hardware Firewall which is outside computer.
          . It provides security to the entire network of computers.

    How does Firewall works?

          . Firewall allows you to establish certain rules to determine what traffic should flow in or out of private network.
          . Firewall uses any one or combination of the following methods to provide safety:

          Packet Filtering:
                . Every message we send back and forth is in the form of packets.
                . Packets contain information like source and destination IP and ports, data.
                . Packet Filtering looks on the ports.
                . You can filter on allowing or disallowing traffic from certain ports or IP addresses.

           Proxy Server:
                . Proxy server allows to send packets from itself hiding all the internal IP addresses.
                . Security in this technique is sender and receiver can never see each others ports or IP addresses.
                . This allows to reduce attacks from the hackers by hiding internal IP addresses.

           Application Gateway:
                . It is another sort of Proxy server.
                . Computer in a network first establishes connection with Application Gateway.
                . It takes care whether to connect destination port or not according to rules it has set.
                . Now the communication is through internal Computer-Application Gateway-Destination.

           Dynamic Packet Filtering:
                . It is slowly replacing all the previous methods.
                . It not only checks the header information, but also inbound and outbound data parts.
                . It is then compared to the trusted destination source whether or not to allow the data packets from the firewall.