What is Routing and Switching? And how it Works?

Posted March 1, 2013 by Alice Julia in Cisco
what is routing and switching

Router is a device that directs traffic (data packets) among different networks. These days many organizational networks are interconnected on the basis of routers. Whenever the router receive data it must have destination address in order to send it there, so in order to figure this out router use the gateway address and routing tables.

The Default Gateway

Default gateway is the path uses by router in order to sent data to remote networks; the default gateway is an IP address. Default gateway is required to send packet information to another network as it helps in order to figure out the destined location.  Without default gateway, it is not possible to establish internet communication if you doesn’t have any way to send data to other destination networks. The default gateway can be configured automatically using DHCP.

Routing Tables

In order to send data to the required destination, one must have to figure the most efficient path available over the network; it’s like deciding your route. To figure out the best routing path, routing tables are used. Every computer connected to a TCP/IP network contains routing table and one should maintain routing table efficiently to ensure effective data delivery. The figure below shows routing table in Windows 7.

 Routing Table

The routing table provide following information:

  • Destination: Host IP address
  • Network mask: It provides subnet mask for the required destination.
  • Gateway: The gateway could be router, gateways server or any other system acting as a gateway, where IP address should be sent.
  • Interface: It provides interface address that is required to send data to the destination.
  • Metric: It determines the most direct path towards destination, the lower the metric is the faster the route is and if more than one routes are available, the one with lowest metric will be selected.

Routing table has become an essential element of networks, as it is required figure out the best routing paths between networks. In order to have effective network, the routing table should remain updated. The router can determine routing table information by two different ways, Static Routing and Dynamic Routing.

What is Static Routing?

In the networks based on static routing, the routing table information is added manually. You have to adding all the details of routing table manually which is a time taking task and the chance of era is high as well. Furthermore, if you perform any changes to the network structure you have to change routing table information again which is quite hectic as well, that’s why it is only preferred for small environments.

Using ‘route add’ command you can enter static route information in the routing table. To configure static route, you have provide network mask and IP address of the network card using which the data will be forward to the destination.

route add syntax is given below:

route add mask (

Static address configurations are not permanent, once the system reboot the settings will gone so to make it permanent add Switch in the command.

What is Dynamic Routing?

In dynamic routing networks, routers work on the basis of special routing protocol to establish communication. With the help of routing protocols, the routers exchange information with each other in order to build routing table. Two types of routing protocols are used to in dynamic routing:

The Older Distance-Vector Protocols

 In distance-vector router communication, the router exchange information about all the routes to the routers it is directly connected to which means it will only communicate with the neighboring routers, ignoring the fact that there might have other routers present over the network.

The distance vector communication is known as hops, each router in the network is hop. For instance, if a network is using six routers, than there are five hops between the first and last router. In order to figure out the number of hops towards targeted location enter tracert comptia.org in command prompt as shown in figure below:

tracert result

These days the in use distance-vector routing protocols are: Routing Information Protocol (RIP and RIPv2), Border Gateway Protocol (BGP) and Enhanced Interior Gateway Routing Protocol (EIGRP).

  • RIP: This distance-vector routing protocol support maximum 15 hops. According to its specification the router should generate update every 30 seconds, this seems fine for small network but when it comes to complex network the traffic load will increase. Also RIP doesn’t offer router authentication which makes vulnerable.
  • RIPv2: The newer version offers router authentication in order to ensure secure transmission, also it has changes broadcast discovery method to multicast method just to minimize traffic congestion. But RIP and RIPv2 both are limited to 15 hops.
  • BGP: It is the most frequently associated internet protocol and it is used between gateways hosts over the internet. BGP consult the routing table that contains the list of all the reachable routers and each path contains cost metric using which it can figure out the best routing path, beside this it establish communication between routers on the basis of TCP/IP.
  • EIGRP: It is the most effective routing protocol up till now as it grabs routing information with the help of neighboring routers and keeps a record of their routing information. EIGRP figures out the best routing path with the help of Diffusing Update Algorithm (DUAL), which is quite efficient.

The distance-vector protocol grabs exchange complete routing information from other routers which include, the routing information of the routers connected to them directly. Based on their routing information it compiles its own routing table. Every router send update every 30 seconds depending on the protocol, despite of these regular updates you can configured you router to get triggered update, if any change occur in the network. The process of getting updates regarding network changes is called convergence.

Sometimes because of slow convergence Routing Loop can occur on the network, which often happens when routers respond slowly. There are two ways to cope up with this problem:

  • Split Horizon: Prevent router from advertising the same information back to the router its received from, this way you can prevent packet from bouncing back and form a loop.
  • Poison reverse: It sets the hop counts (towards the interface it learned information from) to infinity which indicates the node that router is unreachable.

Drawbacks of Distance-Vector Protocol

Despite of maintain routing tables, distance vector protocol has several issues such as:

  • The regular updates slow down the update process.
  • Consistent updates caused traffic congestion as it keeps on sending same updates because the change in network structure occurs rarely.
  • The most prominent issue is that it only has information to the next hop, which means any wrong information can create routing loop.

The Newer Link-State Protocols

The routers using link-state protocols work more efficiently then distance-vector protocols as it establishes the map of entire networks it connected to and save it in the router memory. It generates Link-State Advertisements (LSAs) to the other routers so that they can create their own network maps as well.

Once the mapping is complete, all the routers exchange their maps with each other on the basis of regular updates just like distance-vector protocol but the updates on link-state protocol are less frequent. The only other update generated between the routers depends on the change in network topology and the information exchange with the help of LSAs, it enables routers to update their routing tables. Because of this mapping strategy, convergence has become fast and efficient.

Well, it might seems that link-state protocol is better than distance-vector protocol but the thing is that link-state protocol acquire more router resources such as RAM and other hardware resources as it has to create and stored the map of entire network. As compared to that distance-vector protocol has to maintain database only which contain routing table information of the routers connected to it.

  • Open Shortest Path First (OSPF): Link-State protocol is formed on the basis of Shortest Path First (SPF) algorithm to figure out the least cost path to the destination. OSPF sends the list of all the neighbor routers to the entire network so that they can design the map of entire network based on shortest path.
  • Intermediate System-to-Intermediate System (IS-IS): It figures out the shortest path for the data to travel using SPF algorithm and distribute network structure to all the routers so that they can choose the most short and efficient routing paths.

The OSPF is preferred for medium to large networks because of its tunneling feature whereas IS-IS is recommended for large ISP networks because of its reliability and flexibility.

As we have discussed routing protocol the nest phase is to understand IGP and EGP.

  • Interior Gateway Protocols (IGPs): IGP is used to exchange routing information between routers, it’s not a protocol itself by it categorize the link-state protocol scope for instance, it allow routers to exchange information within the LAN or interconnected LANs. The IGP works on the basis of both distance-vector protocol (RIP and IGRP) and link-state protocol (OSPF-ISIS).
  • Exterior Gateway Protocols (EGPs): As the scope of IGP is limited within the network, the EGP is used to send information outside the network such as internet. EGP used distance-vector protocol to exchange information over the network; BGP is an example of EGP.

Routing Metrics

Some of the routing metrics you should know are:

  • Hop Counts: Total number of hops that are required to reach the destination node.
  • Maximum Transmission Unit (MTU): The maximum data unit that can be transmitted without any fragmentation is called MTU.
  • Bandwidth: The maximum number of packets that can be transmitted over the internet.
  • Costs: The number that represents the distance between A to B often counted as hops. The lower the cost is the better the path is.
  • Latency: The passage of time that is required by a packet to travel from one location to another.

How to Configure Routers and Switches?

Power over Ethernet (PoE)

The power over Ethernet or PoE technology provides power to twisted-pair Ethernet cable in order to transmit data. The PoE sends power along with data to the remote devices which may include switches, wireless access points, voice over IP (VoIP) equipments and more.

The best feature of PoE is that it offers central power management which means you don’t have to provide separate power to all the remote devices as they required Uninterrupted Power Supply (UPS). Beside this administrator can easily power up or down the remote devices.

The Spanning Tree Protocol (STP)

An Ethernet-card can support only one active path between networks, it the multiple paths are active at the same time it will cause switching loop, so in order to prevent switching loop STP is assigned.

STP is used with switches and network bridges, based on Spanning Tree Algorithm (STA) it prevent switching loops. STA enable bridges and switches to figure out network loops dynamically. Both STA and STP are design to prevent looping, whenever any bridge or switch fails it notify all other bridges about the issue and STA generate new spanning tree which is than routed to other bridges as well.

The STP used Bridge Protocol Data Unit (BPDU) to identify problem over the bridges or ports and exchange it with other ports and bridges via messages. In order to resolve loop in the network you can take several measures:

  • Blocking: The blocked port doesn’t forward BPDU messages to other ports or switches.
  • Disabled: Disabled port cannot receive BPDU messages.
  • Forwarding: The port is part of active spanning tree and it forward BPDU messages to other switches.
  • Learning: The port is not a part of active spanning tree but it keeps track of all the activities so that if in case any port fails, it can take over.
  • Listening: It receives BPDUs messages and identifies changes in the network topologies.


The term trunking in networking is refers to use multiple network cables or ports in parallel in order to enhance link speed. The higher-capacity trunking link is used to connect switches to create large network.

Port Mirroring

Network administrator needs a way to figure out network traffic and switches performance for which port mirroring is used. The administrator configure a copy of all outbounds and inbound links and send it to a certain port, where protocol analyzer examines the data sent to the port and doesn’t not interrupt the flow of traffic.

Port Authentication

Port authentication is required by user in order to connect to the LAN. One standard that provide port authentication is 802.1x, without port authentication user cannot access LAN.

About the Author

Alice Julia

Hey everyone, I’m Alice! By profession I’m an article writer and with this I have validations from Cisco and CompTIA for being a certified professional.

One Comment

    mishi Jen

    Precisely written, i am going to attempt cisco routing exam: i think this information will help me a lot going through this. cheers for sharing routing and switching details.

Leave a Response


Call Us
U.K: +44 207 993 5004
Canada: +1 226 479 6009
U.S.A: +1 631 674 2000