netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ovidiu Mara <ovidiu.mara@epfl.ch>
To: netdev@vger.kernel.org
Subject: Order of interfaces in output of ip link
Date: Tue, 02 Sep 2014 16:27:42 +0200	[thread overview]
Message-ID: <19313218.dxlnVqzEMb@hp> (raw)

Hi everyone,

The ip command shows the interfaces on this machine in an unnatural order (eth0 followed by eth2 then eth1).

For example:

ip -o link         
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default \    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
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
6: eth4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000\    link/ether ac:16:2d:98:9e:da brd ff:ff:ff:ff:ff:ff
7: eth5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000\    link/ether ac:16:2d:98:9e:db brd ff:ff:ff:ff:ff:ff
8: eth6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000\    link/ether a0:36:9f:26:b3:10 brd ff:ff:ff:ff:ff:ff
9: eth7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000\    link/ether a0:36:9f:26:b3:12 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. According to the documentation I found here ( http://www.policyrouting.org/iproute2.doc.html#ss9.1.1 ): "The number followed by a colon is the interface index or ifindex. This number uniquely identifies the interface. If you look at the output from cat /proc/net/dev you will see that the network devices are listed in the same order as the numbering you see here."

However in /proc/net/dev they are shown in the natural order:

cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
  eth0: 1000705102 6535806    0 8946    0     0          0   2861813  5252988   39289    0    0    0     0       0          0
  eth1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth2: 104506836  257406    0    0    0     0          0         0      648       8    0    0    0     0       0          0
  eth3: 104506430  257405    0    0    0     0          0         0      648       8    0    0    0     0       0          0
  eth4: 104506430  257405    0    0    0     0          0         0      648       8    0    0    0     0       0          0
  eth5: 104505618  257403    0    0    0     0          0         0      648       8    0    0    0     0       0          0
  eth6:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  eth7: 396628856508 364243051    0    0    0     0          0         0 398063721522 365214422    0    0    0     0       0          0
    lo:     178       2    0    0    0     0          0         0      178       2    0    0    0     0       0          0

I'm using iproute2-3.11.0.

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

Thanks,
Ovidiu

PS Please CC me in replies.

             reply	other threads:[~2014-09-02 14:34 UTC|newest]

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

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=19313218.dxlnVqzEMb@hp \
    --to=ovidiu.mara@epfl.ch \
    --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).