Assign MAC address to a veth pair












0















I have created 6 namespaces and configured them with veth links. I'm trying to attach MAC address. But the following error is shown :



SIOCSIFHWADDR: Cannot assign requested address
SIOCSIFHWADDR: Cannot assign requested address
SIOCSIFHWADDR: Cannot assign requested address


Here is my code :



Add namespaces



ip netns add ns1
ip netns add ns2
ip netns add ns3
ip netns add ns4
ip netns add ns5
ip netns add ns6


Add veths



ip link add eth0 type veth peer name eth1
ip link add eth2 type veth peer name eth3
ip link add eth4 type veth peer name eth5
ip link add eth6 type veth peer name eth7
ip link add eth8 type veth peer name eth9


link veths



ip link set netns ns1 eth0
ip link set netns ns2 eth3
ip link set netns ns3 eth6
ip link set netns ns4 eth9
ip link set netns ns5 eth1
ip link set netns ns5 eth2
ip link set netns ns5 eth4
ip link set netns ns6 eth5
ip link set netns ns6 eth7
ip link set netns ns6 eth8


assign mac's



ip netns exec ns1 ifconfig eth0 hw ether 00:00:00:00:00:00 
ip netns exec ns2 ifconfig eth3 hw ether 03:03:03:03:03:03
ip netns exec ns3 ifconfig eth6 hw ether 06:06:06:06:06:06
ip netns exec ns4 ifconfig eth9 hw ether 09:09:09:09:09:09


Can anyone help?










share|improve this question




















  • 1





    en.wikipedia.org/wiki/MAC_address#Address_details . Some values are just invalid (or doesn't make sense)

    – A.B
    Apr 20 '18 at 14:35













  • it is failing for any address

    – user3598542
    Apr 20 '18 at 15:40






  • 1





    When debugging, or asking for help, reduce the problem to the simplest form. In this case, instead of doing 10 interfaces, do just 1. Provide details on that. Show the status of the interface within the namespace, show the error message after the command which generated it, not at the top of the question, etc.

    – Patrick
    Apr 20 '18 at 16:11













  • And BTW, instead of figuring out the format of a valid MAC address, you can also just keep the MAC addresses that get assigned automatically - unless you want to do something that requires specific MAC addresses, but it that case you probably would have tried with valid ones.

    – dirkt
    Apr 20 '18 at 17:34
















0















I have created 6 namespaces and configured them with veth links. I'm trying to attach MAC address. But the following error is shown :



SIOCSIFHWADDR: Cannot assign requested address
SIOCSIFHWADDR: Cannot assign requested address
SIOCSIFHWADDR: Cannot assign requested address


Here is my code :



Add namespaces



ip netns add ns1
ip netns add ns2
ip netns add ns3
ip netns add ns4
ip netns add ns5
ip netns add ns6


Add veths



ip link add eth0 type veth peer name eth1
ip link add eth2 type veth peer name eth3
ip link add eth4 type veth peer name eth5
ip link add eth6 type veth peer name eth7
ip link add eth8 type veth peer name eth9


link veths



ip link set netns ns1 eth0
ip link set netns ns2 eth3
ip link set netns ns3 eth6
ip link set netns ns4 eth9
ip link set netns ns5 eth1
ip link set netns ns5 eth2
ip link set netns ns5 eth4
ip link set netns ns6 eth5
ip link set netns ns6 eth7
ip link set netns ns6 eth8


assign mac's



ip netns exec ns1 ifconfig eth0 hw ether 00:00:00:00:00:00 
ip netns exec ns2 ifconfig eth3 hw ether 03:03:03:03:03:03
ip netns exec ns3 ifconfig eth6 hw ether 06:06:06:06:06:06
ip netns exec ns4 ifconfig eth9 hw ether 09:09:09:09:09:09


Can anyone help?










share|improve this question




















  • 1





    en.wikipedia.org/wiki/MAC_address#Address_details . Some values are just invalid (or doesn't make sense)

    – A.B
    Apr 20 '18 at 14:35













  • it is failing for any address

    – user3598542
    Apr 20 '18 at 15:40






  • 1





    When debugging, or asking for help, reduce the problem to the simplest form. In this case, instead of doing 10 interfaces, do just 1. Provide details on that. Show the status of the interface within the namespace, show the error message after the command which generated it, not at the top of the question, etc.

    – Patrick
    Apr 20 '18 at 16:11













  • And BTW, instead of figuring out the format of a valid MAC address, you can also just keep the MAC addresses that get assigned automatically - unless you want to do something that requires specific MAC addresses, but it that case you probably would have tried with valid ones.

    – dirkt
    Apr 20 '18 at 17:34














0












0








0








I have created 6 namespaces and configured them with veth links. I'm trying to attach MAC address. But the following error is shown :



SIOCSIFHWADDR: Cannot assign requested address
SIOCSIFHWADDR: Cannot assign requested address
SIOCSIFHWADDR: Cannot assign requested address


Here is my code :



Add namespaces



ip netns add ns1
ip netns add ns2
ip netns add ns3
ip netns add ns4
ip netns add ns5
ip netns add ns6


Add veths



ip link add eth0 type veth peer name eth1
ip link add eth2 type veth peer name eth3
ip link add eth4 type veth peer name eth5
ip link add eth6 type veth peer name eth7
ip link add eth8 type veth peer name eth9


link veths



ip link set netns ns1 eth0
ip link set netns ns2 eth3
ip link set netns ns3 eth6
ip link set netns ns4 eth9
ip link set netns ns5 eth1
ip link set netns ns5 eth2
ip link set netns ns5 eth4
ip link set netns ns6 eth5
ip link set netns ns6 eth7
ip link set netns ns6 eth8


assign mac's



ip netns exec ns1 ifconfig eth0 hw ether 00:00:00:00:00:00 
ip netns exec ns2 ifconfig eth3 hw ether 03:03:03:03:03:03
ip netns exec ns3 ifconfig eth6 hw ether 06:06:06:06:06:06
ip netns exec ns4 ifconfig eth9 hw ether 09:09:09:09:09:09


Can anyone help?










share|improve this question
















I have created 6 namespaces and configured them with veth links. I'm trying to attach MAC address. But the following error is shown :



SIOCSIFHWADDR: Cannot assign requested address
SIOCSIFHWADDR: Cannot assign requested address
SIOCSIFHWADDR: Cannot assign requested address


Here is my code :



Add namespaces



ip netns add ns1
ip netns add ns2
ip netns add ns3
ip netns add ns4
ip netns add ns5
ip netns add ns6


Add veths



ip link add eth0 type veth peer name eth1
ip link add eth2 type veth peer name eth3
ip link add eth4 type veth peer name eth5
ip link add eth6 type veth peer name eth7
ip link add eth8 type veth peer name eth9


link veths



ip link set netns ns1 eth0
ip link set netns ns2 eth3
ip link set netns ns3 eth6
ip link set netns ns4 eth9
ip link set netns ns5 eth1
ip link set netns ns5 eth2
ip link set netns ns5 eth4
ip link set netns ns6 eth5
ip link set netns ns6 eth7
ip link set netns ns6 eth8


assign mac's



ip netns exec ns1 ifconfig eth0 hw ether 00:00:00:00:00:00 
ip netns exec ns2 ifconfig eth3 hw ether 03:03:03:03:03:03
ip netns exec ns3 ifconfig eth6 hw ether 06:06:06:06:06:06
ip netns exec ns4 ifconfig eth9 hw ether 09:09:09:09:09:09


Can anyone help?







linux namespace






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 20 '18 at 22:02









Rui F Ribeiro

40.3k1479136




40.3k1479136










asked Apr 20 '18 at 14:18









user3598542user3598542

61




61








  • 1





    en.wikipedia.org/wiki/MAC_address#Address_details . Some values are just invalid (or doesn't make sense)

    – A.B
    Apr 20 '18 at 14:35













  • it is failing for any address

    – user3598542
    Apr 20 '18 at 15:40






  • 1





    When debugging, or asking for help, reduce the problem to the simplest form. In this case, instead of doing 10 interfaces, do just 1. Provide details on that. Show the status of the interface within the namespace, show the error message after the command which generated it, not at the top of the question, etc.

    – Patrick
    Apr 20 '18 at 16:11













  • And BTW, instead of figuring out the format of a valid MAC address, you can also just keep the MAC addresses that get assigned automatically - unless you want to do something that requires specific MAC addresses, but it that case you probably would have tried with valid ones.

    – dirkt
    Apr 20 '18 at 17:34














  • 1





    en.wikipedia.org/wiki/MAC_address#Address_details . Some values are just invalid (or doesn't make sense)

    – A.B
    Apr 20 '18 at 14:35













  • it is failing for any address

    – user3598542
    Apr 20 '18 at 15:40






  • 1





    When debugging, or asking for help, reduce the problem to the simplest form. In this case, instead of doing 10 interfaces, do just 1. Provide details on that. Show the status of the interface within the namespace, show the error message after the command which generated it, not at the top of the question, etc.

    – Patrick
    Apr 20 '18 at 16:11













  • And BTW, instead of figuring out the format of a valid MAC address, you can also just keep the MAC addresses that get assigned automatically - unless you want to do something that requires specific MAC addresses, but it that case you probably would have tried with valid ones.

    – dirkt
    Apr 20 '18 at 17:34








1




1





en.wikipedia.org/wiki/MAC_address#Address_details . Some values are just invalid (or doesn't make sense)

– A.B
Apr 20 '18 at 14:35







en.wikipedia.org/wiki/MAC_address#Address_details . Some values are just invalid (or doesn't make sense)

– A.B
Apr 20 '18 at 14:35















it is failing for any address

– user3598542
Apr 20 '18 at 15:40





it is failing for any address

– user3598542
Apr 20 '18 at 15:40




1




1





When debugging, or asking for help, reduce the problem to the simplest form. In this case, instead of doing 10 interfaces, do just 1. Provide details on that. Show the status of the interface within the namespace, show the error message after the command which generated it, not at the top of the question, etc.

– Patrick
Apr 20 '18 at 16:11







When debugging, or asking for help, reduce the problem to the simplest form. In this case, instead of doing 10 interfaces, do just 1. Provide details on that. Show the status of the interface within the namespace, show the error message after the command which generated it, not at the top of the question, etc.

– Patrick
Apr 20 '18 at 16:11















And BTW, instead of figuring out the format of a valid MAC address, you can also just keep the MAC addresses that get assigned automatically - unless you want to do something that requires specific MAC addresses, but it that case you probably would have tried with valid ones.

– dirkt
Apr 20 '18 at 17:34





And BTW, instead of figuring out the format of a valid MAC address, you can also just keep the MAC addresses that get assigned automatically - unless you want to do something that requires specific MAC addresses, but it that case you probably would have tried with valid ones.

– dirkt
Apr 20 '18 at 17:34










1 Answer
1






active

oldest

votes


















4














There is no namespace issue. There is no veth (virtual ethernet) type issue. The only issue is the MAC address chosen:



00:00:00:00:00:00 is most certainly reserved for things like "unset" and thus invalid



Any address with the multicast bit (least-significant bit of the first octet) set can't be a card's hardware address: a multicast address can be only a destination address, not source, so this makes no sense to assign it to a card. So strike those:



03:03:03:03:03:03
09:09:09:09:09:09


Remaining valid ethernet MAC address:



06:06:06:06:06:06 which even has the local bit (second least significant bit of the first octet) set, which is preferable for tests and virtualization (but technically not mandatory at all).



As was said in comments, it's probably better to just keep those already randomly, and correctly, generated. If they are needed, just retrieve their value for later use (including reusing them later for complete reproducibility).






share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f438956%2fassign-mac-address-to-a-veth-pair%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    There is no namespace issue. There is no veth (virtual ethernet) type issue. The only issue is the MAC address chosen:



    00:00:00:00:00:00 is most certainly reserved for things like "unset" and thus invalid



    Any address with the multicast bit (least-significant bit of the first octet) set can't be a card's hardware address: a multicast address can be only a destination address, not source, so this makes no sense to assign it to a card. So strike those:



    03:03:03:03:03:03
    09:09:09:09:09:09


    Remaining valid ethernet MAC address:



    06:06:06:06:06:06 which even has the local bit (second least significant bit of the first octet) set, which is preferable for tests and virtualization (but technically not mandatory at all).



    As was said in comments, it's probably better to just keep those already randomly, and correctly, generated. If they are needed, just retrieve their value for later use (including reusing them later for complete reproducibility).






    share|improve this answer






























      4














      There is no namespace issue. There is no veth (virtual ethernet) type issue. The only issue is the MAC address chosen:



      00:00:00:00:00:00 is most certainly reserved for things like "unset" and thus invalid



      Any address with the multicast bit (least-significant bit of the first octet) set can't be a card's hardware address: a multicast address can be only a destination address, not source, so this makes no sense to assign it to a card. So strike those:



      03:03:03:03:03:03
      09:09:09:09:09:09


      Remaining valid ethernet MAC address:



      06:06:06:06:06:06 which even has the local bit (second least significant bit of the first octet) set, which is preferable for tests and virtualization (but technically not mandatory at all).



      As was said in comments, it's probably better to just keep those already randomly, and correctly, generated. If they are needed, just retrieve their value for later use (including reusing them later for complete reproducibility).






      share|improve this answer




























        4












        4








        4







        There is no namespace issue. There is no veth (virtual ethernet) type issue. The only issue is the MAC address chosen:



        00:00:00:00:00:00 is most certainly reserved for things like "unset" and thus invalid



        Any address with the multicast bit (least-significant bit of the first octet) set can't be a card's hardware address: a multicast address can be only a destination address, not source, so this makes no sense to assign it to a card. So strike those:



        03:03:03:03:03:03
        09:09:09:09:09:09


        Remaining valid ethernet MAC address:



        06:06:06:06:06:06 which even has the local bit (second least significant bit of the first octet) set, which is preferable for tests and virtualization (but technically not mandatory at all).



        As was said in comments, it's probably better to just keep those already randomly, and correctly, generated. If they are needed, just retrieve their value for later use (including reusing them later for complete reproducibility).






        share|improve this answer















        There is no namespace issue. There is no veth (virtual ethernet) type issue. The only issue is the MAC address chosen:



        00:00:00:00:00:00 is most certainly reserved for things like "unset" and thus invalid



        Any address with the multicast bit (least-significant bit of the first octet) set can't be a card's hardware address: a multicast address can be only a destination address, not source, so this makes no sense to assign it to a card. So strike those:



        03:03:03:03:03:03
        09:09:09:09:09:09


        Remaining valid ethernet MAC address:



        06:06:06:06:06:06 which even has the local bit (second least significant bit of the first octet) set, which is preferable for tests and virtualization (but technically not mandatory at all).



        As was said in comments, it's probably better to just keep those already randomly, and correctly, generated. If they are needed, just retrieve their value for later use (including reusing them later for complete reproducibility).







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 5 at 11:37









        Stéphane Chazelas

        305k57577931




        305k57577931










        answered Apr 20 '18 at 17:22









        A.BA.B

        4,9621726




        4,9621726






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f438956%2fassign-mac-address-to-a-veth-pair%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

            How to make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            19世紀