[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

/etc/init.d/network - route commands



This is of low/no importance; just an idea.

I've seen a lot of email from people wondering about the error messages
caused by the "route add -net" statements in /etc/init.d/network after
moving to a 2.2 kernel.  I was bit by the reverse of this the other day;
we upgraded a server from 2.0.36 to 2.2.9, and I commented out the
"route add -net" statements.  However, there was an error in the new
kernel and we had to revert to 2.0.36.  Guess what?  Networking was
really broken on reboot :)

Here's how I fixed it - very low tech, but it might help newbies which
is why I'm posting it here in hopes that someone might incorporate these
ideas into Debian's /etc/init.d/network (which package owns this file,
anyway?)

At the beginning of the file I added this statement:

  release=`uname -r`; major_release=${release%.*}

and I encapsulate the "route add -net" statements with an if:

  if [ "$major_release" != "2.2" ]; then
          route add -net 127.0.0.0
  fi

Note that this solution ignores 2.1.x kernels; I'm not sure if that's
important now that 2.2 is out.  In my case, it's not important.
However, I suppose you could do something like this:

  release=`uname -r`
  major_release=${release%.*}
  minor_release=${release##*.}
  if [ "$major_release" = "2.2" ]; then
          nonetroutes=1
  elif [ "$major_release" = "2.1" ] && [ $minor_release -gt 89 ]; then
          # 89 is probably wrong; substitute the correct minor version
          nonetroutes=1
  fi

  
  if [ -z $nonetroutes ]; then
        # route add -net statement
  fi

This is not intended to be an example of elegant scripting; I'm no
expert :)

--
Nathan Norman
MidcoNet  410 South Phillips Avenue  Sioux Falls, SD
mailto:finn@midco.net           http://www.midco.net
finger finn@home.midco.net for PGP Key: (0xA33B86E9)



Reply to: