A firewall is a hardware device or a software program and is used to protect networks and resources from unauthorized access and to permit or deny network transmissions based upon a set of rules. A firewall acts as a filter between the Internet and your private network. There are different types of firewalls.
Packets are analyzed against a set of rules. If the packet matches the packet filter’s set of rules, the packet filter will silently reject it. For example, if a rule in the firewall exists to block telnet access, then the firewall will block the TCP protocol for port number 23.
They examine each data packet and its position within the data stream. It records all connections passing through, it determines whether a packet is the start of a new connection, a part of an existing connection, or not part of any connection.
Application-layer firewalls work on the application level of the TCP/IP stack, they can “understand” applications and protocols such as FTP, DNS and HTTP and they can intercept all packets traveling to or from an application.
A proxy server acts as a firewall for requests from clients seeking resources from other servers. A client connects to the proxy server requesting some resource, the proxy server evaluates the request according to its filtering rules and finally permits or denys the request.