LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: route on non-ip interface?

To: "Joseph Mack" <mack@xxxxxxxxxxx>, "tc lewis" <tcl@xxxxxxxxx>
Subject: Re: route on non-ip interface?
Cc: "Joseph Mack" <mack.joseph@xxxxxxx>, <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
From: "Ted Pavlic" <tpavlic@xxxxxxxxxxx>
Date: Thu, 13 Jul 2000 09:42:46 -0400
;)

Remember that IP=0 actually is IP=0.0.0.0, which is another name for the
default route.

The reason why IP=0 is 0.0.0.0 ... Remember that each IP address is simply a
4-byte unsigned integer, right? Well... the easiest way to envision this is
to imagine that an IP is just like a base-256 number. For example:

216.69.192.12 (my mail server) would be:

12 +
192 * 256 +
69  * 256 * 256 +
216 * 256 * 256 * 256

Which is equal to 3628449804. So...

telnet 216.69.192.12 25

is the same as:

telnet 3628449804 25

If you'd like to try it, go ahead. :)

Now onto the default route stuff...

0.0.0.0 is just a special system address which is the same as the default
route. Making a route from 0.0.0.0 to some gateway will set your default
route equal to that gateway. That's all "route add default gw ..." does.
Don't believe me? Do a route -n.

So when I told TC to put 0 on his IP-less NIC, I was just choosing a system
IP that I knew would not ever need to be transmitted on. Linux wanted an IP
to create the interface... so I gave it one -- the IP of the default
gateway. Packets would never need to leave the system going to 0.0.0.0, and
Linux has to listen to this address ANYWAY, so you might as well explicitly
put it on an interface.

What would have also worked (and might have been a better idea) would be to
put 127.0.0.1 on that interface. That is another system address that Linux
will listen to anyway if loopback has been turned on... and it should never
transmit anything away from itself with that as the destination address, so
it's safe to put it on more than one interface.

The only reason I chose 0 over 127.0.0.1 is because 0 is easy... It's
small... It's quick. Whenever I want to telnet to my localhost's port blah I
just do a:

telnet 0 blah

because I'm lazy.. (Linux sees 0, interprets 0.0.0.0, sees an address it
listens to, and basically treats 0 like a loopback)

Also you'll notice that if you give an interface 0.0.0.0 as an IP address
and do an ifconfig to get stats on that interface, it will still retain no
IP address. Another perqusite of using 0.0.0.0 in TC's particular situation.
It may actually cause less confusion in the end. <?>

All the best --
Ted

----- Original Message -----
From: "Joseph Mack" <mack@xxxxxxxxxxx>
To: "tc lewis" <tcl@xxxxxxxxx>
Cc: "Ted Pavlic" <tpavlic@xxxxxxxxxxx>; "Joseph Mack" <mack.joseph@xxxxxxx>
Sent: Wednesday, July 12, 2000 8:30 PM
Subject: Re: route on non-ip interface?


> On Wed, 12 Jul 2000, tc lewis wrote:
>
> > > well I'd never thought of that.
> > >
> > > What does having an IP=0 get you, that having a regular IP on the NIC
> > > doesn't get you.
>
> (still shaking my head in disbelief at an IP=0)
>
> Joe
>
> --
> Joseph Mack mack@xxxxxxxxxxx
>
>



<Prev in Thread] Current Thread [Next in Thread>