Bug 195656 - Problem when loading aliased devices configuration (routes)
Summary: Problem when loading aliased devices configuration (routes)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: initscripts
Version: 5
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-06-16 13:15 UTC by Marcelo Roberto Jimenez
Modified: 2014-03-17 03:00 UTC (History)
2 users (show)

Fixed In Version: 8.38-1
Clone Of:
Environment:
Last Closed: 2006-08-18 19:58:56 UTC
Type: ---
Embargoed:


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

Description Marcelo Roberto Jimenez 2006-06-16 13:15:06 UTC
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 13:15:06 UTC
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 22:15:25 UTC
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 10:40:01 UTC
Btw, the patch also applies cleanly to FC4.

Comment 4 Bill Nottingham 2006-07-20 20:22:17 UTC
Question - why would you want to replace the default route with the alias route?

Comment 5 Bill Nottingham 2006-07-24 14:56:31 UTC
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 19:54:02 UTC
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 19:58:56 UTC
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 20:08:43 UTC
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.