* Trying to ping from a subinterface.
@ 2014-06-02 20:47 CLOSE Dave
2014-06-03 0:35 ` Stephen Hemminger
0 siblings, 1 reply; 5+ messages in thread
From: CLOSE Dave @ 2014-06-02 20:47 UTC (permalink / raw)
To: netdev@vger.kernel.org
On Fedora 20 x86_64.
According to "man ping", ping should work from a subinterface specifying
either the interface name or its address:
> -I interface
> interface is either an address, or an interface name. If inter‐
> face is an address, it sets source address to specified inter‐
> face address. If interface in an interface name, it sets source
> interface to specified interface.
I've got a subinterface and I'm trying to ping from it.
> # ifconfig eth3:sub1
> eth3:sub1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
> inet 172.17.30.143 netmask 255.255.254.0 broadcast 172.17.31.255
> ether 90:e2:ba:34:46:41 txqueuelen 1000 (Ethernet)
> device memory 0xdc7e0000-dc800000
If I ping from the address, it works as specified. If I specify the
interface name instead, I see:
> # ping -I eth3:sub1 172.17.30.1
> ping: SO_BINDTODEVICE: Invalid argument
Investigating a little deeper:
> # strace ping -I eth3:sub1 172.17.30.1
> execve("/usr/bin/ping", ["ping", "-I", "eth3:sub1", "172.17.30.1"], [/* 38 vars */]) = 0
> ...
> setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "eth3:sub1\0", 13) = -1 ENODEV (No such device)
> ...
> +++ exited with 2 +++
Any thoughts?
--
Dave Close
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trying to ping from a subinterface.
2014-06-02 20:47 Trying to ping from a subinterface CLOSE Dave
@ 2014-06-03 0:35 ` Stephen Hemminger
2014-06-03 0:41 ` CLOSE Dave
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2014-06-03 0:35 UTC (permalink / raw)
To: CLOSE Dave; +Cc: netdev@vger.kernel.org
On Mon, 2 Jun 2014 13:47:06 -0700
CLOSE Dave <Dave.Close@us.thalesgroup.com> wrote:
> On Fedora 20 x86_64.
>
> According to "man ping", ping should work from a subinterface specifying
> either the interface name or its address:
>
> > -I interface
> > interface is either an address, or an interface name. If inter‐
> > face is an address, it sets source address to specified inter‐
> > face address. If interface in an interface name, it sets source
> > interface to specified interface.
>
> I've got a subinterface and I'm trying to ping from it.
>
> > # ifconfig eth3:sub1
> > eth3:sub1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
> > inet 172.17.30.143 netmask 255.255.254.0 broadcast 172.17.31.255
> > ether 90:e2:ba:34:46:41 txqueuelen 1000 (Ethernet)
> > device memory 0xdc7e0000-dc800000
>
> If I ping from the address, it works as specified. If I specify the
> interface name instead, I see:
>
> > # ping -I eth3:sub1 172.17.30.1
> > ping: SO_BINDTODEVICE: Invalid argument
>
> Investigating a little deeper:
>
> > # strace ping -I eth3:sub1 172.17.30.1
> > execve("/usr/bin/ping", ["ping", "-I", "eth3:sub1", "172.17.30.1"], [/* 38 vars */]) = 0
> > ...
> > setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "eth3:sub1\0", 13) = -1 ENODEV (No such device)
> > ...
> > +++ exited with 2 +++
>
> Any thoughts?
Interface aliases (sub interfaces) aren't real interfaces in Linux.
They are a deprecated way of doing multiple addresses on the same device.
Aliases aren't real devices, they don't behave like devices, and they
only are useful with ancient tools like ifconfig.
Don't use them unless you have to deal with systems older than 10 years.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trying to ping from a subinterface.
2014-06-03 0:35 ` Stephen Hemminger
@ 2014-06-03 0:41 ` CLOSE Dave
2014-06-03 4:13 ` Ben Greear
0 siblings, 1 reply; 5+ messages in thread
From: CLOSE Dave @ 2014-06-03 0:41 UTC (permalink / raw)
To: netdev@vger.kernel.org
Stephen Hemminger wrote (in response to my complaint):
>>> # ping -I eth3:sub1 172.17.30.1
>>> ping: SO_BINDTODEVICE: Invalid argument
> Interface aliases (sub interfaces) aren't real interfaces in Linux.
> They are a deprecated way of doing multiple addresses on the same
> device. Aliases aren't real devices, they don't behave like devices,
> and they only are useful with ancient tools like ifconfig.
>
> Don't use them unless you have to deal with systems older than 10
> years.
I apologize to the group. I had been led to believe this was working on
earlier Fedora releases. In fact, it was complaining but then falling
back to the main interface and performing the ping anyway. What is new
is the refusal to fall back.
Starting fresh, I'd agree with your suggestion. But there is a lot of
legacy code in the world...
--
Dave Close
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trying to ping from a subinterface.
2014-06-03 0:41 ` CLOSE Dave
@ 2014-06-03 4:13 ` Ben Greear
2014-06-03 16:29 ` CLOSE Dave
0 siblings, 1 reply; 5+ messages in thread
From: Ben Greear @ 2014-06-03 4:13 UTC (permalink / raw)
To: CLOSE Dave, netdev@vger.kernel.org
On 06/02/2014 05:41 PM, CLOSE Dave wrote:
> Stephen Hemminger wrote (in response to my complaint):
>
>>>> # ping -I eth3:sub1 172.17.30.1
>>>> ping: SO_BINDTODEVICE: Invalid argument
>
>> Interface aliases (sub interfaces) aren't real interfaces in Linux.
>> They are a deprecated way of doing multiple addresses on the same
>> device. Aliases aren't real devices, they don't behave like devices,
>> and they only are useful with ancient tools like ifconfig.
>>
>> Don't use them unless you have to deal with systems older than 10
>> years.
>
> I apologize to the group. I had been led to believe this was working on
> earlier Fedora releases. In fact, it was complaining but then falling
> back to the main interface and performing the ping anyway. What is new
> is the refusal to fall back.
>
> Starting fresh, I'd agree with your suggestion. But there is a lot of
> legacy code in the world...
SO_BINDTODEVICE could never work on sub-interfaces as far as I know,
but maybe older versions of ping just didn't bother doing SO_BINDTODEVICE.
Do you actually need sub-interfaces for some reason, or can you just use
multiple IPs on one interface (or maybe mac-vlans)?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trying to ping from a subinterface.
2014-06-03 4:13 ` Ben Greear
@ 2014-06-03 16:29 ` CLOSE Dave
0 siblings, 0 replies; 5+ messages in thread
From: CLOSE Dave @ 2014-06-03 16:29 UTC (permalink / raw)
To: Ben Greear, netdev@vger.kernel.org
I wrote:
> I apologize to the group. I had been led to believe this was working on
> earlier Fedora releases. In fact, it was complaining but then falling
> back to the main interface and performing the ping anyway. What is new
> is the refusal to fall back.
Ben Greear answered:
> SO_BINDTODEVICE could never work on sub-interfaces as far as I know,
> but maybe older versions of ping just didn't bother doing SO_BINDTODEVICE.
It appears that the older version tried the call, got a failure,
complained about it, and then continued by using the main interface
instead. The exit code was not affected.
The current version tries the call, fails, complains, and exits with
code 2.
> Do you actually need sub-interfaces for some reason, or can you just use
> multiple IPs on one interface (or maybe mac-vlans)?
I can live without them. But they do provide a nice way to reference
an address by name.
--
Dave Close
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-03 16:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 20:47 Trying to ping from a subinterface CLOSE Dave
2014-06-03 0:35 ` Stephen Hemminger
2014-06-03 0:41 ` CLOSE Dave
2014-06-03 4:13 ` Ben Greear
2014-06-03 16:29 ` CLOSE Dave
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).