What is the difference between a Gateway and a Firewall and how do they relate to one another?

I am a developer trying to get a general understanding of network security.

  • 4
    This type of question can be easily answered with a simple web search. As you continue to learn more about security it will help to be proactive about searching out for the answers yourself. In addition to being faster you'll also gain more domain knowledge as you expose yourself to more technical detail, rather than only getting 'pre-chewed' information. Best of luck in your endeavors.
    – grauwulf
    May 3, 2013 at 15:00
  • 1
    @grauwulf While it may be "simple" and have lots of people speaking on it, it's totally appropriate for our site and there are no duplicates that I'm aware of. Further, we can probably provide a better answer than in the first 10 Google results.
    – Jeff Ferland
    May 4, 2013 at 16:22
  • Thank you because I started with a Google search and did not understand what I was reading so I posted the question here. May 6, 2013 at 13:46
  • I rejected the edit because it was from an anonymous user. If that was you Kyle, please log in and make the edit again. Aug 21, 2015 at 0:28

3 Answers 3


A gateway is simply a device that joins together two different networks. In the most common scenario, an internal network with the internet. A router is an example of a gateway device. A router is a device that does routing, deciding where packets are sent to based on its IP address.

A firewall is a filter that examines packets against a set of defined rules in order to decide whether to allow the packets through.

In many devices, the functionality of both a gateway and a firewall is present. Of course, there are dedicated versions of each for use in large enterprise networks.

  • Simple answer. I believe I know the difference now. Thanks! May 6, 2013 at 13:51


A very simple answer would be, a gateway is a node on your network that acts like an interface to other networks. Typically this is the machine that the desktops and workstations connect through to access the internet.

A better answer would be that it allows disparate networks to communicate with each other. At its heart a gateway is a machine that can translate the protocols used on one side of the network with those used on the other side. Before the widespread adoption of TCP/IP in the early days, gateways were the network "masters" that talked to each other, they were known as IMP's (Interface Message Processor) and were designed so that instead of every computer having to know all the protocols in the entire ARPANET the IMP would act as a gateway and know those used at a particular site and it's native protocol used to communicate with other IMP's.

Today gateway computers serve much the same purpose but instead of translating communication protocols they often function as DNS/DHCP servers and translate addresses taking the single IP that a site may own and then figuring out which computer to route that packet to. This is done by routers as well, many home routers have built in DHCP servers to allow you to connect multiple computers. Consumer routers may also perform common firewall tasks such as port forwarding, port blocking, and packet filtering.


A firewall is a software or hardware appliance the blocks, filters, or in someway restricts and to a degree directs network traffic. Typically the firewall would be used to selectively block connections to various ports on local machines that the admin didn't need. It may allow ssh connections to 22 but only from a certain IP block or it may not allow any traffic on ports commonly associated with P2P networks.

They are much more advanced now, "next gen" firewalls can do application filtering, NAT, and proxy services. These though are mainly software firewall programs such as those created by Microsoft, Barracuda, and others. The hardware firewalls, specifically the Cisco ASA series, are very advanced intelligent appliances that can defend against and mitigate multiple threats. These are generally enterprise grade, many small and even some medium sized businesses won't find the expense necessary and will stick with older appliances or software based firewall applications.


A gateway is a machine through which data packets flow. It is responsible for linking together two networks (e.g. an internal network, and the Internet).

A firewall is a filtering system through which data packets are sent; the firewall decides to let some of the packets pass through, while it blocks or divert others.

To be effective, the firewall must be located at a place where it can actually see the packets and block or divert them -- i.e. on a gateway, or possibly directly on an end-user system (that's what "Windows firewall" is about: a firewall integrated in your own operating system, which acts as if it was between your machine and the rest of the world).

Not the answer you're looking for? Browse other questions tagged .