All Projects → ruudud → Devdns

ruudud / Devdns

Licence: mit
Automagic Docker DNS for local development

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Devdns

Sysuv6 Dns
May be the best DNS in SYSU.
Stars: ✭ 142 (+43.43%)
Mutual labels:  dns, dnsmasq
Elk Hole
elasticsearch, logstash and kibana configuration for pi-hole visualiziation
Stars: ✭ 136 (+37.37%)
Mutual labels:  dns, dnsmasq
Glider
glider is a forward proxy with multiple protocols support, and also a dns/dhcp server with ipset management features(like dnsmasq).
Stars: ✭ 1,710 (+1627.27%)
Mutual labels:  dns, dnsmasq
Roguesploit
Powerfull Wi-Fi trap!
Stars: ✭ 262 (+164.65%)
Mutual labels:  dns, dnsmasq
udm-host-records
Scripts to list, add, update, and remove host records in the Ubiquiti UniFI Dream Machine DNS forwarder.
Stars: ✭ 109 (+10.1%)
Mutual labels:  dns, dnsmasq
Dns Proxy
Simple DNS Proxy written in Node.JS. Override hosts, domains, or tlds. Redirect certain domains to different nameservers.
Stars: ✭ 165 (+66.67%)
Mutual labels:  dns, dnsmasq
Hosts Blocklists
Automatically updated, moderated and optimized lists for blocking ads, trackers, malware and other garbage
Stars: ✭ 1,749 (+1666.67%)
Mutual labels:  dns, dnsmasq
Dnsmasqweb
基于DNSmasq的DNS解析、以及DHCP地址分配系统
Stars: ✭ 166 (+67.68%)
Mutual labels:  dns, dnsmasq
ansible-dnsmasq
Ansible role to set up Dnsmasq in Debian-like systems
Stars: ✭ 18 (-81.82%)
Mutual labels:  dns, dnsmasq
Hblock
Improve your security and privacy by blocking ads, tracking and malware domains.
Stars: ✭ 724 (+631.31%)
Mutual labels:  dns, dnsmasq
Blockcheck
Russian ISP blocking type checker NOTE: NOT WORKING CURRENTLY. ВНИМАНИЕ: НЕ РАБОТАЕТ НА ТЕКУЩИЙ МОМЕНТ
Stars: ✭ 1,218 (+1130.3%)
Mutual labels:  dns
Wirehole
WireHole is a combination of WireGuard, Pi-hole, and Unbound in a docker-compose project with the intent of enabling users to quickly and easily create a personally managed full or split-tunnel WireGuard VPN with ad blocking capabilities thanks to Pi-hole, and DNS caching, additional privacy options, and upstream providers via Unbound.
Stars: ✭ 1,232 (+1144.44%)
Mutual labels:  dns
.o
The domain records for the ".o" TLD on @OpenNIC. Claim your domain today!
Stars: ✭ 87 (-12.12%)
Mutual labels:  dns
Ntf
Network Testing Framework
Stars: ✭ 96 (-3.03%)
Mutual labels:  dns
Drool
DNS Replay Tool
Stars: ✭ 78 (-21.21%)
Mutual labels:  dns
Dnoise
DNS noise generator that looks at your network activity and blends in. Requires pi-hole.
Stars: ✭ 88 (-11.11%)
Mutual labels:  dns
Minecraft Nintendo Switch Private Server
Stars: ✭ 78 (-21.21%)
Mutual labels:  dns
Noisy
Simple random DNS, HTTP/S internet traffic noise generator
Stars: ✭ 1,208 (+1120.2%)
Mutual labels:  dns
Downloads
AD Health Check, Send HTML Email, Ping machines, Encrypt Password,Bulk Password,Microsoft Teams,Monitor Certificate expiry, Monitor cert expiry, AD attributes, IP to Hostname, Export AD group, CSV to SQL,Shutdown, Restart, Local Admin, Disk Space, Account expiry,Restore Permissions, Backup permissions, Delete Files Older Than X-Days, export DHCP options,Read Registry,Distribution group AD attributes,Monitor Windows Services,Export Reverse DNS,Task Monitor,Monitor and alert, Exchange Health check,Get Network Info, Export AD Attributes,AD group members, Office 365 Group member, SQL to CSV, Outlook save send attachments, Upload files to FTP,Exchange – Total Messages Sent Received, Set Teams Only Mode, Intune Duplicate Device,Intune Cleanup Not Evaluated, Ownership and Grant Permissions, Write Create Modify Registry , Organization Hierarchy from AD,Azure AD Privileged Identity Management,Intune – Export MAM Devices,Intune Marking devices as Corporate, Dynamic to Static Distribution Group,Monitor Alert Office 365 services,Group Member Count,Bulk Addition external users sharepoint, ADD to Exchange online License Group,All in One Office 365 Powershell,Bulk Addition of Secondary Email, Automate move mailboxes to o365, Addition Modification Termination Exchange users, Monitoring Unified Messaging port,Unified Messaging Extensions Report, Set Default Quota for SharePoint,Bulk Contact Creation and Forwarding, Uploading and Downloading files sftp, Monitoring Sftp file and download, Office 365 groups Write back, CSV parser, Email address update, Email address modify, MDM enrollment, Welcome Email, Intune Welcome Email, remove messages, remove email, SKOB to AD, SKOB to group, PowerApps report, Powerautomate Report, Flow report, Server QA, Server Check List, O365 IP range, IP range Monitor, o365 Admin Roles, memberof extraction, CSV to Excel, Skype Policy, UPN Flip, Rooms Report, License Reconciliation,Intune Bulk Device Removal, Device Removal, Clear Activesync, Lync Account Termination,Lync Account Removal, Enable office 365 services, Enable o365 Services, Export PST, Site collection Report, Office 365 Group Sites, System Admin,ActiveSync Report,White Space,Active Directory attributes, outlook automation, Intune Detect App, Distribution list Fix, Legacy DN, start service, stop service, disable service, Message tracking, Distribution lists report,Distribution groups report,Quota Report, Auto reply, out of office, robocopy multi session, Home Folder, local admin, Database, UPN SIP Mismatch, Recoverable deleted, teams number, Number assignment, teams phone, AD Group Hierarchy, Hierarchy membership, Sync Groups
Stars: ✭ 75 (-24.24%)
Mutual labels:  dns
Sliver
Adversary Simulation Framework
Stars: ✭ 1,348 (+1261.62%)
Mutual labels:  dns

devdns

Make docker containers discoverable via DNS for development environments, like when running a bunch of containers on your laptop. Useful for container to container communication, or just an easy way of reaching containers from the host machine.

Image Size Docker Pulls Lint

Running

docker run -d --name devdns -p 53:53/udp \
      -v /var/run/docker.sock:/var/run/docker.sock:ro ruudud/devdns

devdns requires access to the Docker socket to be able to query for container names and IP addresses, in addition to listen to start/stop events.

Binding port 53 on the host machine is optional, but will make it easier when configuring local resolving.

The DNS server running in devdns is set to proxy requests for unknown hosts to the configured fallback DNS (default Google's DNS server 8.8.8.8). It also adds a wildcard record (normally *.test, see DNS_DOMAIN below) pointing back at the host machine (bridge IP in Linux), to facilitate communication when running a combination of services "inside" and "outside" of Docker.

Using

Container ↔ Container

When running other containers, specify the devdns container IP as the DNS to use:

$ docker run -d --name devdns -p 53:53/udp \
  -v /var/run/docker.sock:/var/run/docker.sock:ro ruudud/devdns
$ docker run -d --name redis redis:alpine
$ docker run -it --rm \
  --dns=`docker inspect -f "{{ range.NetworkSettings.Networks }}{{ .IPAddress }}{{ end }}" devdns | head -n1` alpine \
  ping redis.test

Please note that the --dns flag will prepend the given DNS server to the Docker default, so lookups for external addresses will still work.

Docker Daemon Configuration

If you want devdns to be added by default to all new containers, you need to add some custom Docker daemon options as per the dockerd reference.

The exact process to set these options varies by the way you launch the Docker daemon and/or the underlying OS:

  • systemd (Ubuntu, Debian, RHEL 7, CentOS 7, Fedora, Archlinux) — sudo systemctl edit docker.service, change the ExecStart line
  • Ubuntu 12.04 — set DOCKER_OPTS in /etc/default/docker
  • OS/X — select Preferences -> Daemon -> Advanced

The extra flags you'll have to add are

--dns 172.17.0.1 --dns-search test

Replace test with whatever you set as config for DNS_DOMAIN.

172.17.0.1 is the default IP of the Docker bridge, and port 53 on this host should be reachable from within all started containers given that you've included -p 53:53/udp when starting the devdns container.

Note: There are some caveats with Docker and how it manages a container's /etc/resolv.conf file. Unless you do something exotic, like parsing this file, you should be fine. See Docker DNS docs for more information.

Host Machine → Containers

You will need to add some configuration to your OS DNS resolving mechanism to make it query devdns.

NOTE: This is only practical if you added -p 53:53/udp when starting devdns.

Linux

Nowadays, direct edits of /etc/resolv.conf will often be removed at reboot. Thus, the best place to add extra resolvers in Linux, is to use your network configurator. YMMV. This means NetworkManager (see section below), WICD, or manually using /etc/network/interfaces:

auto p3p1
iface p3p1 inet dhcp
dns-search test
dns-nameservers 127.0.0.1
Managed resolv.conf

Another solution is mounting the host machine's /etc/resolv.conf at /mnt/resolv.conf and have devdns automatically add configuration on startup:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock:ro \
      -v /etc/resolv.conf:/mnt/resolv.conf \
      ruudud/devdns

Example config prepended to /etc/resolv.conf:

nameserver 192.168.16.2 # added by devdns

The configuration will be automatically removed when container is stopped or killed.

⚠️ It's common that /etc/resolv.conf becomes overwritten as many operating systems now manage the creation of that file, and in some cases not even rely on it at all.

OSX

Create a file /etc/resolver/test containing

nameserver 127.0.0.1

In OSX and Docker for Mac, port binding should work directly on the host machine. Please note that the name of the file created in /etc/resolver has to match the value of the DNS_DOMAIN setting (default "test").

Configuration

  • DNS_DOMAIN: set the local domain used. (default: test)
  • FALLBACK_DNS: set the DNS used for unknown hosts. (default: 8.8.8.8)
  • HOSTMACHINE_IP: IP address of non-matching queries (default: 172.17.0.1)
  • EXTRA_HOSTS: list of extra records to create, space-separated string of host=ip pairs. (default: '')
  • NAMING: set to "full" to convert _ to - (default: up to first _ of container name)
  • NETWORK: set the network to use. Set to "auto" to automatically use the first network interface (e.g. when using docker-compose) (default: bridge)

Example:

docker run -d -v /var/run/docker.sock:/var/run/docker.sock \
  -e DNS_DOMAIN=docker \
  -e HOSTMACHINE_IP=192.168.1.1 \
  -e NAMING=full \
  -e NETWORK=mynetwork \
  -e EXTRA_HOSTS="dockerhost=172.17.0.1 doubleclick.net=127.0.0.1" \
  ruudud/devdns

Caveats

Container name to DNS record conversion

RFC 1123 states that _ are not allowed in DNS records, but Docker allows it in container names. devdns ignores _ and whatever follows, allowing multiple simultaneous containers with matching names to run at the same time.

The DNS will resolve to the lastly added container, and try to re-toggle the previous matching container when stopping the currently active one.

Example:

# (devdns already running)
$ docker run -d --name redis_local-V1 redis
$ dig redis.test     # resolves to the IP of redis_local-V1

$ docker run -d --name redis_test redis
$ dig redis.test     # resolves to the IP of redis_test

$ docker stop redis_test
$ dig redis.test     # resolves to the IP of redis_local-V1

$ docker stop redis_local-V1
$ dig redis.test     # resolves to the IP of the host machine (default)

NetworkManager on Ubuntu

If you're using NetworkManager, you should disable the built-in DNSMasq to get the port binding of port 53 to work.

Edit /etc/NetworkManager/NetworkManager.conf and comment out the line dns=dnsmasq so it looks like this:

# dns=dnsmasq

Restart using sudo service network-manager restart.

Now you should be able to do

docker run -d -v /var/run/docker.sock:/var/run/docker.sock:ro \
    -p 53:53/udp ruudud/devdns
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].