Code Monkey home page Code Monkey logo

docker-dnsmasq's Introduction

Docker DNSMASQ

Docker Pulls

Dnsmasq is a lightweight, easy to configure, DNS forwarder and DHCP server. It is designed to provide DNS and optionally, DHCP, to a small network. It can serve the names of local machines which are not in the global DNS. The DHCP server integrates with the DNS server and allows machines with DHCP-allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic DHCP leases and BOOTP/TFTP for network booting of diskless machines.

This fork add filter-aaaa to it.

https://github.com/coolsnowwolf/lede/blob/master/package/network/services/dnsmasq/patches/911-dnsmasq-filter-aaaa%2Bhttps%2Bunknown.patch

Example in a docker-compose

Here is a docker-compose.yml file that run a local dns server using this image. You can adapt it for your own needs as you wish.

version: '2'
services:
  dns:
    restart: always
    image: strm/dnsmasq
    volumes:
      - ./dnsmasq.conf:/etc/dnsmasq.conf
    ports:
      - "53:53/udp"
    cap_add:
      - NET_ADMIN

Deploy with ansible demo playbook

Is possible to deploy with ansible using this role to create a complete Debian buster setup with docker and everything else that you may need.

- hosts: all
  vars:
    hostname: "my_dns_server"
    domain: "strm.sh"
    network:
      ip: "192.168.0.9"
      gateway: "192.168.0.1"
      dns: "8.8.8.8"
    github_user: opsxcq
  tasks:
  - name: "Network | Create DNS container"
    copy:
      dest: /config/dnsmasq.conf
      content: |
        #log all dns queries
        log-queries
        #dont use hosts nameservers
        no-resolv
        #use google as default nameservers
        server=8.8.4.4
        server=8.8.8.8
        #explicitly define host-ip mappings
        address=/server/10.1.1.2
        address=/server/10.1.1.2

  - name: "Network | Create DNS container"
    docker_container:
      name: dns
      image: strm/dnsmasq
      restart_policy: unless-stopped
      ports:
        - "53:53/tcp"
        - "53:53/udp"
      entrypoint:
        - dnsmasq
        - "-d"
      volumes:
        - /config/dnsmasq.conf:/etc/dnsmasq.conf
      capabilities:
      - NET_ADMIN
  roles:
    - opsxcq.linux_server

Configuration Example

To be able to run the above example, you will need a configuration file. This is a very basic example that has two hosts, but it serve our purpose.

#log all dns queries
log-queries
#dont use hosts nameservers
no-resolv
#use google as default nameservers
server=8.8.4.4
server=8.8.8.8
#explicitly define host-ip mappings
address=/router/10.1.1.1
address=/server/10.1.1.2

docker-dnsmasq's People

Contributors

opsxcq avatar xsm1997 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.