title: Docker Macvlan network inside container is not reaching to its own host
body: <p>I have setup Macvlan network between 2 docker host as follows:</p>
  <h3>Host Setup: HOST_1 <code>ens192: 172.18.0.21</code></h3>
  <p>Create macvlan bridge interface</p>
  <pre><code>docker network  create  -d macvlan \
  --subnet=172.18.0.0/22 \
  --gateway=172.18.0.1 \
  --ip-range=172.18.1.0/28 \
  -o macvlan_mode=bridge \
  -o parent=ens192 macvlan
  </code></pre>
  <p>Create macvlan interface HOST_1</p>
  <pre><code>ip link add ens192.br link ens192 type macvlan mode bridge
  ip addr add 172.18.1.0/28 dev ens192.br
  ip link set dev ens192.br up
  </code></pre>
  <h3>Host Setup: HOST_2 <code>ens192: 172.18.0.23</code></h3>
  <p>Create macvlan bridge interface</p>
  <pre><code>docker network  create  -d macvlan \
  --subnet=172.18.0.0/22 \
  --gateway=172.18.0.1 \
  --ip-range=172.18.1.16/28 \
  -o macvlan_mode=bridge \
  -o parent=ens192 macvlan
  </code></pre>
  <p>Create macvlan interface in HOST_2</p>
  <pre><code>ip link add ens192.br link ens192 type macvlan mode bridge
  ip addr add 172.18.1.16/28 dev ens192.br
  ip link set dev ens192.br up
  </code></pre>
  <h3>Container Setup</h3>
  <p>Create containers in both host</p>
  <pre><code>HOST_1# docker run --net=macvlan -it --name macvlan_1 --rm alpine /bin/sh
  HOST_2# docker run --net=macvlan -it --name macvlan_1 --rm alpine /bin/sh
  </code></pre>
  <p>CONTAINER_1 in HOST_1</p>
  <pre><code>24: eth0@if2: &lt;BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN&gt; mtu 1500 qdisc noqueue state UNKNOWN
      link/ether 02:42:ac:12:01:00 brd ff:ff:ff:ff:ff:ff
      inet 172.18.1.0/22 brd 172.18.3.255 scope global eth0
         valid_lft forever preferred_lft forever
  </code></pre>
  <p>CONTAINER_2 in HOST_2</p>
  <pre><code>21: eth0@if2: &lt;BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN&gt; mtu 1500 qdisc noqueue state UNKNOWN
      link/ether 02:42:ac:12:01:10 brd ff:ff:ff:ff:ff:ff
      inet 172.18.1.16/22 brd 172.18.3.255 scope global eth0
         valid_lft forever preferred_lft forever
  </code></pre>
  <p>Route table in CONTAINER_1 and CONTAINER_2</p>
  <pre><code>Kernel IP routing table
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  0.0.0.0         172.18.0.1      0.0.0.0         UG    0      0        0 eth0
  172.18.0.0      0.0.0.0         255.255.252.0   U     0      0        0 eth0
  </code></pre>
  <h3>Scenario</h3>
  <p><code>HOST_1 (172.18.0.21) &lt;-&gt; HOST_2 (172.18.0.23)</code> = OK (Vice-versa)</p>
  <p><code>HOST_1 (172.18.0.21) -&gt; CONTAINER_1 (172.18.1.0) and CONTAINER_2 (172.18.1.16)</code> = OK</p>
  <p><code>HOST_2 (172.18.0.23) -&gt; CONTAINER_1 (172.18.1.0) and CONTAINER_2 (172.18.1.16)</code> = OK</p>
  <p><code>CONTAINER_1 (172.18.1.0) -&gt; HOST_2 (172.18.0.23)</code> = OK</p>
  <p><code>CONTAINER_2 (172.18.1.16) -&gt; HOST_1 (172.18.0.21)</code> = OK</p>
  <p><code>CONTAINER_1 (172.18.1.0) &lt;-&gt; CONTAINER_2 (172.18.1.16)</code> = OK (Vice-versa)</p>
  <p><code>CONTAINER_1 (172.18.1.0) -&gt; HOST_1 (172.18.0.21)</code> = FAIL</p>
  <p><code>CONTAINER_2 (172.18.1.16) -&gt; HOST_2 (172.18.0.23)</code> = FAIL</p>
  <h3>Question</h3>
  <p>I am very close to my solution I wanted to achieve except this 1 single problem.  How can I make this work for container to connect to its own host.  If there is solution to this, I would like to know how to configure in ESXi virtualization perspective and also bare-metal if there is any difference</p>