Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 10-22-2009, 06:30 AM   #1
LQ Newbie
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
Question 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??
Old 10-22-2009, 06:58 AM   #2
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
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.
Old 10-22-2009, 08:29 AM   #3
LQ Newbie
Registered: Oct 2009
Posts: 2

Original Poster
Rep: Reputation: 0
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.
Old 10-24-2009, 02:41 AM   #4
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
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.

1 members found this post helpful.
Old 08-30-2010, 01:34 AM   #5
LQ Newbie
Registered: Apr 2010
Posts: 4

Rep: Reputation: 0
Cool 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. MartianRabbit
Old 08-30-2010, 01:54 AM   #6
Registered: Mar 2005
Location: INDIA
Posts: 79

Rep: Reputation: 16
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.
Old 09-03-2010, 01:44 AM   #7
LQ Newbie
Registered: Apr 2010
Posts: 4

Rep: Reputation: 0
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! MartianRabbit
Old 10-18-2014, 02:55 AM   #8
LQ Newbie
Registered: Oct 2014
Posts: 1

Rep: Reputation: Disabled
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.


increase, routing, size, table

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
In Linux, How to read and modify Kernel IP routing table entries from a c program sakthivelbatusai Linux - Networking 1 03-29-2007 07:36 AM
deleting entries in routing table mwagz Linux - Networking 1 01-30-2007 02:13 PM
Need help creating routing table on linux itrap2003 Linux - Networking 5 06-25-2004 10:18 PM
Linux Routing Table Zepiroth Linux - Networking 11 01-28-2004 02:29 AM
How to save routing table entries? drgowans Linux - Networking 6 09-23-2003 03:35 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:03 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration