FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 04-29-2010, 12:21 PM
Kimmo Koivisto
 
Default C5: correct place for routing scripts?

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@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-29-2010, 12:35 PM
James Hogarth
 
Default C5: correct place for routing scripts?

On 29 April 2010 13:21, Kimmo Koivisto <koippa@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@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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-29-2010, 12:59 PM
Kimmo Koivisto
 
Default C5: correct place for routing scripts?

2010/4/29 James Hogarth <james.hogarth@gmail.com>:
> 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

Thanks for your answer.

I am looking for a bit different thing here. Those are normal
destination based routes, I have source routing (and other routing
based on rules), for example:

ip rule add from 10.1.1.0/24 to 10.2.2.0/24 table EXAMPLE
ip route add default via 192.168.100.7 dev eth0 table EXAMPLE
ip route flush cache

etc

Regards,
Kimmo
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-29-2010, 01:27 PM
Kimmo Koivisto
 
Default C5: correct place for routing scripts?

> I am looking for a bit different thing here. Those are normal
> destination based routes, I have source routing (and other routing
> based on rules), for example:

This is the only way I found to do it, and might not be the best solution:

1. create /etc/sysconfig/network-scripts/ifcfg-zscripts with contents
DEVICE=dummy0
ONBOOT=yes

2. create /sbin/ifup-local executable with for example:
#!/bin/bash
if [ "$1" == "dummy0" ]; then
echo "running scripts"
ip...
arp...

fi




It will be executed for every interface, others that dummy0 are skipped.

I would like to use something else, if someone knows better way.


Regards,
Kimmo
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-30-2010, 06:51 AM
mkn0014
 
Default C5: correct place for routing scripts?

On 04/29/2010 03:27 PM, Kimmo Koivisto wrote:
>> I am looking for a bit different thing here. Those are normal
>> destination based routes, I have source routing (and other routing
>> based on rules), for example:
>>
> This is the only way I found to do it, and might not be the best solution:
>
> 1. create /etc/sysconfig/network-scripts/ifcfg-zscripts with contents
> DEVICE=dummy0
> ONBOOT=yes
>
> 2. create /sbin/ifup-local executable with for example:
> #!/bin/bash
> if [ "$1" == "dummy0" ]; then
> echo "running scripts"
> ip...
> arp...
>
> fi
>
> It will be executed for every interface, others that dummy0 are skipped.
>
> I would like to use something else, if someone knows better way.
>
>
> Regards,
> Kimmo
>

Check this out:
http://www.itsyourip.com/Linux/howto-add-a-persistent-static-route-in-redhat-enterprise-linux/

/Mats
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 04-30-2010, 02:29 PM
Robert Nichols
 
Default C5: correct place for routing scripts?

On 04/29/2010 07:21 AM, Kimmo Koivisto 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)

If you go to /etc/sysconfig/network-scripts and grep for
"if.*-local" you'll find several places where any scripts with those
names that exist in /sbin will be called when interfaces are brought
up or down. I generally put such scripts in /usr/local/sbin with a
symlink in /sbin.

--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 08:44 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org