How to bind a Docker bridge to a specific NIC?












0















Not so new to Docker, but not nearly an expert either.



I am trying to build a Docker environment where a custom bridge is connected to a specific NIC.



The use case is to have a dedicated isolated lab network running on a separate interface eth1 on my PC with devices and services which cannot see nor interfere with the office/production network which is running on eth0.



One of the containers i am going to run is a DHCP server and i only want to give out IP addresses on eth1. Obviously I don’t want to give out IP addresses to the rest of the office over eth0.
I have been reading documentation, watching videos, doing online trainings, reading blogs. To me, what i want to achieve is something very basic, but i cannot seem to find how to do this.



Any ideas?










share|improve this question



























    0















    Not so new to Docker, but not nearly an expert either.



    I am trying to build a Docker environment where a custom bridge is connected to a specific NIC.



    The use case is to have a dedicated isolated lab network running on a separate interface eth1 on my PC with devices and services which cannot see nor interfere with the office/production network which is running on eth0.



    One of the containers i am going to run is a DHCP server and i only want to give out IP addresses on eth1. Obviously I don’t want to give out IP addresses to the rest of the office over eth0.
    I have been reading documentation, watching videos, doing online trainings, reading blogs. To me, what i want to achieve is something very basic, but i cannot seem to find how to do this.



    Any ideas?










    share|improve this question

























      0












      0








      0








      Not so new to Docker, but not nearly an expert either.



      I am trying to build a Docker environment where a custom bridge is connected to a specific NIC.



      The use case is to have a dedicated isolated lab network running on a separate interface eth1 on my PC with devices and services which cannot see nor interfere with the office/production network which is running on eth0.



      One of the containers i am going to run is a DHCP server and i only want to give out IP addresses on eth1. Obviously I don’t want to give out IP addresses to the rest of the office over eth0.
      I have been reading documentation, watching videos, doing online trainings, reading blogs. To me, what i want to achieve is something very basic, but i cannot seem to find how to do this.



      Any ideas?










      share|improve this question














      Not so new to Docker, but not nearly an expert either.



      I am trying to build a Docker environment where a custom bridge is connected to a specific NIC.



      The use case is to have a dedicated isolated lab network running on a separate interface eth1 on my PC with devices and services which cannot see nor interfere with the office/production network which is running on eth0.



      One of the containers i am going to run is a DHCP server and i only want to give out IP addresses on eth1. Obviously I don’t want to give out IP addresses to the rest of the office over eth0.
      I have been reading documentation, watching videos, doing online trainings, reading blogs. To me, what i want to achieve is something very basic, but i cannot seem to find how to do this.



      Any ideas?







      networking docker






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 11 at 13:08









      Ton MachielsenTon Machielsen

      1




      1






















          1 Answer
          1






          active

          oldest

          votes


















          0














          For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:





          1. edit the eth1 config file ifcfg-eth1:



            enter image description here




          2. edit the bridge br0 config file ifcfg-br0:



            enter image description here



          3. restart the network service: service network restart



          4. find your docker config file and change the DOCKER_NETWORK_OPTIONS into:



            DOCKER_NETWORK_OPTIONS="-b=br0"



          5. restart your docker server



          6. create your docker with no network:



            docker run -itd --net=none --name=dockerName yourImage




          7. set the network for your container and you need to install the tool pipework



            git clone https://github.com/jpetazzo/pipework
            cp ~/pipework/pipework /usr/local/bin/
            pipework br0 dockerName 192.168.0.11/24@192.168.0.141




          Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.






          share|improve this answer























            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',
            autoActivateHeartbeat: false,
            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%2f1393160%2fhow-to-bind-a-docker-bridge-to-a-specific-nic%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









            0














            For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:





            1. edit the eth1 config file ifcfg-eth1:



              enter image description here




            2. edit the bridge br0 config file ifcfg-br0:



              enter image description here



            3. restart the network service: service network restart



            4. find your docker config file and change the DOCKER_NETWORK_OPTIONS into:



              DOCKER_NETWORK_OPTIONS="-b=br0"



            5. restart your docker server



            6. create your docker with no network:



              docker run -itd --net=none --name=dockerName yourImage




            7. set the network for your container and you need to install the tool pipework



              git clone https://github.com/jpetazzo/pipework
              cp ~/pipework/pipework /usr/local/bin/
              pipework br0 dockerName 192.168.0.11/24@192.168.0.141




            Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.






            share|improve this answer




























              0














              For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:





              1. edit the eth1 config file ifcfg-eth1:



                enter image description here




              2. edit the bridge br0 config file ifcfg-br0:



                enter image description here



              3. restart the network service: service network restart



              4. find your docker config file and change the DOCKER_NETWORK_OPTIONS into:



                DOCKER_NETWORK_OPTIONS="-b=br0"



              5. restart your docker server



              6. create your docker with no network:



                docker run -itd --net=none --name=dockerName yourImage




              7. set the network for your container and you need to install the tool pipework



                git clone https://github.com/jpetazzo/pipework
                cp ~/pipework/pipework /usr/local/bin/
                pipework br0 dockerName 192.168.0.11/24@192.168.0.141




              Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.






              share|improve this answer


























                0












                0








                0







                For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:





                1. edit the eth1 config file ifcfg-eth1:



                  enter image description here




                2. edit the bridge br0 config file ifcfg-br0:



                  enter image description here



                3. restart the network service: service network restart



                4. find your docker config file and change the DOCKER_NETWORK_OPTIONS into:



                  DOCKER_NETWORK_OPTIONS="-b=br0"



                5. restart your docker server



                6. create your docker with no network:



                  docker run -itd --net=none --name=dockerName yourImage




                7. set the network for your container and you need to install the tool pipework



                  git clone https://github.com/jpetazzo/pipework
                  cp ~/pipework/pipework /usr/local/bin/
                  pipework br0 dockerName 192.168.0.11/24@192.168.0.141




                Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.






                share|improve this answer













                For your issue, I think you can try to create a bridge and bind it to the NIC eht1. The steps will like this:





                1. edit the eth1 config file ifcfg-eth1:



                  enter image description here




                2. edit the bridge br0 config file ifcfg-br0:



                  enter image description here



                3. restart the network service: service network restart



                4. find your docker config file and change the DOCKER_NETWORK_OPTIONS into:



                  DOCKER_NETWORK_OPTIONS="-b=br0"



                5. restart your docker server



                6. create your docker with no network:



                  docker run -itd --net=none --name=dockerName yourImage




                7. set the network for your container and you need to install the tool pipework



                  git clone https://github.com/jpetazzo/pipework
                  cp ~/pipework/pipework /usr/local/bin/
                  pipework br0 dockerName 192.168.0.11/24@192.168.0.141




                Note: the container's IP address is 192.168.0.11, the netmask is 24, and the gateway is 192.168.0.141. You can change some setting according to your requirement. Hope this will help you.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 14 at 9:10









                Charles Xu - MSFTCharles Xu - MSFT

                2584




                2584






























                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1393160%2fhow-to-bind-a-docker-bridge-to-a-specific-nic%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

                    Plaza Victoria

                    Brian Clough

                    Cáceres