Disable Routing Cache on Ubuntu 12.04.5 LTS

Christian Benz christian at c-benz.de
Thu Mar 26 08:29:41 UTC 2015


Am 25.03.2015 um 18:14 schrieb Guruprasad Kulkarni:
> Hi,
>
> I am using Ubuntu 12.04.5 LTS and have a couple of static routes on it.
>
> The IP Address is 192.168.10.23 and the default gateway is 192.168.10.1
>
> I added a couple of static routes to it so that it reaches a 
> particular IP address using a different gateway
>
> route add -net 10.24.78.0 netmask 255.255.255.0 gw 192.168.10.99 dev eth0
>
> ​This seems to work for a few days and then suddenly it forgets that 
> it is supposed to use the different gateway to reach that ip address. 
> It instead uses the default gateway
>
> So instead of going through 192.168.10.99, it tries reaching 
> 10.24.78.x through 192.168.10.1
>
> The static route is still in place (verified by netstat -rn). The 
> route table has not changed.
>
> I did a "ip route flush cache" and this brought things back to normal.
>
> So my question is, how do I disable this caching permanently? If this 
> is not advisable, what are the other options?
>
> I tried setting /proc/sys/net/ipv4/route/max_size to 0, but this value 
> default to 214748364 on reboot.​
> ​If not mistaken, this sets the max size of the cache?
>
>
> -- 
> -Guruprasad
>
>
Hi Guruprasad,

I had similar problems. I am not sure if this really helps but you could 
give it a try:
Set the route via /etc/network/interfaces

For example:

|auto eth0
iface eth0 inet static
       address 192.168.1.2
       netmask 255.255.255.0
       up route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1

|

|Using this method the route gets set each time the interface goes up.|
||
Hope this helps

Christian




More information about the ubuntu-users mailing list