Community discussions

MikroTik App
 
totti4ever
just joined
Topic Author
Posts: 14
Joined: Sat Oct 16, 2021 8:12 am

Integrating a docker macvlan container into the network

Fri Jan 07, 2022 1:17 pm

Hey guys,

with your help I was able to setup a network with several vlans and approriate firewall rules and a working exposing/forwarding of my home server via https to the web! :-)
But live is boring without (technical) challenges, so I took on a new one :-D

I have running an adguard DNS server as docker container on my home server and it was working perfectly. Just that I want to have it run on an own IP (makes rules easier to understand as all devices from all vlans should be able to access it). So I set up a macvlan network with a different subnet and put it in there. I also added the new vlan to the router and Switch, except setting up a dhcp server. On the switch I did the config exactly as for the admin-network, where the home server sits right now and where everything is working as expected. For troubleshooting I also disabled all drop rules in the firewall.

And from my point of view it din't go that bad as I can see the MAC-address of the container in the hosts table of the switch, also having it's vlan id of 11 assigned. In the router itself it looks the same, so apparently there are packets coming through from the macvlan interface to the router.

So, what didn't work out? I cannot access that container, cannot even ping it. Neither can I ping from the container to the router :-(


As you guys always have great ideas, I am again hoping of a small share of them - thanks in advance!


What I did:
/interface vlan add interface=bridge name=v11-docker vlan-id=11
/interface bridge vlan add bridge=bridge tagged="bridge,eth2: switch" vlan-ids=11
/interface list member add interface=v11-docker list=VLAN
/ip address add address=10.0.11.1/24 interface=v11-docker network=10.0.11.0
/ip firewall address-list add address=10.0.11.0/24 comment=docker list=LAN-actual
/ip firewall mangle add action=log chain=prerouting in-interface=v11-docker log=yes log-prefix="docker11 - "
Last edited by totti4ever on Fri Jan 07, 2022 2:13 pm, edited 1 time in total.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Integrating a docker macvlan container into the network

Fri Jan 07, 2022 1:54 pm

Do you have bridge with vlan-filtering=yes? If so, you need to define vlan 11 as tagged on bridge and possibly on other interfaces, in "/interface bridge vlan".
 
totti4ever
just joined
Topic Author
Posts: 14
Joined: Sat Oct 16, 2021 8:12 am

Re: Integrating a docker macvlan container into the network

Fri Jan 07, 2022 2:14 pm

Oh, I missed that line. I have it like this (also added in the first post):
/interface bridge vlan add bridge=bridge tagged="bridge,eth2: switch" vlan-ids=11
 
pe1chl
Forum Guru
Forum Guru
Posts: 10234
Joined: Mon Jun 08, 2015 12:09 pm

Re: Integrating a docker macvlan container into the network

Fri Jan 07, 2022 2:23 pm

One piece of advise (but likely not the cause of your problem now): do not casually rename interfaces, especially not with such complex names. eth2-switch would be acceptable. Use "comment" when you want to use descriptive tags for interfaces.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: Integrating a docker macvlan container into the network

Fri Jan 07, 2022 9:34 pm

I'd configure switch to have one untagged port for vlan 11, connect some device to it, and I'd try whether it can communicate with DNS server or RB. Ideally it should be both, but if it's only one, it will tell you where to look.
 
totti4ever
just joined
Topic Author
Posts: 14
Joined: Sat Oct 16, 2021 8:12 am

Re: Integrating a docker macvlan container into the network  [SOLVED]

Sat Jan 08, 2022 8:40 am

Okay, I have no clue what is happening exactly. But when I don't use the vlan tag as subtag of the parent (bond0 instead of bond0.11) and then use the same subnet as the host.

I might try to find out how they other way works, but for now I'm happy it is working. Thanks for your support again!

Who is online

Users browsing this forum: Frostbite1991, JohnConnett, scoobyn8 and 89 guests