how to get all macvlan subinterfaces' MAC
up vote
0
down vote
favorite
Is it possible to get all MAC/IPs for macvlan interface?
I have macvlan interface:
[root@srv ~]# ip a
..................
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:e7:e6:10 brd ff:ff:ff:ff:ff:ff
......................
4: macvlan0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1
link/ether 52:54:00:e7:e6:11 brd ff:ff:ff:ff:ff:ff
inet 1.1.0.6/24 brd 1.1.0.255 scope global macvlan0
valid_lft forever preferred_lft forever
and i have 16 docker containers with macvlan interfaces
[root@srv ~]# docker ps | grep 'Up ' |wc
16 166 3512
[root@srv ~]#
[root@srv ~]# docker network inspect docker-net
............
"Driver": "macvlan",
............
"Containers": {
"17ee78a594720836674448a244432e549ca4b78592e24767b2c6d052b783bd8e": {
......
"MacAddress": "02:42:0a:64:00:f9",
"IPv4Address": "1.1.0.249/24",
},
"1d910302d5fb83e478a0a5d70e0e566d89127916d9788cc61f6356502e14eb4e": {
........
"MacAddress": "02:42:0a:64:00:ad",
"IPv4Address": "1.1.0.173/24",
},
"2943fe549df8fd052d9f6ca74f720c11f7c7342d597d72a5287977d29c6f196f": {
"MacAddress": "02:42:0a:64:00:eb",
"IPv4Address": "1.1.0.235/24",
},
how can i list ALL subinterfaces for macvlan0 ?
ip netns
- show nothing
lsns -t net
- show 16 docker's net namespaces
arp -an
shows <16 arps, and some arps from other hosts (1.1.0.1,1.1.0.253,1.1.0.254)
[root@srv ~]# arp -an
? (1.1.0.1) at 00:00:0c:07:ac:1e [ether] on macvlan0
? (1.1.0.198) at 02:42:0a:64:00:c6 [ether] on macvlan0
? (1.1.0.238) at 02:42:0a:64:00:ee [ether] on macvlan0
? (1.1.0.253) at 7c:69:f6:d0:9a:81 [ether] on macvlan0
? (1.1.0.172) at 02:42:0a:64:00:ac [ether] on macvlan0
? (1.1.0.254) at 7c:69:f6:ba:a3:81 [ether] on macvlan0
? (1.1.0.173) at 02:42:0a:64:00:ad [ether] on macvlan0
? (1.1.0.234) at 02:42:0a:64:00:ea [ether] on macvlan0
? (1.1.0.174) at 02:42:0a:64:00:ae [ether] on macvlan0
? (1.1.0.235) at 02:42:0a:64:00:eb [ether] on macvlan0
? (1.1.0.249) at 02:42:0a:64:00:f9 [ether] on macvlan0
? (1.1.10.1) at 52:54:00:0e:84:51 [ether] on eth1
[root@srv ~]#
I understand, that all macvlan0 interfaces are in different net namespaces, and apparently ip link show macvlan0 show
can't show subinterfaces in different namespaces.
But is there other command to get all ip's and MAC's in all namespaces ?
linux networking docker
add a comment |
up vote
0
down vote
favorite
Is it possible to get all MAC/IPs for macvlan interface?
I have macvlan interface:
[root@srv ~]# ip a
..................
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:e7:e6:10 brd ff:ff:ff:ff:ff:ff
......................
4: macvlan0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1
link/ether 52:54:00:e7:e6:11 brd ff:ff:ff:ff:ff:ff
inet 1.1.0.6/24 brd 1.1.0.255 scope global macvlan0
valid_lft forever preferred_lft forever
and i have 16 docker containers with macvlan interfaces
[root@srv ~]# docker ps | grep 'Up ' |wc
16 166 3512
[root@srv ~]#
[root@srv ~]# docker network inspect docker-net
............
"Driver": "macvlan",
............
"Containers": {
"17ee78a594720836674448a244432e549ca4b78592e24767b2c6d052b783bd8e": {
......
"MacAddress": "02:42:0a:64:00:f9",
"IPv4Address": "1.1.0.249/24",
},
"1d910302d5fb83e478a0a5d70e0e566d89127916d9788cc61f6356502e14eb4e": {
........
"MacAddress": "02:42:0a:64:00:ad",
"IPv4Address": "1.1.0.173/24",
},
"2943fe549df8fd052d9f6ca74f720c11f7c7342d597d72a5287977d29c6f196f": {
"MacAddress": "02:42:0a:64:00:eb",
"IPv4Address": "1.1.0.235/24",
},
how can i list ALL subinterfaces for macvlan0 ?
ip netns
- show nothing
lsns -t net
- show 16 docker's net namespaces
arp -an
shows <16 arps, and some arps from other hosts (1.1.0.1,1.1.0.253,1.1.0.254)
[root@srv ~]# arp -an
? (1.1.0.1) at 00:00:0c:07:ac:1e [ether] on macvlan0
? (1.1.0.198) at 02:42:0a:64:00:c6 [ether] on macvlan0
? (1.1.0.238) at 02:42:0a:64:00:ee [ether] on macvlan0
? (1.1.0.253) at 7c:69:f6:d0:9a:81 [ether] on macvlan0
? (1.1.0.172) at 02:42:0a:64:00:ac [ether] on macvlan0
? (1.1.0.254) at 7c:69:f6:ba:a3:81 [ether] on macvlan0
? (1.1.0.173) at 02:42:0a:64:00:ad [ether] on macvlan0
? (1.1.0.234) at 02:42:0a:64:00:ea [ether] on macvlan0
? (1.1.0.174) at 02:42:0a:64:00:ae [ether] on macvlan0
? (1.1.0.235) at 02:42:0a:64:00:eb [ether] on macvlan0
? (1.1.0.249) at 02:42:0a:64:00:f9 [ether] on macvlan0
? (1.1.10.1) at 52:54:00:0e:84:51 [ether] on eth1
[root@srv ~]#
I understand, that all macvlan0 interfaces are in different net namespaces, and apparently ip link show macvlan0 show
can't show subinterfaces in different namespaces.
But is there other command to get all ip's and MAC's in all namespaces ?
linux networking docker
You need to iterate over each namespace, and runip
in this namespace, e.g.ip -n your_namespace addr show
. Not fun. What's wrong withdocker network inspect docker-net
instead?
– dirkt
Nov 20 at 7:01
I wonder why it is impossible to see all of MACs of particular macvlan interface. Andip -n
don't work, due empty of/var/run/netns
And i can have some macvlan subinterfaces inside docker, some not. Sodocker network inspect
not best choice. I want to have most general way to list all the MACs of particular macvlan in all namespaces (in docker or not)
– Dmitry Perfilyev
Nov 20 at 11:53
Because I'd assume it's not a "particular macvlan inerface", it's a dozen interfaces in different namespaces which all happen to have the namemacvlan0
. So you need to iterate over all of those, one way or other. I haven't tried to access docker namespaces before, you may need the docker tools to runip
in that particular namespace.
– dirkt
Nov 20 at 12:51
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Is it possible to get all MAC/IPs for macvlan interface?
I have macvlan interface:
[root@srv ~]# ip a
..................
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:e7:e6:10 brd ff:ff:ff:ff:ff:ff
......................
4: macvlan0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1
link/ether 52:54:00:e7:e6:11 brd ff:ff:ff:ff:ff:ff
inet 1.1.0.6/24 brd 1.1.0.255 scope global macvlan0
valid_lft forever preferred_lft forever
and i have 16 docker containers with macvlan interfaces
[root@srv ~]# docker ps | grep 'Up ' |wc
16 166 3512
[root@srv ~]#
[root@srv ~]# docker network inspect docker-net
............
"Driver": "macvlan",
............
"Containers": {
"17ee78a594720836674448a244432e549ca4b78592e24767b2c6d052b783bd8e": {
......
"MacAddress": "02:42:0a:64:00:f9",
"IPv4Address": "1.1.0.249/24",
},
"1d910302d5fb83e478a0a5d70e0e566d89127916d9788cc61f6356502e14eb4e": {
........
"MacAddress": "02:42:0a:64:00:ad",
"IPv4Address": "1.1.0.173/24",
},
"2943fe549df8fd052d9f6ca74f720c11f7c7342d597d72a5287977d29c6f196f": {
"MacAddress": "02:42:0a:64:00:eb",
"IPv4Address": "1.1.0.235/24",
},
how can i list ALL subinterfaces for macvlan0 ?
ip netns
- show nothing
lsns -t net
- show 16 docker's net namespaces
arp -an
shows <16 arps, and some arps from other hosts (1.1.0.1,1.1.0.253,1.1.0.254)
[root@srv ~]# arp -an
? (1.1.0.1) at 00:00:0c:07:ac:1e [ether] on macvlan0
? (1.1.0.198) at 02:42:0a:64:00:c6 [ether] on macvlan0
? (1.1.0.238) at 02:42:0a:64:00:ee [ether] on macvlan0
? (1.1.0.253) at 7c:69:f6:d0:9a:81 [ether] on macvlan0
? (1.1.0.172) at 02:42:0a:64:00:ac [ether] on macvlan0
? (1.1.0.254) at 7c:69:f6:ba:a3:81 [ether] on macvlan0
? (1.1.0.173) at 02:42:0a:64:00:ad [ether] on macvlan0
? (1.1.0.234) at 02:42:0a:64:00:ea [ether] on macvlan0
? (1.1.0.174) at 02:42:0a:64:00:ae [ether] on macvlan0
? (1.1.0.235) at 02:42:0a:64:00:eb [ether] on macvlan0
? (1.1.0.249) at 02:42:0a:64:00:f9 [ether] on macvlan0
? (1.1.10.1) at 52:54:00:0e:84:51 [ether] on eth1
[root@srv ~]#
I understand, that all macvlan0 interfaces are in different net namespaces, and apparently ip link show macvlan0 show
can't show subinterfaces in different namespaces.
But is there other command to get all ip's and MAC's in all namespaces ?
linux networking docker
Is it possible to get all MAC/IPs for macvlan interface?
I have macvlan interface:
[root@srv ~]# ip a
..................
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:e7:e6:10 brd ff:ff:ff:ff:ff:ff
......................
4: macvlan0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1
link/ether 52:54:00:e7:e6:11 brd ff:ff:ff:ff:ff:ff
inet 1.1.0.6/24 brd 1.1.0.255 scope global macvlan0
valid_lft forever preferred_lft forever
and i have 16 docker containers with macvlan interfaces
[root@srv ~]# docker ps | grep 'Up ' |wc
16 166 3512
[root@srv ~]#
[root@srv ~]# docker network inspect docker-net
............
"Driver": "macvlan",
............
"Containers": {
"17ee78a594720836674448a244432e549ca4b78592e24767b2c6d052b783bd8e": {
......
"MacAddress": "02:42:0a:64:00:f9",
"IPv4Address": "1.1.0.249/24",
},
"1d910302d5fb83e478a0a5d70e0e566d89127916d9788cc61f6356502e14eb4e": {
........
"MacAddress": "02:42:0a:64:00:ad",
"IPv4Address": "1.1.0.173/24",
},
"2943fe549df8fd052d9f6ca74f720c11f7c7342d597d72a5287977d29c6f196f": {
"MacAddress": "02:42:0a:64:00:eb",
"IPv4Address": "1.1.0.235/24",
},
how can i list ALL subinterfaces for macvlan0 ?
ip netns
- show nothing
lsns -t net
- show 16 docker's net namespaces
arp -an
shows <16 arps, and some arps from other hosts (1.1.0.1,1.1.0.253,1.1.0.254)
[root@srv ~]# arp -an
? (1.1.0.1) at 00:00:0c:07:ac:1e [ether] on macvlan0
? (1.1.0.198) at 02:42:0a:64:00:c6 [ether] on macvlan0
? (1.1.0.238) at 02:42:0a:64:00:ee [ether] on macvlan0
? (1.1.0.253) at 7c:69:f6:d0:9a:81 [ether] on macvlan0
? (1.1.0.172) at 02:42:0a:64:00:ac [ether] on macvlan0
? (1.1.0.254) at 7c:69:f6:ba:a3:81 [ether] on macvlan0
? (1.1.0.173) at 02:42:0a:64:00:ad [ether] on macvlan0
? (1.1.0.234) at 02:42:0a:64:00:ea [ether] on macvlan0
? (1.1.0.174) at 02:42:0a:64:00:ae [ether] on macvlan0
? (1.1.0.235) at 02:42:0a:64:00:eb [ether] on macvlan0
? (1.1.0.249) at 02:42:0a:64:00:f9 [ether] on macvlan0
? (1.1.10.1) at 52:54:00:0e:84:51 [ether] on eth1
[root@srv ~]#
I understand, that all macvlan0 interfaces are in different net namespaces, and apparently ip link show macvlan0 show
can't show subinterfaces in different namespaces.
But is there other command to get all ip's and MAC's in all namespaces ?
linux networking docker
linux networking docker
asked Nov 19 at 19:20
Dmitry Perfilyev
12
12
You need to iterate over each namespace, and runip
in this namespace, e.g.ip -n your_namespace addr show
. Not fun. What's wrong withdocker network inspect docker-net
instead?
– dirkt
Nov 20 at 7:01
I wonder why it is impossible to see all of MACs of particular macvlan interface. Andip -n
don't work, due empty of/var/run/netns
And i can have some macvlan subinterfaces inside docker, some not. Sodocker network inspect
not best choice. I want to have most general way to list all the MACs of particular macvlan in all namespaces (in docker or not)
– Dmitry Perfilyev
Nov 20 at 11:53
Because I'd assume it's not a "particular macvlan inerface", it's a dozen interfaces in different namespaces which all happen to have the namemacvlan0
. So you need to iterate over all of those, one way or other. I haven't tried to access docker namespaces before, you may need the docker tools to runip
in that particular namespace.
– dirkt
Nov 20 at 12:51
add a comment |
You need to iterate over each namespace, and runip
in this namespace, e.g.ip -n your_namespace addr show
. Not fun. What's wrong withdocker network inspect docker-net
instead?
– dirkt
Nov 20 at 7:01
I wonder why it is impossible to see all of MACs of particular macvlan interface. Andip -n
don't work, due empty of/var/run/netns
And i can have some macvlan subinterfaces inside docker, some not. Sodocker network inspect
not best choice. I want to have most general way to list all the MACs of particular macvlan in all namespaces (in docker or not)
– Dmitry Perfilyev
Nov 20 at 11:53
Because I'd assume it's not a "particular macvlan inerface", it's a dozen interfaces in different namespaces which all happen to have the namemacvlan0
. So you need to iterate over all of those, one way or other. I haven't tried to access docker namespaces before, you may need the docker tools to runip
in that particular namespace.
– dirkt
Nov 20 at 12:51
You need to iterate over each namespace, and run
ip
in this namespace, e.g. ip -n your_namespace addr show
. Not fun. What's wrong with docker network inspect docker-net
instead?– dirkt
Nov 20 at 7:01
You need to iterate over each namespace, and run
ip
in this namespace, e.g. ip -n your_namespace addr show
. Not fun. What's wrong with docker network inspect docker-net
instead?– dirkt
Nov 20 at 7:01
I wonder why it is impossible to see all of MACs of particular macvlan interface. And
ip -n
don't work, due empty of /var/run/netns
And i can have some macvlan subinterfaces inside docker, some not. So docker network inspect
not best choice. I want to have most general way to list all the MACs of particular macvlan in all namespaces (in docker or not)– Dmitry Perfilyev
Nov 20 at 11:53
I wonder why it is impossible to see all of MACs of particular macvlan interface. And
ip -n
don't work, due empty of /var/run/netns
And i can have some macvlan subinterfaces inside docker, some not. So docker network inspect
not best choice. I want to have most general way to list all the MACs of particular macvlan in all namespaces (in docker or not)– Dmitry Perfilyev
Nov 20 at 11:53
Because I'd assume it's not a "particular macvlan inerface", it's a dozen interfaces in different namespaces which all happen to have the name
macvlan0
. So you need to iterate over all of those, one way or other. I haven't tried to access docker namespaces before, you may need the docker tools to run ip
in that particular namespace.– dirkt
Nov 20 at 12:51
Because I'd assume it's not a "particular macvlan inerface", it's a dozen interfaces in different namespaces which all happen to have the name
macvlan0
. So you need to iterate over all of those, one way or other. I haven't tried to access docker namespaces before, you may need the docker tools to run ip
in that particular namespace.– dirkt
Nov 20 at 12:51
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1376773%2fhow-to-get-all-macvlan-subinterfaces-mac%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You need to iterate over each namespace, and run
ip
in this namespace, e.g.ip -n your_namespace addr show
. Not fun. What's wrong withdocker network inspect docker-net
instead?– dirkt
Nov 20 at 7:01
I wonder why it is impossible to see all of MACs of particular macvlan interface. And
ip -n
don't work, due empty of/var/run/netns
And i can have some macvlan subinterfaces inside docker, some not. Sodocker network inspect
not best choice. I want to have most general way to list all the MACs of particular macvlan in all namespaces (in docker or not)– Dmitry Perfilyev
Nov 20 at 11:53
Because I'd assume it's not a "particular macvlan inerface", it's a dozen interfaces in different namespaces which all happen to have the name
macvlan0
. So you need to iterate over all of those, one way or other. I haven't tried to access docker namespaces before, you may need the docker tools to runip
in that particular namespace.– dirkt
Nov 20 at 12:51