2

I'm reading this article, and it says:

rhash_entries is the size of the hash table. If you don't specify it on the
kernel command line, it is computed dynamically based on the memory available
on your system. You can view its value by looking at something like IP route
cache hash table entries: 262144 (order: 9, 2097152 bytes) in the kernel logs.

But when I'm checking if there is the entry in kern.log or syslog, I can't find any.

If I understood this well, if I wanted to change the default size of the table, I should add rhash_entries= to the kernel line in extlinux/grub , but after doing so, there's also no "route" info in the logs.

I'm just trying to understand how the parameters in sysctl works (not only this one), but without knowing how to read and set rhash_entries, I won't understand how the route cache works.

Does anyone know something about this rhash_entries kernel parameter?

1

To check the current size run

$ cat /proc/sys/net/ipv4/route/gc_thresh
$ 1048576

Which is always set to the current route cache size.

To set this size, edit /etc/default/grub and modify the default line like so:

GRUB_CMDLINE_LINUX_DEFAULT="rhash_entries=1048576"

Then do not forget to run sudo update-grub! And reboot.

The massage your were looking for in the kernel log looks like this for me:

IP route cache hash table entries: 1048576 (order: 11, 8388608 bytes)
  • What if I have -1 in gc_thresh ? – Mikhail Morfikov Sep 15 '14 at 9:54
  • well, that is new for me :) maybe your kernel doesn't have route cache? It has been removed since 3.6 article.gmane.org/gmane.linux.network/238256 – er453r Sep 15 '14 at 10:07
  • @MikhailMorfikov the other possibility is that your route cache garbage collector runs every time the cache is modified since gc_thresh is always less then 0. – er453r Sep 22 '14 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.