What is the exact difference between router and gateway? In Network configuration we set the default gateway IP address, but in reality we call the device configured with that IP address as router?

3 Answers 3


Router describes the general technical function (layer-3 forwarding) or a hardware device intended for that purpose, while gateway describes the function for the local segment (providing connectivity to elsewhere). You could also state that "you set up a router as gateway". Another term is hop which describes the forwarding in between subnets.

It's just a matter of perspective, the device is the same.


What is the exact difference between router and gateway?

A router is a device/service that provides the function of routing IP packets between networks.

A gateway (in network terms) is a router that provides access for IP packets into and/or out of the local network.

In Network configuration we set the gateway ip address, but in reality we call the device configured with that ip address as router?

Specifically, the gateway you are likely referring to is the default gateway which is the router to which a client (or source device) sends IP packets that are destined somewhere other than the local network and for which the client has no "better" route.

A gateway always has to be a router, but a router does not have to be a gateway.

  • 1
    Can you please elaborate the statement "A gateway always has to be a router, but a router does not have to be a gateway" in detail ?
    – Raja
    Jul 2, 2018 at 3:34
  • 4
    Because a gateway's purpose is to route packets into/out of a local network segment for other devices, it will always be a router. However a router can be attached to a local network without performing any sort of routing into/out of the local network segment for other devices. It could be using the connection to a local network segment for a number of different purposes (for example, including but not limited to, management purposes such as monitoring, reporting, logging, etc.).
    – YLearn
    Jul 2, 2018 at 18:43
  • @YLearn So, gateway if ever configured will have same ip as that of router ?
    – Number945
    Aug 17, 2019 at 11:49
  • @BreakingBenjamin, assumption on my part is that by "gateway" you are referring to the default gateway configured on a device. Then specifically, the gateway would be configured as the IP of the router functioning as the gateway for that network or client.
    – YLearn
    Aug 17, 2019 at 17:45

A router is a layer 3 device i.e It cannot modify the IP address of the packet, it can only change the MAC Address it can route the packet, whereas a gateway could be NAT capable, or can act as a firewall in case of a NAT-capable gateway it can change the packet's IP address and more capable gateways can block traffic

  • Layer2 Devices - Switches

  • Layer3 Devices - Routers

  • Layer2- Layer7 Devices - Gateways/Firewalls/IDC (usually implement DPI -deep packet inspection)

Gateways are distinct from routers or switches in that they communicate using more than one protocol and can operate at any layer of the 7 layer OSI model of networking. - Wikipedia

  • Not sure this is strictly true when it comes to acceleration devices and transparent caching etc Dec 7, 2019 at 21:14
  • If it is a router it is true, if we add special features and call it a router it is not true.Any router that operates above layer 3 is not a L3 Router
    – vaaz
    Mar 2, 2021 at 12:51
  • by that definition I don’t think there are any routers left from any of the big manufacturers, sure they do routing but they also do a heck of a lot more Mar 8, 2021 at 6:02
  • Yes, even so called switches (commercial) do routing and NAT. Definitions are only theroretical
    – vaaz
    Mar 8, 2021 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.