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".
Created attachment 206647 [details] emerge --info
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.
(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.
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.
http://roy.marples.name/projects/openrc/changeset/baeb59cd2e7bc68e95c8fb3f94ecb0c7d6e54589 A new init script with matching conf.d to handle static routes.
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.
Please report back to the bug if this works or not. I did not mean to close it yet.
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
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
(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
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.
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.
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.
(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
> 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.
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 #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