1

I currently taking a computer networking course and there are some terms that really confusing me and i can't find the "connection" between them.

Suppose I have a network with hosts and routers, and lets say host A want to send a packet to host B and there are many routers and links between them.

I thought that first of all the network doing the STP algorithm, to find the best tree to send packets between LANs.

Second:

How the routing in A is going? How does he know what is the path that is the "best" for him to send the packets to B?

And what is forwarding differ from this?

I learned about Distance vectors and Link states that solve problems for routers, but, if A knows the path to B, why on earth the routers need to run this algorithm and not just sent the packets by how A told them?

And last, I'll be happy if someone elaborate me on ECMP and the connection between this to what I asked above , because I struggle to figure it.

(sorry about the english, not my native language)

4

I thought that first of all the network doing the STP algorithm, to find the best tree to send packets between LANs.

Spanning Tree is not a routing protocol, but a protocol to avoid loops in a network. Therefore, whenever the network topology changes (links comes up/goes down), Spanning Tree is gathering information about the network and the link between all involved switches. It does then determine a root bridge (= root switch), and starting from that root bridge defines which links are to be used to distribute data from one point to the next. After Spanning tree is done, there will be exactly one link in use for every possible connection, and the others links will be blocked (disabled). However, this is a protocol operating on Layer 2 of the network, and has nothing do with IPs or routing.

Second,how the routing in A is going? how does he know what is the path that is the "best" for him to send the packets to B?

In most cases, communication happens between workstations and servers, which don't participate in any routing protocol nor do they have any further knowledge about the network topology.

Most hosts only know 2 things:

  • Their own IP address and subnet mask. Usually a local IPv4 address e.g. looks like 192.168.0.42 with a 255.255.255.0 subnet - so the host would know that it can directly communicate with all other hosts using a 192.168.0.x IP address.
  • The default gateway is either gained by DHCP or manually configured, and is responsible for all communications outside the local network. If, for example, our host A with 192.168.0.42 wants to communicate with host B, using 192.168.17.23, host A will determine that the target is outside of his own network, and will direct all traffic to it's default gateway. Host A doesn't care how his gateway will get the traffic to host B - he just sends it to the gateway and is done.

The default gateway, some kind of router, will then take a look in his local routing table and, based on the destination IP address, forward the packet to the next router. It doesn't care how that router is going to get the traffic to host B, it only knows "This is the next hop on the way to the destination network". At some point, the packet will arrive at a router which is directly connected to the same network as host B. That router will then send the packet to host B.

Every participant in that process only decides where the next hop for a packet is, and send the packet to that station. They will not know or take into consideration the complete route the packet has to take - only the next step.

and what is forwarding differ from this?

Forwarding is the term used for the action done by any station participating in the distribution of a packet that is neither the source nor the destination. Host A is the source or sender, Host B is the destination or receiver. All routers in between them will only be forwarding the packet, as they are neither source nor target of that communication, but just relays.

I have to correct myself on that point. Forwarding, in networking terms, usually refers to "relaying data that you received for somebody else on Layer 2". Switches forward frames they receive, by determining if their Forwarding Table/CAM Table (Cisco) knows on which the port the destination MAC address is, and then sending it there, or flooding it on all ports if they don't know where the destination MAC address is located.

Routers route. (Ha!) They do the same as switches, but on Layer 3 (IP). They take a look at their routing table to determine where to send a specific packet on it's journey to it's destination IP.

Often, forwarding and routing are mixed up (like I did), but in network terminology, forwarding is Layer 2, routing is Layer 3.

I learned about Distance vectors and Link states that solve problems for routers, but, if A know the path to B, why on earth the routers need to run this algorithm and not just sent the packets by how A told them?

You're confusing routing protocols with the actual routing. Some routing protocols actually know the whole topology of a network, while others only know the routing table of their neighbors. All of these protocols share that they're used to fill the router's routing table, so it can make decision about which is the best path for a packet to a given destination.

To make that decision, some routing protocols actually gather all network topology information, so that they might actually know or at least guess the complete route a packet might take - but that is not their decision. Every router takes the decision which way to forward a packet in the very moment the packet arrives, depending on where it's destination is.

And last, i'll be happy if someone elaborate me on ECMP and the connection between this to what i asked above , because i struggle to figure it.

Equal-cost multi-path routing is simply a way to distribute traffic with the same source and destination over several links, which all have the same "cost".

Imagine it like this:

You're going from Los Angeles to New York (by car). Checking Google Maps, you find out that there are two possible routes, one via Denver, the other one via Albuquerque. Both routes are exactly 2800 miles long and take exactly the same time. You, as a driver, would now have to equal-cost routes to choose one from.

However, as a network packet, you don't make those decisions, but the routers make them. The router in LA could now choose to send the first packet via Denver, the second via Albuquerque, the third one via Denver and so on. It would result in both links/routes being equally used, without having a traffic jam on one route and no traffic on the other one. In short - it's just a way to distribute traffic over to equal links to avoid congestion.

3

You are mixing different concepts, so the first step is to make clear each one:

STP:

  • A device in a LAN can communicate to another device on the same LAN directly. When a device is in a LAN it uses the MAC address to identify the other devices.
  • Being in a LAN means that the device periodically sends unicast (peer to peer) frames and broadcast (peer to everyone) frames.
  • A LAN can be be formed by one or multiple switches.
  • To avoid LAN failures because cable or fiber problems, network admins usually make redundant connections. Redundant connections create loops.
  • STP is a protocol that let the switches negotiate which redundant paths must be blocked to avoid loops in a LAN. Every switch that receives a frame repeats that frame through out all its ports except the blocked ports.

Routing:

  • A router connects two or more LANs. Remember that a device can know the MAC address of devices only on the same LAN. To overcome this problem we need to use a level 3 protocol, for example, IP.

  • The router uses routing protocols (based on distance vector and link state) to find the best path to IP networks not directly attached to it. The device in the LAN is aware that there is a router but is not aware of the routing table.

  • A device (host A) that needs to communicate to a device on other LAN (host B) sends the packet to the router, and it's router's duty to forward it to the next router using the best path according to the results of the routing protocols.

2

About Route Cost and Distance Vectors

As xpac said, different routing protocols use different methods to find the best route to a specific network. The idea of a routing protocol is that it allows routers to learn from other routers what networks are attached to which router, instead of you typing everything into every router by hand. A route is basically the "way" to a specific network. As you can have multiple ways to take you to the island of Manhattan from New Jersey for example, you can have multiple routes to a network. A router broadcasts to it's neighbours all the networks it has attached locally. The next router takes this info in, and sees if it has got any of the routes already in memory (called the routing table). If it doesn't, it adds it. If it has, it checks if that route is better than the one it already has, and if it is, it adds it higher up than the old one in the routing table. And when it's done, it sends out all the routes it now knows of onwards to it's neighbours (only exception is that it doesn't send back routes to the router it got them from). This way the network as a whole learns of every network connected to every router in that network, and every possible path to take to get from one network to the other.

The crux in the matter is how the router determines which way is the "best" one to take, and this is where Route Costs and Distance Vectors come in to play. Every routing protocol takes a different approach to calculating the route cost or metric of a route. Distance vector protocols, such as RIP, looks at how many hops there are in a route, and calculates a metric from that, since fewer hops means faster processing since fewer routers have to forward the packet. This is quite old-school thinking, and dates from a time when routers were slow and bandwidth quite inconsequential. These days routers are quite fast, and the hop-count not that important. Newer protocols have been developed, and some use another approach called link-state. One such, OSPF, factor in a lot of different metrics, and are a lot more complex (OSPF factors in bandwidth and how it learned of a route for example).

1
  • The description in your first paragraph only applies to distance vector protocols. In link-state protocols, routers only tell other routers about the networks that are directly connected to them. All the routers use this information to create a list (usually called a "topology database") of which router has which local networks. Using that information, they figure out the best paths to get from themselves to any of the connected networks on the other routers, and build their routing tables accordingly. Choice of metric is independent of which method is used.
    – ebohlman
    Feb 20 '16 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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