7

I feel like the three terms are often used as synonyms but actually all mean something different. I did look at Wikipedia sites but I'm still unsure about the definitions of the three.

From my understanding, routing is concerned with finding a path or paths to a destination and deciding where to send an (unknown) packet to/which path to use based on its destination or prefix and not just based on a simple lookup in a table. This is what happens at IP routers (shortest prefix routing).

These simple lookups are what I understand as forwarding: The header/label (cf. MPLS)/etc are matched against entries in a flow table (or multiple tables). An exact match tells the switch on which port to output the packet without further computation or decisions to be made. If no match is found, a default action is performed or a separate controller is asked (as in SDN). This can be done faster than routing because of less computation and specialized hardware, correct?

Switching seems to be fairly similar to forwarding but with an emphasis on what happens on hardware in the switching fabric after the lookup in a table. This on OSI level 2 (data link) while routing and forwarding are actions on level 3 (network)?

What's correct/wrong about these intuitions? Did I miss something of importance? Are there differences between IP routing/forwarding (Google returns the same Wikipedia article)? What about the MAC layer?

1

6 Answers 6

11

In general, forwarding refers to a device sending a datagram to the next device in the path to the destination, switching refers to moving a datagram from one interface to another within a device, and routing refers to the process a layer-3 device uses to decide on what to do with a layer-3 packet.

A host sending data to another host through an ethernet interface will place a frame on the wire. If the next device is a bridge (a switch is a bridge), the bridge will inspect the frame for the source and destination MAC addresses. The bridge will use the source MAC address in its MAC address table so that it knows the host with that MAC address is connected to the interface where the frame entered the bridge. It will also try to look up the destination MAC address in its MAC address table to see to which interface it should switch the frame. If it finds the MAC address in its MAC address table, it will switch the frame to the interface indicated in its MAC address table, otherwise it will flood the frame to all other interfaces, forwarding the frame to the device(s) on the other end(s) of the interface(s) link(s).

A router receiving a frame on an interface will strip the frame from the packet. The router will then try to look up the destination IP address in its routing table. If it doesn't find a match, even a default route, it will drop the packet. If it finds one or more matches, it will switch the packet to the interface of the longest match in the routing table. The router will then prepare a new frame for the packet on the new interface (the link on new interface may or may not use MAC addresses), and the router will forward the new frame containing the original packet over the next hop interface toward its destination. The whole process a router uses is called routing, but within the router, it switches packets before forwarding them to the next hop device.

5

The way I see it, forwarding applies to forwarding at any layer. A frame/packet/cell arrives at a device, a header address is inspected and that address is looked up in the forwarding table, the forwarding decision is made and the datagram is sent out of that interface on its way. Routing describes this function when the forwarding decision is made at layer 3, using the IP destination address. Switching and bridging refer to the forwarding decision being made at layer 2, using the destination MAC address. I know there is some confusion around this as I have seen layer 3 forwarding referred to as switching when it is carried out on an L3 switch.

2
  • Wikipedia says about packet forwarding, it belongs to network layer, i.e. L3. Do you not think the/a difference between routing and forwarding is the decision between possible paths (routing) vs the simple lookup and forwarding on one fixed path that's defined in the forwarding table (forwarding) - as suggested by the answer to this related question? Also, what does "interface" mean in this context? Commented Jul 30, 2016 at 12:28
  • I think if it's talking about packet forwarding then it is specifically talking about L3 forwarding as packets are the datagram at layer 3 (as opposed to frames at layer 2). The definition of routing and L3 forwarding should be the same. The interface is just the outgoing interface in the forwarding table. The device alters the L2 header and sends the frame out of that interface (L3 forwarding requires L2 header rewrite to get the frame to the next-hop).
    – user27899
    Commented Jul 30, 2016 at 18:58
5
  • Routing - Packets are forwarded by a layer 3 gateway, aka router.
  • Switching - Frames are forwarded by a layer 2 switch.
  • Forwarding - Protocol Data Units are forwarded by a networked / networking device.
3

The term forwarding is used to describe moving any protocol across the network, and it decides which exit interface to use to send the packet to its next hop.

Routing is the process of forwarding packets at L3 of the OSI model.This is based on knowing where the destination is and to which interface the layer 3 device should send it to.

Switching is the process of forwarding frames at Layer 2 of the OSI based on the Destination Address.

0

Routers do forwarding and routing. Routing is "outside" of the router (i.e., RIP, OSPF, etc.) Forwarding, in routers, is taking the IP datagram/packet from the input port (after it is received and processed) and look up occurs with the forwarding table to determine which output port it needs to go to.

-5

Here’s the simplest answer I could find regarding the difference between a router and a switch explained in this short video: (https://view.ly/v/PZCxgNYHrMFW). I am a CISCO student and because I don’t have this “huge” background with networking I was struggling at the beginning but now I am close to getting my level 3 certificate and a lot of videos like this one helped me get through the stuff I couldn’t easily comprehend. I just love ELI5 stuff!

1
  • While simple explanations are nice for those new to the topic, this video doesn't quite cut it. To begin with, it really doesn't get into the difference between routing/switching in any real way significant to networking. I barely skims the surface. Even worse, it uses terminology that will only end up confusing those new to networking. Specifically it mentions routers bridging two networks and that misuse of terminology will likely cause confusion when bridging (i.e. L2 or switching) is actually discussed.
    – YLearn
    Commented Aug 19, 2018 at 19:06

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.