Introduction to Routers and Routing

In this lesson, we will take a look at the difference between switches and routers and I’ll explain to you the basics of routing.

First of all…what is a router or what is routing exactly? A switch “switches” and a router “routes,” but what does this exactly mean?

We have seen switches and you have learned that they “switch” based on MAC address information. The only concern for our switch is to know when an Ethernet frame enters one of its interfaces where it should send this Ethernet frame by looking at the destination MAC address. Switches make decisions based on Data Link layer information (layer 2).

Routers have a similar task but this time we are going to look at IP packets and as you might recall IP is on the Network layer (layer 3). Routers look at the destination IP address in an IP packet and send it out to the correct interface.







Maybe you are thinking…what is the big difference here? Why don’t we use MAC addresses everywhere and switch? Why do we need to look at IP addresses and route them? Both MAC addresses and IP addresses are unique per network device. Good question, and I’m going to show you a picture to answer this:

400 computers 2 switches

We have two switches and to each switch are 200 computers connected. Now, if all 400 computers want to communicate with each switch, has to learn 400 MAC addresses. They need to know the MAC addresses of the computers on the left and right sides.

Now think about a really large network…for example, the Internet. There are millions of devices! Would it be possible to have millions of entries in your MAC-address table? For each device on the Internet? No way! The problem with switching is that it’s not scalable; we don’t have any hierarchy, just flat 48-bit MAC addresses. Let’s look at the same example, but now we are using routers.

400 computers 2 routers

What we have here is our 200 computers on the left are connected to R1 and in the 192.168.1.0 /24 network. R2 has 200 computers behind it, and the network we use over there is 192.168.2.0 /24. Routers “route” based on IP information. In our example, R1 only has to know that network 192.168.2.0 /24 is behind R2. R2 only needs to know that the 192.168.1.0 /24 network is behind R1. Are you following me here?

Instead of having a MAC address table with 400 MAC addresses we now only need a single entry on each router for each other’s networks. Switches use mac address tables to forward Ethernet frames, and routers use a routing table to learn where to forward IP packets to. As soon as you take a brand new router out of the box, It will build a routing table, but the only information you’ll find is the directly connected interfaces. Let’s start with a simple example:

routing table

Above we have one router and two computers:

  • H1 has IP address 192.168.1.1 and has configured IP address 192.168.1.254 as its default gateway.
  • H2 has IP address 192.168.2.2 and has configured IP address 192.168.2.254 as its default gateway.
  • On our router, we have configured IP address 192.168.1.254 on interface FastEthernet 0/0 and IP address 192.168.2.254 on interface FastEthernet 1/0.
  • Since we also configured a subnet mask with the IP addresses, our router knows the network addresses and will store these in its routing table.

Whenever H1 wants to send something to H2, this will happen:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You’ve Ever Spent on Your Cisco Career!
  • Full Access to our 786 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

1505 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags: ,


Forum Replies

  1. Dear Sir,

    I am really thanks for your lessons it’s help full for me

    again thanks

  2. My router is not showing the directly connected routes even after configuring the router.What could be the problem?

    Router#sh ip int br
    Interface              IP-Address      OK? Method Status                Protocol
     
    FastEthernet0/0        192.168.1.254   YES manual up                    down
     
    FastEthernet0/1        192.168.2.254   YES manual up                    down
     
    Vlan1                  unassigned      YES unset  administratively down down
    
    Router#sh ip route
    Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
           D - EIGRP, EX
    ... Continue reading in our forum

  3. Most likely it is a cable problem, or there is a speed/duplex mismatch between your router and the other side where it is plugged in.

  4. Hello David!

    An edge router is a router that is found at the “edge” of a corporate or an enterprise network, that is, at the location where you connect to the “outside world” be it the Internet or a private or public WAN. Edge routers are usually designed to handle large amounts of traffic for hundreds or even thousands of users. Additionally, edge routers have many functionalities that would be useful at the edge of a large network such as security, content filtering, dual or multi homed connections (connecting to multiple ISPs for redundancy) and others.

    Br

    ... Continue reading in our forum

18 more replies! Ask a question or join the discussion by visiting our Community Forum