Tutorials Logic, IN +91 8092939553 info@tutorialslogic.com
FAQs Support
Navigation
Home About Us Contact Us Blogs FAQs
Tutorials
All Tutorials
Services
Academic Projects Resume Writing Interview Questions Website Development
Compiler Tutorials

Routing

What is Routing?

Routing is the process of selecting the best path for data packets to travel from source to destination across one or more networks. Routers use routing tables to make forwarding decisions based on destination IP addresses.

Static vs Dynamic Routing

FeatureStatic RoutingDynamic Routing
ConfigurationManually configured by adminAutomatically learned via routing protocols
AdaptabilityDoes not adapt to network changesAdapts automatically to topology changes
OverheadNo routing protocol overheadRouting protocol traffic overhead
ScalabilityPoor (manual updates needed)Excellent
SecurityMore secure (no protocol to exploit)Less secure (routing updates can be spoofed)
Use CaseSmall networks, stub networks, default routesLarge, complex networks

Dynamic Routing Protocols

ProtocolTypeAlgorithmUse Case
RIPIGP, Distance VectorBellman-FordSmall networks (max 15 hops)
OSPFIGP, Link StateDijkstra (SPF)Large enterprise networks
EIGRPIGP, HybridDUALCisco networks
BGPEGP, Path VectorBest Path SelectionInternet backbone, ISPs
IS-ISIGP, Link StateDijkstraLarge ISP networks

IGP = Interior Gateway Protocol (within an autonomous system) | EGP = Exterior Gateway Protocol (between autonomous systems)

Distance Vector vs Link State

FeatureDistance VectorLink State
KnowledgeOnly knows neighbors and distancesComplete topology map
UpdatesPeriodic full table updates to neighborsTriggered updates (LSAs) flooded to all
ConvergenceSlowFast
Memory/CPULowHigh
LoopsProne to routing loopsLoop-free (SPF algorithm)
ExamplesRIP, IGRPOSPF, IS-IS

NAT - Network Address Translation

NAT allows multiple devices on a private network to share a single public IP address. It translates private IP addresses to public IP addresses and vice versa.

  • SNAT (Source NAT): Translates the source IP address. Used when private hosts access the Internet. The router replaces the private source IP with its public IP.
  • DNAT (Destination NAT): Translates the destination IP address. Used for port forwarding — incoming traffic to a public IP is redirected to a private server.
  • PAT (Port Address Translation) / NAT Overload: Maps multiple private IPs to a single public IP using different port numbers. Most common form of NAT in home routers.

Default Gateway

The default gateway is the router that a device uses to send traffic to destinations outside its local network. When a device doesn't have a specific route for a destination, it sends the packet to the default gateway.

Example: If your PC has IP 192.168.1.100/24 and default gateway 192.168.1.1, all traffic to non-192.168.1.x addresses goes to 192.168.1.1 (your router).


Ready to Level Up Your Skills?

Explore 500+ free tutorials across 20+ languages and frameworks.