Os números são meramente por conveniência e são calculados dinamicamente.
These numbers are dynamically calculated, so should not be used to refer to the interfaces.
Mais informações você pode encontrar tools-ip-link e tools-ip-addr .
Existe um índice na frente de cada interface de rede em ip link show
ou ip addr show
output. Por exemplo, de 1 a 6 aqui:
root@T42:~# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
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 pfifo_fast state UP qlen 1000
link/ether 00:16:41:54:01:93 brd ff:ff:ff:ff:ff:ff
3: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
4: irda0: <NOARP> mtu 2048 qdisc noop state DOWN qlen 8
link/irda 00:00:00:00 brd ff:ff:ff:ff
5: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:13:ce:8b:99:3e brd ff:ff:ff:ff:ff:ff
6: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 100
link/none
root@T42:~#
Agora, se eu excluir uma interface ( ip link del dev tun0
) e criar uma interface ( ip tuntap add mode tun
), um novo índice será usado:
root@T42:~# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
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 pfifo_fast state UP qlen 1000
link/ether 00:16:41:54:01:93 brd ff:ff:ff:ff:ff:ff
3: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
4: irda0: <NOARP> mtu 2048 qdisc noop state DOWN qlen 8
link/irda 00:00:00:00 brd ff:ff:ff:ff
5: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:13:ce:8b:99:3e brd ff:ff:ff:ff:ff:ff
7: tun0: <POINTOPOINT,MULTICAST,NOARP> mtu 1500 qdisc noop state DOWN qlen 500
link/none
root@T42:~#
Qual é o propósito desses números de índice? Existe uma maneira de classificar com base nesses números de índice? Por exemplo, se eu criar uma quantidade enorme de interfaces (por exemplo, for i in {2..5000}; do brctl addbr br"$i"; done
), essas interfaces não serão classificadas por número de índice:
root@VM-host:~# ip link show | tail
1279: br1246: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether 02:de:92:e5:da:b8 brd ff:ff:ff:ff:ff:ff
1023: br990: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether c2:35:8b:3a:dd:fa brd ff:ff:ff:ff:ff:ff
767: br734: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether da:e9:52:8f:24:dd brd ff:ff:ff:ff:ff:ff
511: br478: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether 56:6d:81:a0:71:36 brd ff:ff:ff:ff:ff:ff
255: br222: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT
link/ether a6:92:89:f1:ee:4f brd ff:ff:ff:ff:ff:ff
root@VM-host:~#
Os números são meramente por conveniência e são calculados dinamicamente.
These numbers are dynamically calculated, so should not be used to refer to the interfaces.
Mais informações você pode encontrar tools-ip-link e tools-ip-addr .
Tags linux