Debian, docker, macvlan and static IPv6
2
votes
0
answers
1399
views
# Problem
I am trying to setup a local DNS server (pihole) inside a docker container on my debian 11 server in my home network with a static IPv6, such that I can point all lookups from my router to it.
# What I have so far
* As this is a home network, my router reconnects in certain intervals, which does not allow me to use theglobal IPv6 prefix.
* `
docker
` service is running on my server
* I'm using docker-compose, the compose file looks like this currently:
version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp"
environment:
TZ: 'Europe/Berlin'
# WEBPASSWORD: 'set a secure password here or it will be random'
WEBPASSWORD: 'XXXXXXXXX'
# Volumes store your data between container upgrades
volumes:
- type: bind
source: ./etc-pihole/
target: /etc/pihole/
- type: bind
source: ./etc-dnsmasq.d
target: /etc/dnsmasq.d/
# Recommended but not required (DHCP needs NET_ADMIN)
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
cap_add:
- NET_ADMIN
#option not needed wen used in combinationwith systemd
#restart: unless-stopped
networks:
macvlan:
ipv4_address: 10.10.1.51
ipv6_address: fd00:0:0:1:50::51
networks:
macvlan:
driver: macvlan
enable_ipv6: true
driver_opts:
parent: enp7s0
ipam:
config:
- subnet: 10.10.1.50/24
gateway: 10.10.1.1
- subnet: fd00:0:0:1:50::/80
gateway: fd00:0:0:1:2e91:abff:fe91:baa0
* The whole IPv4 setup is working, however I do not fully understand how to setup the macvlan, such that the dockered pihole can work as a DNS server in my home network.
* The `fd00:0:0:1:2e91:abff:fe91:baa0
` is the local address of my router.
* `docker-compose up
` yields:
failed to create network dc_pihole_macvlan: Error response from daemon: Invalid subnet fd00:0:0:1:50:/80 : invalid CIDR address: fd00:0:0:1:50:/80
# Questions
* Is what I am trying to do feasible at all?
* Is this the correct setup for what I am trying to do?
* How can I get the container to start?
# Edits 1
* After the suggested syntax fixes,the docker container starts. From a bash inside the container, I can ping my router at `fd00:0:0:1:2e91:abff:fe91:baa0
. I can also ping
ipv6.google.com
and it gets resolved to the correct IPv6, but strangely, only one of four packets is transmitted. Why? See attached output, where
PROVIDER-PREFIX-RM
` is my (current) scope global prefix:
root@c4ca40297eaa:/# ping ipv6.google.com -c 4
PING ipv6.google.com(fra24s11-in-x0e.1e100.net (2a00:1450:4001:830::200e)) 56 data bytes
From PROVIDER-PREFIX-RM:42:aff:fe0a:133 (PROVIDER-PREFIX-RM:42:aff:fe0a:133): icmp_seq=1 Destination unreachable: Address unreachable
From PROVIDER-PREFIX-RM:42:aff:fe0a:133 (PROVIDER-PREFIX-RM:42:aff:fe0a:133): icmp_seq=2 Destination unreachable: Address unreachable
From PROVIDER-PREFIX-RM:42:aff:fe0a:133 (PROVIDER-PREFIX-RM:42:aff:fe0a:133): icmp_seq=3 Destination unreachable: Address unreachable
64 bytes from fra24s11-in-x0e.1e100.net (2a00:1450:4001:830::200e): icmp_seq=4 ttl=115 time=18.7 ms
--- ipv6.google.com ping statistics ---
4 packets transmitted, 1 received, +3 errors, 75% packet loss, time 95ms
rtt min/avg/max/mdev = 18.738/18.738/18.738/0.000 ms, pipe 3
* Addendum: Obviously I am new to this, so if you feel like suggesting a betternumbering scheme, by all means, do.
Asked by marc
(121 rep)
Jan 4, 2022, 06:25 PM
Last activity: Jan 5, 2022, 12:07 AM
Last activity: Jan 5, 2022, 12:07 AM