Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 288421 - sys-apps/openrc-0.5.1 new-style network doesn't support static routes
Summary: sys-apps/openrc-0.5.1 new-style network doesn't support static routes
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-10 12:27 UTC by Albert W. Hopkins
Modified: 2009-12-02 15:44 UTC (History)
5 users (show)

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


Attachments
emerge --info (emerge_--info.txt,3.64 KB, text/plain)
2009-10-10 12:28 UTC, Albert W. Hopkins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Albert W. Hopkins 2009-10-10 12:27:51 UTC
Previously I had

    routes_eth0="..."

In my /etc/conf.d/net, but since upgrading openrc and using the new-style network config it doesn't seem to apply the routes.  I looked at the init script and it seems to only support defaultroute, or possibly I am doing something wrong.  I did not see any documentation for setting up static routes.

Also, if i use ip_eth0 instead of ifconfig_eth0 the script appears to set up the interface but it doesn't appear to be up.  I have to manually run "ip set eth0 up".
Comment 1 Albert W. Hopkins 2009-10-10 12:28:37 UTC
Created attachment 206647 [details]
emerge --info
Comment 2 Heiko Liebman 2009-10-12 02:10:01 UTC
I had the same problem that my eth0 got an ip but no route.

Later i found out that setting defaultroute="xxx...." in /etc/conf.d/networks
did the trick.So it solved my problem and openrc works like a charm now.

I am not sure if this is the new way to set the default route because i also had the USE flag "oldnet".

Hope that helps.
Comment 3 Albert W. Hopkins 2009-10-12 03:15:43 UTC
(In reply to comment #2)
> I had the same problem that my eth0 got an ip but no route.
> 
> Later i found out that setting defaultroute="xxx...." in /etc/conf.d/networks
> did the trick.So it solved my problem and openrc works like a charm now.

I have defaultroute.  My issue is not setting up the default route but setting up individual routes.
Comment 4 dacook 2009-10-13 15:56:02 UTC
Ditto - this is a show-stopper for dropping the "old" style configuration, and has nothing to do with adding default routes.  Hopefuly the syntax and functionality will stabilize soon and we won't keep having these major shifts in them every several months.
Comment 5 Roy Marples 2009-10-16 07:10:10 UTC
http://roy.marples.name/projects/openrc/changeset/baeb59cd2e7bc68e95c8fb3f94ecb0c7d6e54589

A new init script with matching conf.d to handle static routes.
Comment 6 William Hubbs gentoo-dev 2009-10-19 16:13:01 UTC
All,

The script mentioned above is included in 0.5.2.  Please configure your
static routes in /etc/conf.d/staticroute and add staticroute to your
default runlevel.  Report back here if this resolves the issue.
Comment 7 William Hubbs gentoo-dev 2009-10-19 16:24:00 UTC
Please report back to the bug if this works or not.

I did not mean to close it yet.

Comment 8 Albert W. Hopkins 2009-10-19 17:39:42 UTC
Greetings, William.

Thanks for the update to openrc.  I noticed that the oldnet USE flag has been removed. Does that mean the old-style interface is no longer available?

I have tried again with openrc-0.5.2.  But I still cannot get my static route to apply.  I have in /etc/conf.d/network:

    routes_eth0="192.168.36.0/24 via 192.168.31.11"

When I bring up the network service I see that my eth0 interface is up. When i type "netstat -rn" I can see the route for my localnet (eth0) and loopback, but not the static route entered above.  If I set "defaultroute=..." in the config file I also get my default route.

I also tried

    routes_eth0="192.168.36.0/24 via 192.168.31.11 default via 192.168.31.1"

This is the way I had it configured before the new system.  When I do this my default route appears in "netstat -rn" as if the script read routes_eth0, but my static route did not appear.  I am able, however, to ping the interface that the static route points to.  And if I enter the route manually it also works, but for some reason /etc/init.d/network ignores it.

As an aside, I still have an issue when i use iproute2 as opposed to ifconfig, but I will open another bug report for that.

Thanks you.
-a
Comment 9 William Hubbs gentoo-dev 2009-10-19 18:34:02 UTC
Hello,

Both styles are still available.  What the oldnet flag did was remove
the old style if you turned it off, but now we install both of them.

Too set up your static routes with the new style, you need to set them
up in /etc/conf.d/staticroute then add the staticroute service to your
default runlevel.  The only route that should be set in
/etc/conf.d/network is defaultroute.  routes_eth0 is not used.

Thanks,

William

Comment 10 Albert W. Hopkins 2009-10-19 20:36:06 UTC
(In reply to comment #9)

> Too set up your static routes with the new style, you need to set them
> up in /etc/conf.d/staticroute then add the staticroute service to your
> default runlevel.  The only route that should be set in
> /etc/conf.d/network is defaultroute.  routes_eth0 is not used.

Dear William,

Why 2 services/config files just to set up a single ethernet interface?  The routes and ip seem interdependent.  Just as in this example, troubleshooting problems will be more difficult because one must remember to check in two different places.

The staticroute config file: does it only use the variable "staticroute"?  If you have multiple static routes do you put them all that one variable or is there a naming convention?  If it only uses the one variable then why have a separate file for it?

Is the plan to continue to support both old-style and new-style networks or will new-style eventually be a requirement?

thanks,
Albert
Comment 11 William Hubbs gentoo-dev 2009-10-19 21:07:56 UTC
The decision to make the staticroutes a separate service was made by
upstream (see /usr/share/doc/openrc-0.5.2/README.net).

For now we are supporting both network styles.  I do not know if old
style networking will go away or not.

I am researching how to add multiple routes; I will post back shortly
regarding that subject.
Comment 12 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-10-19 21:10:30 UTC
I think I speak at least for me (for sure) and Robin (probably?) when I say that the old style, if removed from openrc, will be re-added externally.

As in: no, the new one does not even start cutting it for me.
Comment 13 William Hubbs gentoo-dev 2009-10-19 21:29:27 UTC
Hello,

you can add multiple static routes as shown below, separated by newlines:

staticroute="net 192.168.16.0 netmask 255.255.255.0 gw 192.168.15.1
net 192.168.17.0 netmask 255.255.255.0 gw 192.168.15.1
net 192.168.18.0 netmask 255.255.255.0 gw 192.168.15.1"

This service should be able to handle multiple routes involving multiple
interfaces.

Comment 14 Albert W. Hopkins 2009-10-19 22:15:52 UTC
(In reply to comment #13)
> Hello,
> 
> you can add multiple static routes as shown below, separated by newlines:
> 
> staticroute="net 192.168.16.0 netmask 255.255.255.0 gw 192.168.15.1
> net 192.168.17.0 netmask 255.255.255.0 gw 192.168.15.1
> net 192.168.18.0 netmask 255.255.255.0 gw 192.168.15.1"
> 
> This service should be able to handle multiple routes involving multiple
> interfaces.
> 

Dear William,

Yes, I was not sure if it was for one or multiple routes because in the old-style the variable name was plural but it changed to singular.

We tried adding multiple routes as you commented and found that all of our routes were applied.  I think it would be better if this were documented better in the config file as it only describes the most trivial case.

You may close this bug, however I have one other question. Is ifconfig the preferred way to configure networking now with Gentoo?  The current guides seem to indicate that iproute2 is the preferred (better?) interface for network configuration.  However the new-style seems to prefer ifconfig and, per bug #289762, using the iproute2 with new-style is currently broken.  Also the new staticroute config file does not appear to accept the iproute2 format as it did with old style.  So I'm thinking I need to change everything to ifconfig format and unmerge iproute2.  Is this correct?

Thanks,
Albert
Comment 15 William Hubbs gentoo-dev 2009-10-19 23:25:47 UTC
> We tried adding multiple routes as you commented and found that all of our
> routes were applied.  I think it would be better if this were documented
> better in the config file as it only describes the most trivial case.

I'm glad it works for you.

I agree about documenting the configuration better, and I'll open a
bug upstream recommending that.

> You may close this bug, however I have one other question. Is ifconfig the
> preferred way to configure networking now with Gentoo?  The current guides
> seem to indicate that iproute2 is the preferred (better?) interface for
> network configuration.  However the new-style seems to prefer ifconfig and,
> per bug #289762, using the iproute2 with new-style is currently broken.

the iproute2 bug is a bug I am working on as well.  I hope to
have a rev bump fixing it soon.

> Also the new
> staticroute config file does not appear to accept the iproute2 format as it
> did with old style.  So I'm thinking I need to change everything to
> ifconfig format and unmerge iproute2.  Is this correct?

You are correct that the staticroute script prefers route, but the
network script can use either iproute2 or ifconfig.  Also, iproute2
still has features that ifconfig doesn't have, so, it is up to you
whether or not to keep it on your system.

Comment 16 Ivo Senner 2009-12-02 13:58:02 UTC
I was wondering why I got the message "SIOCADDRT no such process" while booting after I did the migration to OpenRc. I didnt notice that the staticroute init-script was added. I think I'd be good to comment the example config line out or just mention it in the migration guide.
Comment 17 William Hubbs gentoo-dev 2009-12-02 15:44:51 UTC
Comment #16 should have been a new bug.  If you were getting an error
message during boot, we need a bug opened with the details so we can fix it.

Thanks,

William