Linux bridge SNAT with ebtables2019 Community Moderator ElectionUsing a bridge, an LXC container can't ping router, but the host OS cantc on bridge portBridge interfaces with Vlan on Linux based access pointPackets not moving through linux ethernet bridgePacket flow in a virtual bridge with two interfaces, centos 7VM host management in case of Linux bridgeWhy assign MAC and IP addresses on Bridge interfaceiptables not filtering bridged trafficDoes ping omit iptables / postrouting rulesLinux bridge stops working after adding 2nd interface

Latex does not go to next line

Are there historical instances of the capital of a colonising country being temporarily or permanently shifted to one of its colonies?

Linux Ubuntu 18.04 Full Backup

Do f-stop and exposure time perfectly cancel?

Is there a difference between equilibrium and steady state?

Child Theme Path Being Ignored With wp_enqueue_scripts

How to draw cubes in a 3 dimensional plane

Why the color red for the Republican Party

How is the wildcard * interpreted as a command?

Why was Goose renamed from Chewie for the Captain Marvel film?

Why is computing ridge regression with a Cholesky decomposition much quicker than using SVD?

How did Alan Turing break the enigma code using the hint given by the lady in the bar?

Conservation of Mass and Energy

Is "conspicuously missing" or "conspicuously" the subject of this sentence?

Coax or bifilar choke

Database Backup for data and log files

Death from old age has stopped, but fertility window is the same. What is the new population equlibrium?

If I receive a SOS signal, what is the proper response?

How can I get players to stop ignoring or overlooking the plot hooks I'm giving them?

Find longest word in a string: are any of these algorithms good?

Sort with one element at the end

How many characters using PHB rules does it take to be able to have access to any PHB spell at the start of an adventuring day?

Why does liquid water form when we exhale on a mirror?

How are showroom/display vehicles prepared?



Linux bridge SNAT with ebtables



2019 Community Moderator ElectionUsing a bridge, an LXC container can't ping router, but the host OS cantc on bridge portBridge interfaces with Vlan on Linux based access pointPackets not moving through linux ethernet bridgePacket flow in a virtual bridge with two interfaces, centos 7VM host management in case of Linux bridgeWhy assign MAC and IP addresses on Bridge interfaceiptables not filtering bridged trafficDoes ping omit iptables / postrouting rulesLinux bridge stops working after adding 2nd interface










4















I was reading the following code (dot1x bridge bypass):
https://github.com/mubix/8021xbridge/blob/master/scripts/trans_bridge.prepop



A quick description, we have 2 interfaces, the first is connected to a switch ($SWINT) and the other to our target host. The goal is to
interact with the rest of the network, while making it look like the traffic is generated by the target host.



From the referenced code, what I am trying to figure out is why both of the below commands are needed:



# use ebtables to source NAT the $COMPMAC for traffic leaving the device from the bridge mac address
(A)ebtables -t nat -A POSTROUTING -s $SWMAC -o $SWINT -j snat --to-src $COMPMAC
(B)ebtables -t nat -A POSTROUTING -s $SWMAC -o $BRINT -j snat --to-src $COMPMAC


I don't get why it's needed to SNAT the POSTROUTING traffic of $BRINT. Since our goal is to avoid transmitting any frames towards switch side interface with source MAC different than the target host, shouldn't the first ebtables rule be suffice?



Or in other words, isn't $SWINT (switch side interface) the only way any frames are getting to the switch? Based on the diagram below, the rule (B) looks redundant since we only care for frames going towards eth0 (SWINT), and we already apply SNAT to eth0.



Some good resources I found on bridges (but still haven't answered my question) are:



Understanding Linux Network Internals



Anatomy of Linux Bridge



ebtables with Linux Bridge



https://doc.lagout.org/operating%20system%20/linux/Understanding%20Linux%20Network%20Internals.pdf Page:359
https://doc.lagout.org/operating%20system%20/linux/Understanding%20Linux%20Network%20Internals.pdf Page 359










share|improve this question




























    4















    I was reading the following code (dot1x bridge bypass):
    https://github.com/mubix/8021xbridge/blob/master/scripts/trans_bridge.prepop



    A quick description, we have 2 interfaces, the first is connected to a switch ($SWINT) and the other to our target host. The goal is to
    interact with the rest of the network, while making it look like the traffic is generated by the target host.



    From the referenced code, what I am trying to figure out is why both of the below commands are needed:



    # use ebtables to source NAT the $COMPMAC for traffic leaving the device from the bridge mac address
    (A)ebtables -t nat -A POSTROUTING -s $SWMAC -o $SWINT -j snat --to-src $COMPMAC
    (B)ebtables -t nat -A POSTROUTING -s $SWMAC -o $BRINT -j snat --to-src $COMPMAC


    I don't get why it's needed to SNAT the POSTROUTING traffic of $BRINT. Since our goal is to avoid transmitting any frames towards switch side interface with source MAC different than the target host, shouldn't the first ebtables rule be suffice?



    Or in other words, isn't $SWINT (switch side interface) the only way any frames are getting to the switch? Based on the diagram below, the rule (B) looks redundant since we only care for frames going towards eth0 (SWINT), and we already apply SNAT to eth0.



    Some good resources I found on bridges (but still haven't answered my question) are:



    Understanding Linux Network Internals



    Anatomy of Linux Bridge



    ebtables with Linux Bridge



    https://doc.lagout.org/operating%20system%20/linux/Understanding%20Linux%20Network%20Internals.pdf Page:359
    https://doc.lagout.org/operating%20system%20/linux/Understanding%20Linux%20Network%20Internals.pdf Page 359










    share|improve this question


























      4












      4








      4








      I was reading the following code (dot1x bridge bypass):
      https://github.com/mubix/8021xbridge/blob/master/scripts/trans_bridge.prepop



      A quick description, we have 2 interfaces, the first is connected to a switch ($SWINT) and the other to our target host. The goal is to
      interact with the rest of the network, while making it look like the traffic is generated by the target host.



      From the referenced code, what I am trying to figure out is why both of the below commands are needed:



      # use ebtables to source NAT the $COMPMAC for traffic leaving the device from the bridge mac address
      (A)ebtables -t nat -A POSTROUTING -s $SWMAC -o $SWINT -j snat --to-src $COMPMAC
      (B)ebtables -t nat -A POSTROUTING -s $SWMAC -o $BRINT -j snat --to-src $COMPMAC


      I don't get why it's needed to SNAT the POSTROUTING traffic of $BRINT. Since our goal is to avoid transmitting any frames towards switch side interface with source MAC different than the target host, shouldn't the first ebtables rule be suffice?



      Or in other words, isn't $SWINT (switch side interface) the only way any frames are getting to the switch? Based on the diagram below, the rule (B) looks redundant since we only care for frames going towards eth0 (SWINT), and we already apply SNAT to eth0.



      Some good resources I found on bridges (but still haven't answered my question) are:



      Understanding Linux Network Internals



      Anatomy of Linux Bridge



      ebtables with Linux Bridge



      https://doc.lagout.org/operating%20system%20/linux/Understanding%20Linux%20Network%20Internals.pdf Page:359
      https://doc.lagout.org/operating%20system%20/linux/Understanding%20Linux%20Network%20Internals.pdf Page 359










      share|improve this question
















      I was reading the following code (dot1x bridge bypass):
      https://github.com/mubix/8021xbridge/blob/master/scripts/trans_bridge.prepop



      A quick description, we have 2 interfaces, the first is connected to a switch ($SWINT) and the other to our target host. The goal is to
      interact with the rest of the network, while making it look like the traffic is generated by the target host.



      From the referenced code, what I am trying to figure out is why both of the below commands are needed:



      # use ebtables to source NAT the $COMPMAC for traffic leaving the device from the bridge mac address
      (A)ebtables -t nat -A POSTROUTING -s $SWMAC -o $SWINT -j snat --to-src $COMPMAC
      (B)ebtables -t nat -A POSTROUTING -s $SWMAC -o $BRINT -j snat --to-src $COMPMAC


      I don't get why it's needed to SNAT the POSTROUTING traffic of $BRINT. Since our goal is to avoid transmitting any frames towards switch side interface with source MAC different than the target host, shouldn't the first ebtables rule be suffice?



      Or in other words, isn't $SWINT (switch side interface) the only way any frames are getting to the switch? Based on the diagram below, the rule (B) looks redundant since we only care for frames going towards eth0 (SWINT), and we already apply SNAT to eth0.



      Some good resources I found on bridges (but still haven't answered my question) are:



      Understanding Linux Network Internals



      Anatomy of Linux Bridge



      ebtables with Linux Bridge



      https://doc.lagout.org/operating%20system%20/linux/Understanding%20Linux%20Network%20Internals.pdf Page:359
      https://doc.lagout.org/operating%20system%20/linux/Understanding%20Linux%20Network%20Internals.pdf Page 359







      firewall bridge






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 hours ago







      gip

















      asked Jan 13 at 20:21









      gipgip

      665




      665




















          0






          active

          oldest

          votes











          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%2f494302%2flinux-bridge-snat-with-ebtables%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 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%2f494302%2flinux-bridge-snat-with-ebtables%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







          -bridge, firewall

          Popular posts from this blog

          Creating 100m^2 grid automatically using QGIS?Creating grid constrained within polygon in QGIS?Createing polygon layer from point data using QGIS?Creating vector grid using QGIS?Creating grid polygons from coordinates using R or PythonCreating grid from spatio temporal point data?Creating fields in attributes table using other layers using QGISCreate .shp vector grid in QGISQGIS Creating 4km point grid within polygonsCreate a vector grid over a raster layerVector Grid Creates just one grid

          Why is this plane circling around the Lucknow airport every day?Why do aircraft on Flight Radar 24 jump around randomly sometimes?What airport has this walkway over a taxiway?How does Chicago O'Hare's tower sequence aircraft at peak capacity?Which airport is featured in this Delta commercial?After a crash, for how long is the airport closed?Can a passenger plane stand still in the air, or hover at a fixed location above a ground?What are those trucks towing around, and why?What is this airport outside of Cairo, Egypt?Which US airport has the lowest circling MDH?What is this airport video?

          What is this called? Old film camera viewer?What makes a good film camera?What to do with an old film camera?What should one look for when buying a used film camera?What is the value and age of this pre-1967 Ricoh 35 mm camera?DSLR recommendation, question about old Canon 35mm film Camera & lensesCan anyone identify the silver rangefinder-style camera in this advertisement?What kind of a Polaroid 600-camera is this?Will an old film camera still work even when not used in a very long time?What is this camera / Can I develop the film?How to fit an action camera into antique (bellows) housing?What to check when buying used and old film bodies?