In the previous section we prepared the Macvlan experimental environment, and today we create Macvlan network Mac_net1 in Host1 and host2:
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768401876055089.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768498693056007.jpg "style=" border:0px;float:none; "/>
Note: The same command will be executed in Host2 .
-d macvlan
① specifies driver as Macvlan.
②macvlan Network is the local network, in order to ensure that cross-host communication, users need to manage their own IP subnet.
③ Unlike other networks, Docker does not create a gateway for Macvlan, where the gateway should be real, or the container cannot be routed.
-o parent
④ Specifies the network interface to use.
Run the container bbox1 in host1 and connect to Mac_net1.
Since Mac_net1 in Host1 is inherently independent from Mac_net1 in Host2, in order to avoid IP collisions caused by automatic assignment, we'd better --ip
Specify Bbox1 address as 172.16.86.10 。
In Host2, run the container bbox2, specifying the IP 172.16.86.11.
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768402042042258.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768499077041361.jpg "style=" border:0px;float:none; "/>
Verify the connectivity of Bbox1 and Bbox1.
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768402030088381.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768499193070510.jpg "style=" border:0px;float:none; "/>
Bbox2 can ping the IP 172.16.86.10 to Bbox1, but cannot resolve the "BBOX1" hostname.
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768402136017090.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768499359088665.jpg "style=" border:0px;float:none; "/>
Docker does not provide DNS services for Macvlan, which is different from the overlay network.
In the next section we will analyze the network structure of Macvlan in detail.
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768353037013636.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20170815-1502768499490091285.jpg "alt=" two-dimensional code + fingerprint. png "style=" border:0px; "/>
Create Macvlan Network-5 minutes a day to play Docker container technology (55)