I'm looking to deploy containers across different VLANs in my network. While I'm considering using IPVlan since I haven't tried it yet, I've noticed a lot of people advocating for MACVlan. What are the major differences between the two, and which one do you think I should go with? Thanks for your insights!
4 Answers
It really depends on what you need. Do you require different MAC addresses for each container? That's a significant factor that differentiates the two. If you don’t need those distinct addresses, that simplifies things a lot for you.
MACVlan is the way to go because it operates on layer 2, making containers act like separate devices. You’ll have more flexibility in how you configure them on your network. Just keep in mind that IPVlan has some limitations, especially with container-to-host communication.
Honestly, putting containers on different VLANs can be overkill for most scenarios. A bridge network usually works fine for lab environments. It saves a lot of headaches if you don’t really need that complexity.
I encountered this need too! Certain applications like Home Assistant require access to devices on separate VLANs.
I'd recommend going with MACVlan. I use it for my setups because it allows me to put containers on a VLAN with specific traffic rules, like routing through a VPN. Whenever I need to add a new container behind the VPN, I just place it in that MACVlan network, and it works seamlessly without any extra hassle.
That sounds like a solid setup! I'll look into setting up similar traffic rules.

I know some folks who deploy a separate host for each VLAN, and that seems like a manageable solution.