[CentOS] C5: correct place for routing scripts?

Thu Apr 29 12:35:24 UTC 2010
James Hogarth <james.hogarth at gmail.com>

On 29 April 2010 13:21, Kimmo Koivisto <koippa at gmail.com> wrote:
> Hello
>
> I have several Centos 4 and Centos 5 servers. Because of the nature of
> the environment, there are some static arp entries made with arp
> command and then source routing made with "ip rule/ip route"
> -commands.
>
> Those commands are now placed at /etc/rc.d/rc.local which is bad: if
> server is rebooted, those commands will be done correctly but if
> administrator restarts network with "/etc/init.d/network restart",
> source routes will disappear.
>
> RedHat/Centos qualified admin knows only about network restart init
> script, so I try to avoid doing any hacks.
> I could edit the init script (/etc/init.d/network) but changes could
> disappear with updates.
>
>
> So, what is the correct place for different commands (arp, ip,
> whatever) that is executed
> (a) once when network started
> (b) once when network stopped (I don't need but nice to know)
> (c) once per every interface (I don't need but nice to know)
>
>
> Best Regards,
> Kimmo
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>

For static routes on a Centos/Redhat box you can use
/etc/sysconfig/network-scripts/route-ethX

Example syntax for file:

10.243.248.0/24 via 10.243.251.254
10.243.252.0/24 via 10.243.251.254
172.20.220.0/24 via 10.243.251.254

Can't say I've ever had to set up static arp caches/values....

James