Home Explore Blog Models CI



docker

1st chunk of `content/manuals/engine/network/drivers/macvlan.md`
dc1d1e2faa8a6fd61f1f065ca75c6ee6a4a4944538bfbc3d000000010000091a
---
title: Macvlan network driver
description: All about using Macvlan to make your containers appear like physical
  machines on the network
keywords: network, macvlan, standalone
aliases:
- /config/containers/macvlan/
- /engine/userguide/networking/get-started-macvlan/
- /network/macvlan/
- /network/drivers/macvlan/
---

Some applications, especially legacy applications or applications which monitor
network traffic, expect to be directly connected to the physical network. In
this type of situation, you can use the `macvlan` network driver to assign a MAC
address to each container's virtual network interface, making it appear to be
a physical network interface directly connected to the physical network. In this
case, you need to designate a physical interface on your Docker host to use for
the Macvlan, as well as the subnet and gateway of the network. You can even
isolate your Macvlan networks using different physical network interfaces.

Keep the following things in mind:

- You may unintentionally degrade your network due to IP address
  exhaustion or to "VLAN spread", a situation that occurs when you have an
  inappropriately large number of unique MAC addresses in your network.

- Your networking equipment needs to be able to handle "promiscuous mode",
  where one physical interface can be assigned multiple MAC addresses.

- If your application can work using a bridge (on a single Docker host) or
  overlay (to communicate across multiple Docker hosts), these solutions may be
  better in the long term.

## Options

The following table describes the driver-specific options that you can pass to
`--opt` when creating a network using the `macvlan` driver.

| Option         | Default  | Description                                                                   |
| -------------- | -------- | ----------------------------------------------------------------------------- |
| `macvlan_mode` | `bridge` | Sets the Macvlan mode. Can be one of: `bridge`, `vepa`, `passthru`, `private` |
| `parent`       |          | Specifies the parent interface to use.                                        |

## Create a Macvlan network

When you create a Macvlan network, it can either be in bridge mode or 802.1Q
trunk bridge mode.

- In bridge mode, Macvlan traffic goes through a physical device on the host.

Title: Macvlan Network Driver
Summary
The `macvlan` network driver allows containers to appear as directly connected to the physical network by assigning a MAC address to their virtual network interface. This is useful for legacy applications or those monitoring network traffic. However, be mindful of potential network degradation, promiscuous mode requirements, and consider bridge or overlay networks as alternatives. The driver-specific options include `macvlan_mode` (bridge, vepa, passthru, private) and `parent` (specifies the parent interface).