Executando o dnsmasq no container do docker no Debian - check_dhcp ignores dnsmasq

1

Estou testando a configuração do meu dnsmasq DHCP na máquina Debian do Virtualbox. Na produção, eu quero que o dnsmasq forneça endereços IP estáticos para sistemas guest em execução via qemu + libvirt + openvswitch (aquele que eu cobri, eles estão rodando via docker e eles funcionam)

configuração do dnsmasq:

# Tried both eth0 and br0 for an interface - more about it near bottom
interface=br0
domain-needed
bogus-priv
no-resolv
local=/mydomain.io/
no-poll
no-hosts
domain=mydomain.io
dhcp-range=192.168.1.129,192.168.1.254,255.255.255.128,192.168.1.255,12h
dhcp-option=3
log-queries
log-dhcp

Dockerfile:

FROM alpine:3.5 MAINTAINER [email protected]

# webproc release settings ENV WEBPROC_VERSION 0.1.7 ENV WEBPROC_URL https://github.com/jpillora/webproc/releases/download/$WEBPROC_VERSION/webproc_linux_amd64.gz

# fetch dnsmasq and webproc binary RUN apk update \
        && apk add --no-cache dnsmasq \
        && apk add --no-cache --virtual .build-deps curl \
        && curl -sL $WEBPROC_URL | gzip -d - > /usr/local/bin/webproc \
        && chmod +x /usr/local/bin/webproc \
        && apk del .build-deps

# configure dnsmasq run mkdir -p /etc/default/ RUN echo -e "ENABLED=1\nIGNORE_RESOLVCONF=yes" > /etc/default/dnsmasq

# run! CMD ["webproc","--config","/etc/dnsmasq.conf","--","dnsmasq","--no-daemon","--dhcp-broadcast"]

Comandos para criar e executar o contêiner:

docker build -t dnsmasq .
docker run -d  --name=dnsmasq  --volume=/data/dnsmasq.conf:/etc/dnsmasq.conf -p 53:53/udp -p 192.168.56.101:5380:8080 --net host -e "USER=foo" -e "PASS=bar" dnsmasq

docker logs dnsmasq

[webproc] 2017/01/11 07:17:09 loaded config files changes from disk
[webproc] 2017/01/11 07:17:09 agent listening on http://0.0.0.0:8080...
dnsmasq: started, version 2.76 cachesize 150
dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-DNSSEC loop-detect inotify
dnsmasq-dhcp: DHCP, IP range 192.168.1.129 -- 192.168.1.254, lease time 12h
dnsmasq: using local addresses only for domain mydomain.io
dnsmasq: cleared cache
dnsmasq-dhcp: no address range available for DHCP request via eth0
dnsmasq-dhcp: no address range available for DHCP request via eth0
dnsmasq-dhcp: no address range available for DHCP request via eth0

comando check_dhcp (do pacote monitoring-plugins-basic)

/usr/lib/nagios/plugins/check_dhcp -v -s 192.168.1.129 -r 192.168.1.130
Requested server address: 192.168.1.129
DHCP socket: 3
Hardware address: 08:00:27:b6:c1:90
DHCPDISCOVER to 255.255.255.255 port 67
DHCPDISCOVER XID: 984913524 (0x3AB49674)
DHCDISCOVER ciaddr:  0.0.0.0
DHCDISCOVER yiaddr:  0.0.0.0
DHCDISCOVER siaddr:  0.0.0.0
DHCDISCOVER giaddr:  0.0.0.0
send_dhcp_packet result: 548

recv_result_1: 548
recv_result_2: 548
receive_dhcp_packet() result: 548
receive_dhcp_packet() source: 10.0.2.2
Result=OK
DHCPOFFER from IP address 10.0.2.2 via 10.0.2.2
DHCPOFFER XID: 984913524 (0x3AB49674)
DHCPOFFER chaddr: 080027B6C190
DHCPOFFER ciaddr: 0.0.0.0
DHCPOFFER yiaddr: 10.0.2.15
DHCPOFFER siaddr: 10.0.2.4
DHCPOFFER giaddr: 0.0.0.0
Option: 53 (0x01)
Option: 1 (0x04)
Option: 3 (0x04)
Option: 6 (0x08)
Option: 15 (0x04)
Option: 51 (0x04)
Option: 54 (0x04)
Lease Time: 86400 seconds
Renewal Time: 0 seconds
Rebinding Time: 0 seconds
Added offer from server @ 10.0.2.2 of IP address 10.0.2.15

No (more) data received (nfound: 0)
Result=ERROR
Total responses seen on the wire: 1
Valid responses for this machine: 1
CRITICAL: Received 1 DHCPOFFER(s), 0 of 1 requested servers responded, requested address (192.168.1.130) was not offered, max lease time = 86400 sec.

Quando conectado a br0 com interface = br0 após o comando check_dhcp, não estou conseguindo nem

dnsmasq-dhcp: no address range available for DHCP request via eth0

... em logs. Ao contrário do que dnsmasq está ligado a eth0 É como o meu dnsmasq é ignorado e eu recebo resposta do servidor docker dhcp.

Por último, mas não menos importante, minha rota -n

0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.168.1.128   0.0.0.0         255.255.255.128 U     0      0        0 br0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1

~ obrigado pela ajuda, muito apreciado

    
por sebastian_t 11.01.2017 / 08:47

0 respostas