On Tue, 17 Dec 2002, at 9:08am, [EMAIL PROTECTED] wrote: > Right, I agree with that. My point was that it is not obvious that this > is stupid, given that Linux is the only OS which allows for *multiple* > default routes!
Forget about the "default" part entirely. You had a route programmed to a gateway that didn't exist. That was the problem. That will always be a problem, regardless of whether the route was to a particular network or host, or a "default" route. And, like I keep saying, Linux is far from the only OS which allows for multiple routes to the same destination. Most variants of Microsoft Windows do, and I'm pretty sure the various BSD-derived Unixes (including MacOS X) do, too. > When I first saw this behavior my initial reaction was "Ooooh, that's > really bad!" ... Only if the gateway doesn't exist! :) > ... but somewhere along the line, I was given to believe that it on Linux > it is not only okay and expected, but that "Linux does the Right > Thing(tm)!". How can Linux do the right thing when you tell it to route via a system that isn't there? What the heck is it supposed to do, go out on the web and order the system you forgot to install? :-) >>> (Btw, I refuse to admit that you were right ;) >> >> I dunno, Paul. I have to side with Derek on this one. > > That remark was obviously tongue in cheek. I assumed it was. I thought my remarks were also obviously tongue in cheek. Sorry if that wasn't clear. :-) > Also, I find it interesting that defining a 'gateway' statement for an > interface in Linux leads to a default route being configured despite one > already existing. Well, there is no such thing as a "gateway statement" in Linux itself. I presume you're talking about something Debian does? I'm really not familiar with Debian's configuration automation. However, I suspect your confusion is related to what I was talking about in another message: Gateway routes are largely independent of network interfaces. Say you are on network 192.168.10.0/24, with an IP address of 192.168.10.55. There is a router to the Internet at 192.168.10.1. There is also another network, 10.20.30.0/24, which is reachable via a separate router at 192.168.10.2. Like so: 192.168.10.0/24 | .1 | (rest of world) <-------[router]-------| | | .55 | [you]------------| | .2 |----[router]---> 10.20.30.0/24 | | Your system boots. It starts with no interfaces and no routes. You bring up your interface for the LAN. You get a route to said LAN. Inside the kernel router, an entry is made that reads like this (#1) Destination 192.168.10.0/24 is reachable via interface eth0 Next, you add your default gateway. That creates a route like this: (#2) Destination 0.0.0.0/0 is reachable via gateway 192.168.10.1 Finally, you add the special route for that other local network: (#3) Destination 10.20.30.0/24 is reachable via gateway 192.168.10.2 Say you send a packet to 192.168.10.66. The kernel finds route #1 as the best match, and knows to send the packet out eth0. Done. Next, say you send a packet to 10.20.30.77. The kernel finds route #3 as the best match. But, route #3 says to send the packet via gateway 192.168.10.2. So, the kernel looks up how to find 192.168.10.2. It finds route #1, and out the packet goes. Done. Finally, you send a packet to Yahoo. The kernel finds route #2 as the best match. Note the kernel does not go, "I never found a match, so I will use the default gateway." Route #2 is the same as any other route. It matches any packet, but because it has such a low netmask (0), it will always match last. So, the kernel finds a route to gateway 192.168.10.1 via #1, and out the packet goes. You can do this for any number of levels. For example, add yet another network, like so: |192.168.10.0/24 .55 | [you]------| .2 |10.20.30.0/24 |----[router]---| | .7 |----[router]----> 10.22.33.0/24 Add another route, so we see: (#1) Destination 192.168.10.0/24 is reachable via interface eth0 (#2) Destination 0.0.0.0/0 is reachable via gateway 192.168.10.1 (#3) Destination 10.20.30.0/24 is reachable via gateway 192.168.10.2 (#4) Destination 10.22.33.0/24 is reachable via gateway 10.20.30.0 You send to 10.22.33.9. The kernel finds #4 as the best match, but it is a gateway, so the kernel looks for a route to 10.20.30.7. It finds route #3 as the best match, but that is a gateway, too, so the kernel looks for a route to 192.168.10.2. Finally, it finds route #1, and can transmit the packet. Done. > Defining a gateway in an interface config file, IMO, shouldn't lead to > defining a default route. Well, according to the Debian man page for the interfaces(5) file, the "gateway" statement defines a default gateway. What would you have it do instead? > As 'mod' pointed out, the definition of the world 'default' essentially > means, when there are no other options, go this way. And that is just what a default route does. You are simply allowed to have multiple ways to go when there are no better options. Remember, like I keep saying, a default route is just like any other route. -- Ben Scott <[EMAIL PROTECTED]> | The opinions expressed in this message are those of the author and do not | | necessarily represent the views or policy of any other person, entity or | | organization. All information is provided without warranty of any kind. | _______________________________________________ gnhlug-discuss mailing list [EMAIL PROTECTED] http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss