Home > Articles > Networking > Routing & Switching

  • Print
  • + Share This

Sample Linux Router Setup

Keeping in mind all you have seen, consider a quick overview of a Linux router setup. I will show you a script that takes the setup illustrated in the beginning and turns on all the IPv4 traditional networking functions needed to perform traditional dynamic routing as you would see in countless small network connections.

So consider again the scenario. You have two networks, an Ethernet with IPv4 scope 192.168.1.0/24 and a Token Ring with IPv4 scope 10.1.1.0/24. The default router for the world as you know it is 10.1.1.1 on the Token Ring. You are running RIPv1 and want to participate in the dynamic routing scheme. You need to create one single script that will take your Linux system and turn on IP routing, configure the system, and enable dynamic routing. Here it is:

#!/bin/bash


# Turn on IPv4 packet forwarding


echo "1" > /proc/sys/net/ipv4/ip_forward

# We know our interfaces ...

/sbin/ifconfig eth0 192.168.1.254 netmask 255.255.255.0 broadcast 192.168.1.255
/sbin/ifconfig tr0 10.1.1.254 netmask 255.255.255.0 broadcast 10.1.1.255

# the above ifconfigs defined the routes also (2.2 kernel) so...

# default route

/sbin/route add default gw 10.1.1.1

# and enable RIP

/sbin/routed

exit 0

# Thats all folks....

Now this seems like a sneaky end to the chapter, but bear in mind the fundamental thought behind traditional IPv4 routing:

    All routing is a destination-driven process.

The rest of the chapter showed you how IPv4 is configured in the traditional manner and was intended as a quick refresher or overview. The rest of the book is concerned with the limitations of the traditional routing thought and the ways of Policy Routing.

Next Week: Chapter 2: Policy Routing Theory

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.