Description of problem: I have configured an alias device for eth0, say eth0:1, and I had to set a route for this device. I did this using the "Route" tab in system-config-networks. When the interface is started, the following message appears, and the route is not created: Cannot find device "eth0:1" Reading the scripts, I found that the syntax of the command "/sbin/ip route add dev <device>" does not accecpt the colon alias syntax, so the first thing my patch does is to remove ":1" from "eth0:1" - line="$line dev $2" + # Remove alias part ":N" from aliased devices, otherwise the device will not be found + line="$line dev ${2%:*}" Even then, there was still a problem. Now the route is still not created, but the error now is: RTNETLINK answers: File exists And this happens because a default route has already been created, and it conflicts with the route I want to add. To solve this, I checked for the existence of the route and in case it does exist, do a replace instead of an add: - /sbin/ip route add $line + # Check if route already exists, and if it does, replace instead of add + if ! LC_ALL=C ip addr ls ${2%:*} | LC_ALL=C grep -q "${ADDRESS}/ ${PREFIX}" ; then + line="add $line" + else + line="replace $line" + fi + /sbin/ip route $line Now the route is successfully created. The full patch is attached.
Created attachment 131042 [details] Patch to ifup-routes to fix the adding of routes for aliased devices
To make things a bit clearer, let me add that the route I did had a gateway, here is a paste of the route-eth0:1 file: GATEWAY0=192.168.1.1 NETMASK0=255.255.255.0 ADDRESS0=192.168.100.0
Btw, the patch also applies cleanly to FC4.
Question - why would you want to replace the default route with the alias route?
Created attachment 132920 [details] Slightly different patch Here's what's in CVS to be added in 8.38-1. The route replace issue sounds like a configuration error to me at first glance - what usage cases do you see for it?
Bill, Sorry for the delay, I was on vacations. You are right, the need for the route replace is the result of an unecessary complication in my local network configuration. I have a cable modem and after I bought a wireless router. The cable modem had a configuration page in 192.168.100.1. So I had an interface to the 192.168.100.0 network configured as an alias to be able to access the modem pages. When I switched to the wireless router (192.168.1.1), the cable modem now was on the other side of the router. I have left the interface to the 192.168.100.0 network local to my computer, and it was obviously not working. Instead of just deletting the alias interface and leave the router do what it knows (route), I have left the alias interface and added the gateway 192.168.1.1 manually. Of couse, it works this way, but it is unnecessary complication. Anyway, what I did seems to be something legal from a configuration point of view, and system-config-network GUI indeed does permit doing so. And any manually added gateway will always conflict with the default route. Why is there a GATEWAY option, is there a case where the default route for the interface will not be created? Back to the bug issue, I consider it resolved with your patch, thank you for your attention and sorry for the configuration error part of the bug report.
No problem. GATEWAY is either for static IPs or for routes going through machines other than the default gateway. Fixed in 8.38-1.
In case you have a specific gateway to reach another network, other than the default gateway, don't you think that the route to the desired gateway will not be created? I mean, appart from the fact that I did not need this, that is what happened to me. Seems to be a possible configuration if you have a router for the outside world and a gateway for an "inside" network.