-   Linux - Networking (
-   -   To Increase routing Table Entries in a Linux box. (

adassss 10-22-2009 06:30 AM

To Increase routing Table Entries in a Linux box.
hi ,
I need to routing table entries.How can it be done.
using Script i'm adding entries into routing supports upto 250.but i need to add more than this limit.
is there any way that we can tweak kernel code and increase the limitation??

xeleema 10-22-2009 06:58 AM

You need to add more than 250 routing table entries? Wow.
Okay, for starters, you do know that you don't have to specify a route for each individual host, right?
You can specify network-based routes.

As for increasing the 250 route limit...I didn't even know there was one. I imagine there's something in the kernel source, but that would require a kernel recompile for the changes to take effect (which is not a small undertaking).

Please provide the distribution you are using, as well as an example of what/how you are trying to route.

Also, "man route" may really help you out, here.

adassss 10-22-2009 08:29 AM

this is for simulation purpose.i'm just going to create virtual interfaces and route packets through these interface.
I want to know which part of kernel code should be tweaked so that i can increase the number.

man route tells you how to add r delete entries ,no where it tells which file should be meld to increase it beyond i need to get into kernel code to meld plz guide me in this path.

xeleema 10-24-2009 02:41 AM

Alright, for starters, I'm not sure about the 250-route-limit you're talking about.
However, here's what I would suggest;

When you want to ask kernel-specific questions, include your Linux Distro's name, the version of your kernel, and what you're trying to do.

What you're trying to do sounds more like "tweaking" rather than "Oh, where's that routing.c file for the kernel?" Messing with one of the available settings in /proc sounds more up your alley.
Visit this site, or read your kernel's documentation (as *that* would be the most relevant source of information).

Use iproute2 for any advanced routing.
If you're running Red Hat, CentOS, or something similar, there should be a package in your yum repository.
If you get completly lost, you can visit here for an example of how iproute2 works.

Regardless, if you're new to Linux, and you're still not able to create 250 routes to virtual interfaces for testing, then there's one last site that might help explain things.
Be warned, you'll have to have a sense of humor. :)


MartianRabbit 08-30-2010 01:34 AM

If there is a route limit, I haven't found it yet
I know this is an old thread with a new post.

I was doing some research to find if there was a limit to adding routes in a Linux kernel. Could be days of reading google output, but my last 2 hours of searching have not found any threads pertinent. So I am Still looking but wanted to drop a note on this old thread.

Slackware Distro 13.0 is what I am using and used the route command to add routes to point to the loopback (lo) interface (a Virtual Interface) as a means to null route. I have scripted 990 routes in and the kernel didn't even blink. A `/sbin/route -n | lc -l` yields the count and just the `/sbin/route -n` shows them all. All my tests indicate packets traversals are being dropped.

The Slackware is installed on an Acer One Netbook with a N270 processor. It took 3 seconds to apply it. Bouncing the interface with the rc.inet1 script clears the table out quickly.

If I do find an answer, I will report back with the limit. I may just have to fake in a bunch of routes to see if it does puke. But if I could go over let say 5000 routes, I would be happy I could add the 5000 and would prove the concept proposal I am working on. :study: MartianRabbit

kapsikum 08-30-2010 01:54 AM

i remember once i wrote a script to add host based routes starting from class A address and the test was just to see how many route i could add before the system appears hang and before it went unresponsive i remember it had added around 26,4000
routes to its routing table.

So is it addassss that the routes you are trying to add belong to class C with a subnet mask of In such a case u wont be able to go beyond 253 routes in that subnet. what you can do is modify your script to change the subnet masks or class.

hope that helps.

MartianRabbit 09-03-2010 01:44 AM

That is a nice size limit

It is helpful someone flushed out how many entries it could take. My experiment does use the concepts of networks, and the table size can be tuned to encompass large spans with the proper masking, so my intention would stay well inside this limit. The limit exceeds my expectations on the number of entries I would need to accomplish the end state of the experiment. I noted you comma is in a odd place, could you respecify if you intention to express 26,400 or 264,000. There is quite a difference in magnitude. if you are saying a quarter million that is incredible. Even the 26,400 exceeds my expectations! :eek: MartianRabbit

guoger 10-18-2014 02:55 AM

net.ipv4.route.max_size = 2147483647
Not sure whether this applies but net.ipv4.route.max_size = 2147483647
I am using Ubuntu 14.04

Just wondering whether this is correct size or I am missing some points here. I am also doing this for research purpose.

All times are GMT -5. The time now is 04:19 PM.