I would like to configure a silmple working dnsmasq container using a macvlan network interface, in order to give the container a separate ip adress from the host. I am working in openmediavault with the docker-compose plug in.
Here is the network interface i configured:
[
{
"Name": "vlan",
"Id": "6a06e53dde616aa0075631dab00501f9ee6d6e4a4707920617942f53bd664de0",
"Created": "2025-02-24T12:02:34.77146941+01:00",
"Scope": "local",
"Driver": "macvlan",
"EnableIPv4": true,
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "192.168.178.0/24",
"IPRange": "192.168.178.200/29",
"Gateway": "192.168.178.1",
"AuxiliaryAddresses": {
"nas": "192.168.178.208"
}
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {
"parent": "enp0s3"
},
"Labels": {}
}
]
while the compose file is:
name: dnsmasq-vlan
services:
dns:
cap_add:
- NET_ADMIN
environment:
PGID: "100"
PUID: "1001"
image: strm/dnsmasq
networks:
vlan:
ipv4_address: 192.168.178.201
ports:
- mode: ingress
target: 53
published: "53"
protocol: udp
- mode: ingress
target: 53
published: "53"
protocol: tcp
restart: always
volumes:
- type: bind
source: /srv/dev-disk-by-uuid-f5057fec-517b-4050-8826-545e85f6bb4b/appdata/dnsmasq/dnsmasq.conf
target: /etc/dnsmasq.conf
bind:
create_host_path: true
networks:
vlan:
name: vlan
external: true
The container starts with no errors, but i cannot reach the internet from it (e.g. ping google.com). Also, docker doesnât display any ports used by the container.
I am new to docker, and the reason why I wanted to configure the macvlan interface is because both dnsmasq and open media vault use port 53. For completeness if I start dnsmasq with the default network, but only with port 53 udp, it gives no error and the internet connection is fine, but I am afraid about the conflicts with the host (and also dnsmasq might need port 53 tcp for some reason).
Is there anything I can do to properly configure the macvlan driver?