0

I create some script for a static route, called "my.rc.route" and i put it on /etc/rc.local, so everytime the server get restarted the script shall run after all the startup process.

I feel a bit strange to find there were some line on my script being skipped by the system, randomly.

Anyone deal with this situation? Where to track/ log to read?

I paste my "my.rc.route" here, answered Gnudiff.

#!/bin/bash
ip ro add table arieluna 10.254.254.248/29 dev lan  proto kernel  scope link  src 10.254.254.254
ip ro add table arieluna 10.222.23.0/24 dev vlan17  proto kernel  scope link  src 10.222.23.1
ip ro add table arieluna 10.222.22.0/24 dev vlan16  proto kernel  scope link  src 10.222.22.1
ip ro add table arieluna 10.222.21.0/24 dev vlan15  proto kernel  scope link  src 10.222.21.1
ip ro add table arieluna 10.222.20.0/24 dev vlan14  proto kernel  scope link  src 10.222.20.1
ip ro add table arieluna 10.222.19.0/24 dev vlan13  proto kernel  scope link  src 10.222.19.1
ip ro add table arieluna 10.222.18.0/24 dev vlan12  proto kernel  scope link  src 10.222.18.1
ip ro add table arieluna 10.222.17.0/24 dev vlan11  proto kernel  scope link  src 10.222.17.1
ip ro add table arieluna 10.222.16.0/24 dev vlan10  proto kernel  scope link  src 10.222.16.1
ip ro add table arieluna 10.222.24.0/24 dev vlan18  proto kernel  scope link  src 10.222.24.1
Ta Coen
  • 240
  • 4
  • 13

1 Answers1

1

@Redmumba is on the right path here. If you try to add iptables rules for interfaces that aren't configured/up yet, then iptables will throw an error and the rules doesn't get added. This sounds to me like you are configuring at least one of your interfaces through NetworkManager or something similar (depends on your distro) and that part only happens when the user logs in through the GUI (i.e. after rc.local is executed).

If you want this to work, you would need to execute the script through an "up" command in /etc/network/interfaces (of you are on a Debian based distro) or similar mechanisms.

Alternatively you could configure your interfaces to be configured at boot time. Under Debian based distros, this is done by replacing the "allow-hotplug" keyword in the interface stanzas with "auto". Other distros will use other mechanisms for that, you would have to read the relevant man pages to find out what to do.

wolfgangsz
  • 8,767
  • 3
  • 29
  • 34
  • Thanks all for pointing that out. I run a bridge on vlan, and at the boot time some of bridge interfaces still in disable state. I remove the bridge interfaces and the problems gone. – Ta Coen Sep 06 '10 at 05:46