# Create a MAC VLAN network

##### Description

The command below is an example of creating a layer 2 macvlan network in docker. In the example below, the network I am using is 10.128.140.0/24 on interface ens160. You will have to replace the subnet and interface according to your install.

##### Conifguration

> <span class="s1">docker network create -d macvlan --subnet=10.128.140.0/24 --gateway 10.128.140.1 -o parent=ens160 L2-Connect</span>

<span class="s1">and this is how you add a VLAN network</span>

> docker network create -d macvlan --subnet=172.16.8.0/22 --gateway 172.16.8.1 -o parent=ens192.40 Data-40-L2-Connect

<span class="s1">After creation of the network you can take a look to make sure it exists</span>

> <span class="s1">root@container:~# docker network ls</span>
> 
> <span class="s1">NETWORK ID <span class="Apple-converted-space"> </span>NAME <span class="Apple-converted-space"> </span>DRIVER<span class="Apple-converted-space"> </span>SCOPE</span>
> 
> <span class="s1">01734d37ed78 <span class="Apple-converted-space"> </span>L2-Connect <span class="Apple-converted-space"> </span>macvlan <span class="Apple-converted-space"> </span>local</span>
> 
> <span class="s1">310563fabcd7 <span class="Apple-converted-space"> </span>bridge <span class="Apple-converted-space"> </span>bridge<span class="Apple-converted-space"> </span>local</span>
> 
> <span class="s1">4bc024cbd7cc <span class="Apple-converted-space"> </span>host <span class="Apple-converted-space"> </span>host<span class="Apple-converted-space"> </span>local</span>
> 
> <span class="s1">d2879a267450 <span class="Apple-converted-space"> </span>none <span class="Apple-converted-space"> </span>null<span class="Apple-converted-space"> </span>local</span>