|
Home > Archive > Unix Programming > May 2005 > UN*X with non-unique interface names for aliases?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
UN*X with non-unique interface names for aliases?
|
|
| recvfrom 2005-05-01, 6:21 pm |
| Hi!
Are there any UN*X OS's that still use a single interface
name when aliases are set? It's straightforward to retrieve
the IP address associated with an interface using ioctl
SIOCGIFADDR, but I'm wondering what happens when multiple
IP addresses are associated with a single interface name,
rather than multiple names in the form <ifname>:N ??? Is
it then necessary to use SIOCGIFCONF and work through each
entry?
TIA,
r
| |
| Matthias Buelow 2005-05-01, 6:21 pm |
| "recvfrom" <recvfrom@gmail.com> writes:
>Are there any UN*X OS's that still use a single interface
>name when aliases are set? It's straightforward to retrieve
FreeBSD is an example. You might enquire about it further. Don't ask
me about the ioctls.
mkb.
| |
| James Antill 2005-05-01, 6:21 pm |
| On Thu, 28 Apr 2005 14:17:20 -0700, recvfrom wrote:
> Hi!
>
> Are there any UN*X OS's that still use a single interface
> name when aliases are set? It's straightforward to retrieve
> the IP address associated with an interface using ioctl
> SIOCGIFADDR, but I'm wondering what happens when multiple
> IP addresses are associated with a single interface name,
> rather than multiple names in the form <ifname>:N ??? Is
> it then necessary to use SIOCGIFCONF and work through each
> entry?
Linux can do this, it's just that the distributions tend to use different
names to help the user out (and allow people to still use ifconfig).
Ie. on at least 2.4.x upwards
ip addr ls eth0
ip addr add 10.0.0.1/24 dev eth0
ip addr add 10.0.0.2/24 dev eth0
ip addr ls eth0
--
James Antill -- james@and.org
Need an efficient and powerful string library for C?
http://www.and.org/vstr/
| |
| recvfrom 2005-05-01, 6:21 pm |
|
James Antill wrote:
> On Thu, 28 Apr 2005 14:17:20 -0700, recvfrom wrote:
>
>
> Linux can do this, it's just that the distributions tend to use
different
> names to help the user out (and allow people to still use ifconfig).
> Ie. on at least 2.4.x upwards
>
> ip addr ls eth0
> ip addr add 10.0.0.1/24 dev eth0
> ip addr add 10.0.0.2/24 dev eth0
> ip addr ls eth0
So then am I correct to assume that the only way to get all
of the addresses for eth0 is to use ioctl SIOCGIFCONF and
walk through each ifreq struct, whereas if I only want the
*primary* address for eth0, I can use ioctl SIOCGIFADDR ??
-r
| |
| Floyd L. Davidson 2005-05-01, 6:21 pm |
| "recvfrom" <recvfrom@gmail.com> wrote:
>
>So then am I correct to assume that the only way to get all
>of the addresses for eth0 is to use ioctl SIOCGIFCONF and
>walk through each ifreq struct, whereas if I only want the
>*primary* address for eth0, I can use ioctl SIOCGIFADDR ??
Near as I can tell that is true. Either is trivial.
--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com
|
|
|
|
|