Skip to main content Router vs Gateway vs Switch : r/AskNetsec

Router vs Gateway vs Switch

I am studying for N+ and I am confused between some topics. From my understanding, Router is a device that routes packets and connects networks. A gateway is a device which can be considered as entry/exit to a network. Switches are capable to route packets in a network. So, why do we need a router? Can't we just send packets directly to gateway and then the switch with redirect to it's destination in LAN? Also, what is the use of routing table on router if a switch already has it. I am aware I am going in terribly wrong direction to understand things but I just don't get it!

📅 Mark your calendar for Zero Trust World 2025. $200 off ends soon—act now! Code - ZTWREDDIT25
Clickable image which will reveal the video player: 📅 Mark your calendar for Zero Trust World 2025. $200 off ends soon—act now! Code - ZTWREDDIT25
Sort by:
Best
Open comment sort options
[deleted]
Edited

Comment removed by moderator

More replies
Edited

Usually: gateway = router. Switch is for transmitting packets in the same network between computers without a gateway / router. Usually. It's true that L3 switches exist. But that's another story.

Edited

CENSORED

Troubleshoot smarter with Sumo Logic: unified logs, metrics, and traces for faster resolutions.
Thumbnail image: Troubleshoot smarter with Sumo Logic: unified logs, metrics, and traces for faster resolutions.
[deleted]

The difference is between whether your device is forwarding, routing, or both.

Switches operate at L2 and so they forward frames, effectively extending the size of an individual network. And they usually forward frames for a single IP subnet.

Routers operate at L3 and they route packets from one network to another, or from one IP subnet within a network to another IP subnet in that network.

There are usually multiple gateways in a network, one for the IP subnet you’re on, and one that sits on the border between networks you control vs networks your ISP or other people control. At home these sit on the same router, but out in business they are almost always separate devices.

The situation is further complicated by newer switches having routing chips (called L3 or multi-layer switches) that enable them to act like routers, and routers that ship with switching cards that lets them do both routing and forwarding.

Router has WAN link capability , so it can link between ‘wide area network’ - gateway is the way L3 switch can route within network L2 within the broadcast domain

Do layer 3 switches come with NAT support and a firewall?

More replies
[deleted]

OSI Reference Model terms used below..

Switches are by design a Layer 2 device managed by the Spanning Tree Protocol not routing. The addition of VLANs with Trunking architecture was a later generation add-on that looks like routing, but the Spanning Tree Protocol is still the core of a switch.

Routers are either internal to your network or at the edge (hence the term Gateway Router). They work at the Layer 3 of the OSI module and use a range of internal and external routing protocols to communicate with each other to find fastest and largest path available without having to use manual routing of traffic. Routing Protocols can be complicated or simple depending on the device installed and vendor specific protocols deployed.

The Gateway Router may have Network Address Translation duties to keep your IP addresses Private especially if you are using RFC -1918 addressing internally as those addresses are nonroutable on the Internet.

The normal structure of a network is to have a Gateway performing OS to IS Layer 3 traffic. (Outside to Inside). The internal networks needing L3 separation for security as well as performance reasons will perform a IS to IS (Inside to Inside) protocol to manage paths.

The L2 Switch handles traffic from Trunk circuits down to devices as defined by VLANs and Spanning Tree Protocol map. L3 Switching is a merger of L2 and L3 to reduce the complexity of the Spanning Tree and Latency on LARGE enterprise networks wanting to keep life simple compared to an old school Router. This merger allows for consolidating of trunk x and VLANs L3 Switching is a merger of L2 and L3 to reduce the complexity of the Spanning Tree and Latency on LARGE enterprise networks wanting to keep life simple compared to an old school Router.

to a single device with L3 network separation where needed.

To keep the Spanning tree map short (faster) L3 routing was added to the trunk level of the switch to allow for faster movement in and out the networks attached to the switch. With newer switches having hundreds of possible point to point connections and layers of VLAN/trunks L3 provides the edge to reduce the latency for the network.

Gateway declares your Country, State and/or City IP address to the Internet. Traffic from the internet uses Gateway Routers as the bridge from your State or City border to the inside of your region.

If you have a Country or State connected to a Gateway and not a City in most cases, you will have additional routers at the State down to the City level taking IP traffic from the Gateway. Once these Inside Routers have the IP traffic they will off load the traffic to the specific city neighborhood or switch. The switch will take the IP traffic and locate the MAC address from the traffic to deliver it to the correct house or device on the street as per the MAC address associated with the IP package.

This traffic management path is reversed to get traffic from your location to any other location on the Internet.

I hope this helps, let me know via PM if you have a question.

Router has WAN link capability , so it can link between ‘wide area network’ - gateway is the way L3 switch can route within network L2 within the broadcast domain