Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 9439 - Addition of extra routes to network interface
Summary: Addition of extra routes to network interface
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 7270
Blocks:
  Show dependency tree
 
Reported: 2002-10-21 12:16 UTC by CJ Kucera
Modified: 2004-01-27 14:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
rcscripts-extra-routes.patch (rcscripts-extra-routes.patch,3.44 KB, patch)
2002-10-21 12:17 UTC, CJ Kucera
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description CJ Kucera 2002-10-21 12:16:09 UTC
My system requires that, in addition to the two IP addresses assigned to my NIC
(eth0), I also establish an extra "route."  The command that I've been using to
provide this route is:

  route add -net 10.1.0.0 netmask 255.255.0.0 gw 172.30.30.1 dev eth0

Previously, there wasn't any way to automate this via the /etc/conf.d/net and
/etc/init.d/net.eth0 scripts, so I've created a patch which will do what I want.
 Basically, using my patch, you could add these three lines to /etc/conf.d/net
to achieve my desired result:

route_eth0="10.1.0.0"
route_netmask_eth0="255.255.0.0"
route_gateway_eth0="172.30.30.1"

If more than one route is desired, you can add more values with spaces (similar
to how aliases are currently handled), like so:

route_eth0="10.1.0.0 10.2.0.0"
route_netmask_eth0="255.255.0.0 255.255.0.0"
route_gateway_eth0="172.30.30.1 172.30.30.2"

The enhancements to /etc/init.d/net.eth0 save all three of those lines as
"options" inside /mnt/.init.d, but I couldn't think of a better way to safely
remove all the route information.  However, one could certainly argue that
there's no real need to manually take down the routes when eth0 is brought down
because the routes will just disappear anyway if eth0 comes down.  So I can
submit a different patch if it's decided that there's no need to store this
information.

I've created the patch based off of
/usr/portage/sys-apps/baselayout/files/rc-scripts-1.4.1.tar.bz2, which is the
latest version of the rc-scripts available currently.  It will apply cleanly to
this package.

As always, comments and suggestions welcome.
Comment 1 CJ Kucera 2002-10-21 12:17:09 UTC
Created attachment 4867 [details, diff]
rcscripts-extra-routes.patch

This is the patch.  Untar rc-scripts-1.4.1.tar.bz2 and then apply.
Comment 2 Martin Schlemmer (RETIRED) gentoo-dev 2002-10-25 16:14:51 UTC
It makes things too complex.  net.eth0 is already too complex.

Our official standing is to keep things simple, but sufficient for the avarage
user, yet not too complex so that he cannot change it to suite his needs/liking. 
And with CONFIG_PROTECT, you can rest asure that your changes will not be blown
away.
Comment 3 CJ Kucera 2002-10-25 16:17:07 UTC
Groovy.  I'll just post it to the forums under Tips+Tricks or something, in case
somebody else needs this functionality...