Connecting network namespace to internet via Linux bridgeLXC container no outgoing traffic with bridged...

Why didn't Voldemort know what Grindelwald looked like?

How to get directions in deep space?

How would a solely written language work mechanically

Reason why a kingside attack is not justified

Is there any common country to visit for persons holding UK and Schengen visas?

New Order #2: Turn My Way

Derivative of an interpolated function

Can you take a "free object interaction" while incapacitated?

Why can't I get pgrep output right to variable on bash script?

When is the exact date for EOL of Ubuntu 14.04 LTS?

Using an older 200A breaker panel on a 60A feeder circuit from house?

Recursively move files within sub directories

Should a narrator ever describe things based on a character's view instead of facts?

How to test the sharpness of a knife?

Calculate Pi using Monte Carlo

Taking the numerator and the denominator

Do people actually use the word "kaputt" in conversation?

Is there a distance limit for minecart tracks?

How do I lift the insulation blower into the attic?

What is the purpose of using a decision tree?

How can a new country break out from a developed country without war?

Relations between homogeneous polynomials

Friend wants my recommendation but I don't want to give it to him

Travelling in US for more than 90 days



Connecting network namespace to internet via Linux bridge


LXC container no outgoing traffic with bridged network and public IP addressWill NAT bridged LXC unprivileged containers routes the http calls to host http server via the lan network?













0















I am running a Ubuntu 16.04 host. I have 3 network namespaces: ns1,ns2 and ns3.



 # ip netns add ns1
# ip netns add ns2
# ip netns add ns3


I also created a Linux bridge using brctl called testbr.



Using 3 veth pairs, I connected the three network namespaces to the linux bridge (each pair has one end attached to a network namespace and other end attached to the bridge.



ns1 (veth11) --- (veth12) testbr
ns2 (veth22) --- (veth22) testbr
ns2 (veth32) --- (veth32) testbr


I also assigned them IP addresses.



ns1 (veth11: 10.0.0.1) --- (veth12) testbr
ns2 (veth22: 10.0.0.2) --- (veth22) testbr
ns2 (veth32: 10.0.0.3) --- (veth32) testbr


With this setup I am able to ping ns2 or ns3 from ns1. The following works:



# ip netns exec ns1 ping 10.0.0.2


I want to able to ping IPs outside my host from one of the network namespace. For the example, the following should work:



# ip netns exec ns1 ping 8.8.8.8


I want to ask how can I connect my containers (network namespaces) to the internet via the bridge I have setup.









share



























    0















    I am running a Ubuntu 16.04 host. I have 3 network namespaces: ns1,ns2 and ns3.



     # ip netns add ns1
    # ip netns add ns2
    # ip netns add ns3


    I also created a Linux bridge using brctl called testbr.



    Using 3 veth pairs, I connected the three network namespaces to the linux bridge (each pair has one end attached to a network namespace and other end attached to the bridge.



    ns1 (veth11) --- (veth12) testbr
    ns2 (veth22) --- (veth22) testbr
    ns2 (veth32) --- (veth32) testbr


    I also assigned them IP addresses.



    ns1 (veth11: 10.0.0.1) --- (veth12) testbr
    ns2 (veth22: 10.0.0.2) --- (veth22) testbr
    ns2 (veth32: 10.0.0.3) --- (veth32) testbr


    With this setup I am able to ping ns2 or ns3 from ns1. The following works:



    # ip netns exec ns1 ping 10.0.0.2


    I want to able to ping IPs outside my host from one of the network namespace. For the example, the following should work:



    # ip netns exec ns1 ping 8.8.8.8


    I want to ask how can I connect my containers (network namespaces) to the internet via the bridge I have setup.









    share

























      0












      0








      0








      I am running a Ubuntu 16.04 host. I have 3 network namespaces: ns1,ns2 and ns3.



       # ip netns add ns1
      # ip netns add ns2
      # ip netns add ns3


      I also created a Linux bridge using brctl called testbr.



      Using 3 veth pairs, I connected the three network namespaces to the linux bridge (each pair has one end attached to a network namespace and other end attached to the bridge.



      ns1 (veth11) --- (veth12) testbr
      ns2 (veth22) --- (veth22) testbr
      ns2 (veth32) --- (veth32) testbr


      I also assigned them IP addresses.



      ns1 (veth11: 10.0.0.1) --- (veth12) testbr
      ns2 (veth22: 10.0.0.2) --- (veth22) testbr
      ns2 (veth32: 10.0.0.3) --- (veth32) testbr


      With this setup I am able to ping ns2 or ns3 from ns1. The following works:



      # ip netns exec ns1 ping 10.0.0.2


      I want to able to ping IPs outside my host from one of the network namespace. For the example, the following should work:



      # ip netns exec ns1 ping 8.8.8.8


      I want to ask how can I connect my containers (network namespaces) to the internet via the bridge I have setup.









      share














      I am running a Ubuntu 16.04 host. I have 3 network namespaces: ns1,ns2 and ns3.



       # ip netns add ns1
      # ip netns add ns2
      # ip netns add ns3


      I also created a Linux bridge using brctl called testbr.



      Using 3 veth pairs, I connected the three network namespaces to the linux bridge (each pair has one end attached to a network namespace and other end attached to the bridge.



      ns1 (veth11) --- (veth12) testbr
      ns2 (veth22) --- (veth22) testbr
      ns2 (veth32) --- (veth32) testbr


      I also assigned them IP addresses.



      ns1 (veth11: 10.0.0.1) --- (veth12) testbr
      ns2 (veth22: 10.0.0.2) --- (veth22) testbr
      ns2 (veth32: 10.0.0.3) --- (veth32) testbr


      With this setup I am able to ping ns2 or ns3 from ns1. The following works:



      # ip netns exec ns1 ping 10.0.0.2


      I want to able to ping IPs outside my host from one of the network namespace. For the example, the following should work:



      # ip netns exec ns1 ping 8.8.8.8


      I want to ask how can I connect my containers (network namespaces) to the internet via the bridge I have setup.







      container





      share












      share










      share



      share










      asked 52 secs ago









      JakeJake

      1631213




      1631213






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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%2faskubuntu.com%2fquestions%2f1127089%2fconnecting-network-namespace-to-internet-via-linux-bridge%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • 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%2faskubuntu.com%2fquestions%2f1127089%2fconnecting-network-namespace-to-internet-via-linux-bridge%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

          Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

          Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

          Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...