title: Iptables with Docker - All created networks accessible via lan, routing issue?
body: <p>I would like to make the docker host a gateway to route all traffic on the 172.0.0.0 range, so all machines will be accessible via static routes on the local lan.</p>
  
  <p>For example, take a look at the following table.</p>
  
  <pre><code>Kernel IP routing table
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 bond0
  169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 bond0
  172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
  172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-8cb984474cf3
  172.19.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-08751d4f00ac
  172.20.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-205529b1f9cc
  172.21.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-f199a191f679
  172.22.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-67ac401705aa
  172.23.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-ec7ad4f839dd
  172.24.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-f7af361c29fb
  172.25.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker_gwbridge
  192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 bond0
  192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0
  </code></pre>
  
  <p>Bond0 is the LAN in question.</p>
  
  <p>From the host we can ping each individual machine created by Docker because of the routing table.</p>
  
  <ol>
  <li><p>Setup the static route on a windows box <code>route add 172.0.0.0 MASK 255.0.0.0 192.168.2.3</code></p></li>
  <li><p>Checked forwarding is enabled on the Linux Docker Host</p></li>
  <li><p>Enabled Masquerading on the bond0 interface <code>iptables -t nat -A POSTROUTING -o bond0 -j MASQUERADE</code></p></li>
  <li><p>I chose an example interface <code>br-08751d4f00ac</code> that is 172.19.0.0</p></li>
  <li><p>Setup forwarding </p>
  
  <p><code>sudo iptables -t nat -A POSTROUTING -o bond0 -j MASQUERADE
  sudo iptables -A FORWARD -i bond0 -o br-08751d4f00ac -m state --state RELATED,ESTABLISHED -j ACCEPT
  sudo iptables -A FORWARD -i br-08751d4f00ac -o bond0 -j ACCEPT</code></p></li>
  </ol>
  
  <p>However, I still can't ping from the windows machine on the same network as bond0.</p>
  
  <pre><code>Tracing route to 172.19.0.2 over a maximum of 30 hops
  
    1    &lt;1 ms    &lt;1 ms    &lt;1 ms  192.168.2.3
    2
  </code></pre>