netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: CLOSE Dave <Dave.Close@us.thalesgroup.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: Trying to ping from a subinterface.
Date: Mon, 2 Jun 2014 17:35:54 -0700	[thread overview]
Message-ID: <20140602173554.1dc77101@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <538CE2CA.9060806@us.thalesgroup.com>

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.

  reply	other threads:[~2014-06-03  0:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02 20:47 Trying to ping from a subinterface CLOSE Dave
2014-06-03  0:35 ` Stephen Hemminger [this message]
2014-06-03  0:41   ` CLOSE Dave
2014-06-03  4:13     ` Ben Greear
2014-06-03 16:29       ` CLOSE Dave

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140602173554.1dc77101@nehalam.linuxnetplumber.net \
    --to=stephen@networkplumber.org \
    --cc=Dave.Close@us.thalesgroup.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).