Router

Nerd Cafe

Introduction

A network router is a critical device in networking that connects multiple networks and directs data packets between them. It plays a key role in ensuring efficient communication between devices on different networks, including the internet.

In this lesson, we will cover:

  • What is a Router?

  • Router Functions

  • Types of Routers

  • Routing Tables and Protocols

  • Configuring a Router (Practical)

  • Troubleshooting Routers

1. What is a Router?

A router is a device that forwards data packets between networks. It operates at Layer 3 (Network Layer) of the OSI model and determines the best path for data to travel.

Example:

When you visit www.google.com, your home router forwards your request to the ISP, which then routes it to Google’s servers.

Key Components of a Router:

  • CPU (Processor): Handles data processing.

  • Memory (RAM, ROM, Flash, NVRAM): Stores configuration and temporary data.

  • Interfaces (Ports): Ethernet ports for connecting devices.

  • Routing Table: Maintains network paths.

2. Router Functions

A router performs several key functions:

2.1 Packet Forwarding

  • Uses the routing table to determine the best path.

  • Works with IP addresses (not MAC addresses like switches).

2.2 Network Address Translation (NAT)

  • Allows multiple devices in a private network to share a single public IP.

  • Essential for home and enterprise networks.

2.3 Dynamic Host Configuration Protocol (DHCP)

  • Assigns IP addresses dynamically to devices.

2.4 Firewall and Security

  • Some routers have firewall features to block malicious traffic.

2.5 Quality of Service (QoS)

  • Prioritizes certain types of network traffic (e.g., VoIP over regular browsing).

3. Types of Routers

Routers can be classified based on their usage:

3.1 Wired Routers

  • Connect to a network via Ethernet cables.

  • Example: Cisco enterprise routers.

3.2 Wireless Routers

  • Provide Wi-Fi connectivity.

  • Common in homes and offices (e.g., TP-Link, Netgear).

3.3 Core Routers

  • High-performance routers used in large networks (e.g., ISPs).

3.4 Edge Routers

  • Connect internal networks to external networks (like ISPs).

3.5 Virtual Routers

  • Software-based routers (e.g., used in cloud networking).

4. Routing Tables and Protocols

A router makes forwarding decisions based on the routing table and routing protocols.

Topology

4.1 Routing Table

A routing table contains:

  • Destination Network: The target network.

  • Next Hop: The next router to forward the packet.

  • Metric: The cost of the path.

Example of a Routing Table (Cisco CLI Output)

R1#show ip route 
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/30 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, Serial0/0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
S    192.168.2.0/24 is directly connected, Serial0/0/0
R1#

4.2 Routing Protocols

Routing protocols help routers exchange information and update their tables.

Types of Routing:

  1. Static Routing: Manually configured routes.

  2. Dynamic Routing: Uses protocols to update routes automatically.

Common Routing Protocols:

  • RIP (Routing Information Protocol) – Uses hop count.

  • OSPF (Open Shortest Path First) – Uses link state.

  • BGP (Border Gateway Protocol) – Used on the internet.

5. Configuring a Router (Practical)

5.1 Setting Up a Cisco Router (Basic Configuration)

We will configure a Cisco router using Packet Tracer or a real router.

Step 1: Connect to the Router

  • Use a console cable and connect it to a PC.

  • Open PuTTY or Tera Term to access the router’s CLI.

Step 2: Enter Privileged Mode

Router> enable
Router# configure terminal

Step 3: Set a Hostname

Router(config)# hostname R1
R1(config)# h

Step 4: Configure an Interface (Assign IP Address)

R1(config)# interface FastEthernet0/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown

Step 5: Configure Routing (Static Route Example)

R1(config)# ip route 192.168.1.0 255.255.255.0 10.0.0.2

Step 6: Save Configuration

R1# write memory

6. Troubleshooting Routers

6.1 Checking Connectivity

Use ping to test connectivity.

R1#ping 192.168.1.100

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.100, timeout is 2 seconds:
!!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/1 ms

R1#ping 192.168.2.100

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 6/11/18 ms

R1#

6.2 Viewing the Routing Table

R1#show ip route 
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/30 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, Serial0/0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
S    192.168.2.0/24 is directly connected, Serial0/0/0
R1#

6.3 Checking Interface Status

R1#show ip interface brief 
Interface              IP-Address      OK? Method Status                Protocol
 
FastEthernet0/0        192.168.1.1     YES manual up                    up
 
FastEthernet0/1        unassigned      YES unset  administratively down down
 
Serial0/0/0            10.0.0.1        YES manual up                    up
 
Vlan1                  unassigned      YES unset  administratively down down
R1#

Conclusion

  • A router directs network traffic and connects multiple networks.

  • Uses routing tables and protocols (Static, OSPF, RIP, BGP, etc.).

  • Can be configured using CLI (Cisco routers).

  • Troubleshooting involves checking routes, interfaces, and logs.

Keywords

router, network router, routing table, static routing, dynamic routing, OSPF, RIP, BGP, NAT, DHCP, firewall, QoS, packet forwarding, IP address, gateway, Cisco router, WAN, LAN, subnet mask, troubleshooting, نتورک پلاس

Last updated