OpenWrt Forum Archive

Topic: Advanced Routing

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm trying to figure out how to add more routing table so that I can follow the guide found at http://lartc.org/howto/.  On any other 'nix box it would be /etc/iproute2/rt_tables but that file is not found and creating it did nothing.  I have done 'ipkg install ip' but is there an 'ipkg install iproute2' I am missing?

--mgb

LSU_guy wrote:

The package your are looking for you is called "ip"

Re-read my post.  I have installed this already.  What I'm lacking - from previous experience with LARTC - is the ability to add additional routing tables.  I'm using a WRT54GL and unless I'm able to do source-based routing through additional tables, I doubt load balancing will succeed. 

Thanks for you response but anybody else willing to take a stab at this one?

--mgb

I've added additional routing by adding a script in //etc/init.d that contains a bunch of 'ip route add .... ' commands. It should be executed after S40network ran, which sets the default routes. I rerun it at regular intervals under crond on boxes that have ppp0 connection being started and stopped. If a route already exists ip ignores the command to add it again.

But I don't think you can create this type of routing policy database using a series of 'ip route add ...' commands can you?  I think I am lacking the ability to create new routing tables of my own.  Like I said on any other 'nix box this is done using the /etc/iproute2/rt_tables file and the iproute2 package.  Once I can create that type of database, I will be able to route for multiple uplinks. I've read, re-read and re-re-read this guide and was successful on my Gentoo Linux box, but I want to do this on a couple of spare WRTs I have laying around - potentially becoming a 4-port WAN routers.  Please someone ... anyone?

--mgb

Just read the link http://lartc.org/howto/lartc.rpdb.html you gave and tried the 'ip route list table local' command. It shows the extra routes defined in ny start-up script. To me the examples given appear to be nothing more than some additional ip commands and the definition of named tables for ease of readability. Why couldn't they be issued from a start-up script ?

You need the ability for multiple default routes and this can be done in a single  table.  You need the ability to separate incoming traffic so that it is routed back out the same interface.  Then for outgoing traffic, you use the multiple default gateway statement as show in the guide.  This effectively load balances outgoing traffic over the two links but also ensures incoming traffic goes back out the interface it originated from.  This is where I think the need for multiple tables comes in.

--mgb

The package contains everything you need. It doesn't include /etc/iproute2/rt_tables,
but you can easily create this file yourself.
Just open /etc/iproute2/rt_tables using vi, and add:
255     local
254     main
253     default
0       unspec

Then add whatever additional tables you need.
Note, however, that /etc/iproute2/rt_tables is needed _only_ for translating table-names
into table-numbers. You can ignore this file alltogether, and just use numbers instead of
names for your tables.

The discussion might have continued from here.