In my previous post, AdGuard Home Sync: Sync Your AdGuard Home Instances!, I wrote that I had a macVLAN in place for one of my AdGuard Home instance.
While using it, I received an email with a question about what a MACVLAN actually is, and I figured it made sense to write a post about it.
What is macVLAN?
When you’re working with Docker, you have several networking options to create a network for your containers. Portainer handles this automatically, allowing you to use either NAT or port forwarding, with the latter being the most common option. So you end up accessing your Docker with
IP-ADDRESS:PORT.
This is different when you choose MACVLAN. It allows containers to have their own MAC addresses, making them appear as separate physical devices on your network. This is very useful when you want to use your Docker to have their own dedicated IP address without NAT or port forwarding. This can be handy for dockers like AdGuard Home, Pi-hole or even Home Assistant.
This gives you the benefit of having, as already mentioned, their own dedicated IP addresses within your network. You don’t need to remember ports, and you gain full control over network configuration and communication.
Creating A macVLAN network in Portainer:
Now we’ve covered what macVLAN is, it’s time to create this in Portainer. Before you do this, you obviously need your main network’s IP.

- Navigate to Networks in Portainer.
- Click Add network.
- Assign a name to the network
- Select macvlan as the Driver.
- In the Parent field, enter the network interface. In my case, it’s eth0.
- Fill in the
- Subnet in the format of your network: 192.168.178.0/24
- Gateway IP of your router: 192.168.178.1
- Under IP range, enter the desired IP address you want to assign to your MACVLAN: 192.168.178.2.
- Click on Create Network and your macVLAN is created & saved.
Assign the macVLAN To Your Docker:
Now that you’ve created a new MACVLAN in Portainer, you need to assign it to your container. Simply go to your container, scroll down until you see Connected Networks. Here, you’ll find a dropdown list where you can locate the newly created MACVLAN and click on Join Network.
Now test your docker and it should work with the IP address which you’ve created.
Conclusion:
Using macVLAN can make your Docker setup more flexible and powerful, especially in case where you want to integrate services directly into your network. As mentioned I wanted to integrate AdGuard Home as my DNS server so this worked perfectly from me.