IP address: property of host or interface?
Subsystems (2)
Hello!
Long time ago there was an ifconfig command and interface "aliases". Now, thanks to new way of doing things and to famous `ip' utility, we learned that there's no such thing as INTERFACE alias and an IP address belongs to whole interface, not to some "alias" of it. So far so good.
But now I'm asking if an IP really belongs to any particular interface, instead of the whole HOST in question.
For example, suppose we have two interfaces, eth0 and eth1, and two addresses/nets, A0/24 and A1/24, configured.
Let's ping address A1 from segment 0: the host in question will answer those pings, provided we've routing on our "external" host set up to point to A0. The same is true when pinging A0 from segment 1. So, it makes no difference which IP address to access, a host will happily answer to any of them assigned to it, *except* of 127/8 (which is a different story). Note that this works regardless of ip_forward, because it's not forwarding.
Now, I'm setting up the host interfaces somewhat differently:
ip addr add A0/32 dev lo
ip route add A0/24 dev eth0 src A0
ip addr add A1/32 dev lo
ip route add A1/24 dev eth1 src A1
I.e., I'm assigning both addresses to loopback interface and adding ROUTES to corresponding networks/interfaces. And guess what? This thing will work exactly the same way as traditional setup.
In other words, I can assign all addresses that belongs to the host to it's loopback interface, and only add routes (which gets added automatically behind the scenes when I configure ADDRESS with mask != 32 on a broadcast iface) to corresponding "remote" (not belonging to the host) addresses.
There's even more: think of peer-to-peer (not broadcast) interfaces, such as tun or ppp. Traditionally we used to have "local IP" and "remote IP" or "peer IP", and used to set up routes to that remote IP. For example,
ip addr add A peer R dev ppp0
ip route add RS/M via R
but the same works without assigning any address at all to ppp0 interface!
ip route add R dev ppp0
ip route add RS/M dev ppp0
(if A is not listed locally, it's possible to add it to lo interface again).
So.. am I right that an IP address is a HOST property, not an INTERFACE property, and that the traditional way is just more convenient to set up?
And that all the tools that complains that "there's no IP address assigned to this interface" (tcpdump) are wrong? :)
Thanks!
/mjt
Quoted 4 lines
So.. am I right that an IP address is a HOST property, not an INTERFACE property, and that the traditional way is just more convenient to set up? And that all the tools that complains that "there's no IP address assigned to this interface" (tcpdump) are wrong? :)
There are two "schools" of thought - the Linux stack follows the "weak end system" model in which IP addresses are treated as a host property. There is another school of thought called the "strong end system" model where IP addresses are an interface property. There are some "other" stacks out there which can be configured to behave in a "strong end system" way but they tend to default to more of something in between the two.
Tcpdump may simply be caught in the middle :)
rick jones
Quoted 8 lines · Rick Jones
Quoted 4 lines
So.. am I right that an IP address is a HOST property, not an INTERFACE property, and that the traditional way is just more convenient to set up? And that all the tools that complains that "there's no IP address assigned to this interface" (tcpdump) are wrong? :)
There are two "schools" of thought - the Linux stack follows the "weak end system" model in which IP addresses are treated as a host property. There is another school of thought called the "strong end system" model where IP addresses are an interface property. There are some "other" stacks out there which can be configured to behave in a "strong end system" way but they tend to default to more of something in between the two.
Tcpdump may simply be caught in the middle :)
With a bit of configuring (away from system defaults), Linux can behave as a 'strong end system', and even in default behaviour, I don't believe it will process IP packets from an interface that has NO IP address assigned to it.
Thanks,
Ben
Quoted 6 lines
rick jones
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 8 lines · Ben Greear
Quoted 7 lines · Rick Jones
Quoted 6 lines
So.. am I right that an IP address is a HOST property, not an INTERFACE property, and that the traditional way is just more convenient to set up? And
that all the tools that complains that "there's no IP address assigned to this
interface" (tcpdump) are wrong? :)
Quoted 7 lines
Quoted 7 lines
There are two "schools" of thought - the Linux stack follows the "weak end system" model in which IP addresses are treated as a host property. There is another school of thought called the "strong end system" model where IP addresses are an interface property. There are some "other" stacks out there which can be configured to behave in a "strong end system" way but they tend to default to more of something in between the two.
As someone else pointed out, it's all described in RFC1122 (1989!). It was quite.. interesting reading.
Quoted 1 line
Quoted 1 line
Tcpdump may simply be caught in the middle :)
heh.
Quoted 2 lines
With a bit of configuring (away from system defaults), Linux can behave as a 'strong end system', and even
Well, that's quite "a bit". Involves iptable filters.
Quoted 3 lines
in default behaviour, I don't believe it will process IP packets from an interface that has NO IP address assigned
to it.
Just try it. Trivial to do. Assume you've a "simple-workstation" config (no fancy stuff just lo and eth0 with single ip) with 192.168.1.5/24 on your eth0:
# ip addr add 192.168.1.5/32 dev lo <== assigns that IP to lo interface
# ifconfig eth0 0.0.0.0 <= clears it (and routes) from eth0 but
<= keeps the interface up
# ip route add 192.168.1.0/24 dev eth0 <= restores the routeNow ping (or whatever) 192.168.1.5 from any host on eth0 segment. All IP/TCP/UDP/etc stuff will work as usual.
/mjt