Bug 195656 - Problem when loading aliased devices configuration (routes)
Problem when loading aliased devices configuration (routes)
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: initscripts (Show other bugs)
5
All Linux
medium Severity high
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-06-16 09:15 EDT by Marcelo Roberto Jimenez
Modified: 2014-03-16 23:00 EDT (History)
2 users (show)

See Also:
Fixed In Version: 8.38-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-18 15:58:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to ifup-routes to fix the adding of routes for aliased devices (888 bytes, patch)
2006-06-16 09:15 EDT, Marcelo Roberto Jimenez
no flags Details | Diff
Slightly different patch (622 bytes, patch)
2006-07-24 10:56 EDT, Bill Nottingham
no flags Details | Diff

  None (edit)
Description Marcelo Roberto Jimenez 2006-06-16 09:15:06 EDT
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.
Comment 1 Marcelo Roberto Jimenez 2006-06-16 09:15:06 EDT
Created attachment 131042 [details]
Patch to ifup-routes to fix the adding of routes for aliased devices
Comment 2 Marcelo Roberto Jimenez 2006-06-16 18:15:25 EDT
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
Comment 3 Marcelo Roberto Jimenez 2006-06-20 06:40:01 EDT
Btw, the patch also applies cleanly to FC4.
Comment 4 Bill Nottingham 2006-07-20 16:22:17 EDT
Question - why would you want to replace the default route with the alias route?
Comment 5 Bill Nottingham 2006-07-24 10:56:31 EDT
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?
Comment 6 Marcelo Roberto Jimenez 2006-08-18 15:54:02 EDT
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.
Comment 7 Bill Nottingham 2006-08-18 15:58:56 EDT
No problem. GATEWAY is either for static IPs or for routes going through
machines other than the default gateway.

Fixed in 8.38-1.
Comment 8 Marcelo Roberto Jimenez 2006-08-18 16:08:43 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.