Source Routing Example
This is meant to be an example, and not a complete load balancing configuration.
In this example, the router has two different providers with two different network blocks. This is a common setup for providers not running BGP that want to send traffic out different links for load balancing or traffic management purposes. Remember to save your configurations to flash whenever you are finished configuring source routing!
In our example above, we will be configuring "Router 1" to route traffic from 172.16.0.0/24 addresses out Serial1 and traffic from 192.168.0.0/24 addresses out Serial2. To edit the configuration, follow these steps:
1. At the Login: prompt, enter root.
2. At the Password: prompt, enter your password.
3.Choose Option 1 (Configuration and Update Menu) from the Main Menu. Select Option 3 (Network interface configuration).
4. Move to the bottom section of the configuration file (wan.conf) where the routing rules are located (Note: You may insert routes anywhere. Placing them at the end is done by convention.)
5. Add the source routing rules
The router will match all source addresses of 172.16.0.0/24 and apply the routing rules in the user-defined routing table 200. Similarly, the router will match all source addresses of 192.168.0.0/24 and apply the routing rules in the user-defined routing table 201. You can view the routing tables by using the command "ip route show" at the Bash shell, followed by the keyword "table" and the name of the table (in this example, the tables are "main", "200" or "201"):
imagestream:/usr/local/sand# ip route show table main
default via x.x.x.x dev Serial0
imagestream:/usr/local/sand# ip route show table 200
default via y.y.y.y dev Serial1
imagestream:/usr/local/sand# ip route show table 201
default via z.z.z.z dev Serial2
The addresses "x.x.x.x", "y.y.y.y" or "z.z.z.z" will be the IP address of the next hop in your output.
The completed file for our example should look like this:
# Add a default route in the main routing table
ip route add 0.0.0.0/0 dev Serial0
# Move 172.16.0.0/24 source addresses to a special routing table
ip rule add from 172.16.0.0/24 table 200
# Route all packets on routing table 200 via Serial1 by default
# This rule applies ONLY to table 200 and not the main table
ip route add default dev Serial1 table 200
# Move 192.168.0.0/24 source addresses to a special routing table
ip rule add from 192.168.0.0/24 table 201
# Route all packets on routing table 201 via Serial2 by default
# This rule applies ONLY to table 201 and not the main table
ip route add default dev Serial2 table 201
Remember to save your configurations to flash whenever you are finished configuring source routing!