netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kubecek <mkubecek@suse.cz>
To: netdev@vger.kernel.org
Cc: Ovidiu Mara <ovidiu.mara@epfl.ch>
Subject: Re: Order of interfaces in output of ip link
Date: Wed, 3 Sep 2014 07:43:35 +0200	[thread overview]
Message-ID: <20140903054335.GA32737@unicorn.suse.cz> (raw)
In-Reply-To: <19313218.dxlnVqzEMb@hp>

On Tue, Sep 02, 2014 at 04:27:42PM +0200, Ovidiu Mara wrote:
> The ip command shows the interfaces on this machine in an unnatural order (eth0 followed by eth2 then eth1).
> ...
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000\    link/ether 2c:59:e5:9a:4c:a4 brd ff:ff:ff:ff:ff:ff
> 3: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000\    link/ether ac:16:2d:98:9e:d8 brd ff:ff:ff:ff:ff:ff
> 4: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000\    link/ether 2c:59:e5:9a:4c:a5 brd ff:ff:ff:ff:ff:ff
> 5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000\    link/ether ac:16:2d:98:9e:d9 brd ff:ff:ff:ff:ff:ff
> ...
> eth0 and eth1 are two ports on the same network card, so I would
> expect them to be shown together, as they are numbered.

In general, you can't expect that. As drivers can initialize in
parallel, it happens quite often that interfaces are interleaved like
this. Actually, the names are probably misleading here: most likely the
interface with index 3 was named "eth1" by kernel and interface with
index 4 was named eth2 but udev changed the names.

> Could you please tell me if there is any workaround for this?

It depends on what exactly you want to achieve and why. But AFAIK ip
documentation doesn't promise any particular order of the interfaces so
it's wrong to assume any.

                                                        Michal Kubecek

      parent reply	other threads:[~2014-09-03  5:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 14:27 Order of interfaces in output of ip link Ovidiu Mara
2014-09-02 15:04 ` Vadim Kochan
2014-09-02 19:30 ` Cong Wang
2014-09-03  5:43 ` Michal Kubecek [this message]

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=20140903054335.GA32737@unicorn.suse.cz \
    --to=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=ovidiu.mara@epfl.ch \
    /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).