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 ?










share|improve this question






















  • 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












  • 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















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 ?










share|improve this question






















  • 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












  • 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













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 ?










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 at 19:20









Dmitry Perfilyev

12




12












  • 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












  • 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


















  • 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












  • 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
















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















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Сан-Квентин

Алькесар

Josef Freinademetz