A small tool used to correspond to the IP address according to the name, id, and network alias of the docker container, which can be run as a DNS server

docker-dns

一个用于根据docker容器name、id、network alias到IP地址对应的小工具,可作为DNS服务器运行

CLI运行

./docker-dns [container name]

作为DNS服务器

./docker-dns -d -s [domain suffix]

域名后缀默认为d.com,比如有容器id:f4505a5420c9,查询f4505a5420c9.d.com即可得到容器的ip,比如:

dig @127.0.0.1 -p5300 f4505a5420c9.d.com

作为系统DNS服务

systemd-resolved

systemd-resolved提供一种叫"routing domains"(路由域)的功能,即匹配一个特定域名后缀,然后向特定DNS服务器发送查询请求。根据此功能,我们可以在docker0接口上设置一个路由域"~d.com",然后指定DNS服务器,就可以提供系统DNS服务

docker build . -t docker-dns
docker run -it --rm -v /run/docker.sock:/run/docker.sock -p 5300:5300/udp docker-dns
sudo resolvectl domain docker0 "~d.com"
sudo resolvectl dns docker0 127.0.0.1:5300

注意,这里必须要求docker中有容器在运行,即docker0接口在工作状态,这套方案才能正常运行。当然你也可以配置到别的在接口上。我目前没有发现systemd-resolved有更好的设置方法,如果你有更好的配置方案,欢迎issue中讨论一下。

Owner
Swift
No Bug, No Code.
Swift
Similar Resources

A CLI tool queries the GitHub GraphQL API for users and ranks them according to number of contributions

Project homepage Most Active GitHub Users Counter This CLI tool queries the GitHub GraphQL API for users and ranks them according to number of contrib

Dec 6, 2021

Package socket provides a low-level network connection type which integrates with Go's runtime network poller to provide asynchronous I/O and deadline support. MIT Licensed.

socket Package socket provides a low-level network connection type which integrates with Go's runtime network poller to provide asynchronous I/O and d

Dec 14, 2022

Network-wide ads & trackers blocking DNS server

Network-wide ads & trackers blocking DNS server

Privacy protection center for you and your devices Free and open source, powerful network-wide ads & trackers blocking DNS server. AdGuard.com | Wiki

Dec 31, 2022

DNS Ping: to check packet loss and latency issues with DNS servers

DNSping DNS Ping checks packet loss and latency issues with DNS servers Installation If you have golang, easiest install is go get -u fortio.org/dnspi

Nov 18, 2022

Verify IP addresses of respectful crawlers like Googlebot by reverse dns and forward dns lookups

Verify IP addresses of respectful crawlers like Googlebot by reverse dns and forward dns lookups

goodbots - trust but verify goodbots verifies the IP addresses of respectful crawlers like Googlebot by performing reverse dns and forward dns lookups

Aug 16, 2022

IP2Proxy Go package allows users to query an IP address to determine if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits.

IP2Proxy Go Package This package allows user to query an IP address if it was being used as VPN anonymizer, open proxies, web proxies, Tor exits, data

Sep 15, 2022

A small library to detect if an IP address is close to yours

go-geofence A small library to detect if an IP address is close to yours or another of your choosing using https://ipstack.com/ Usage First you will n

Aug 10, 2022

Connect directly to Docker-for-Mac containers via IP address 🐳 💻

Connect directly to Docker-for-Mac containers via IP address 🐳 💻

Docker Mac Net Connect Connect directly to Docker-for-Mac containers via IP address. Features L3 connectivity: Connect to Docker containers from macOS

Jan 5, 2023

Project helps to identify the network, broadcast address and no of possible hosts

network_identifier Project helps to identify the network, broadcast address and no of possible hosts for Ipv4 address To use it directly as a go file

Dec 3, 2021
Related tags
Hetzner-dns-updater - A simple tool to update a DNS record via Hetzner DNS API. Used for simple HA together with Nomad

hetzner-dns-updater A small utility tool to update a single record via Hetzner D

Feb 12, 2022
A simple server which can be used as an RPC endpoint in popular Ethereum wallets.

RPC Endpoint This repository contains code for a simple server which can be used as an RPC endpoint in popular Ethereum wallets. The endpoint is https

Jan 2, 2023
Tapestry is an underlying distributed object location and retrieval system (DOLR) which can be used to store and locate objects. This distributed system provides an interface for storing and retrieving key-value pairs.

Tapestry This project implements Tapestry, an underlying distributed object location and retrieval system (DOLR) which can be used to store and locate

Mar 16, 2022
A TCP proxy used to expose services onto a tailscale network without root. Ideal for container environments.

tailscale-sidecar This is barely tested software, I don't guarantee it works but please make an issue if you use it and find a bug. Pull requests are

Dec 30, 2022
Dynamic dns for name.com

name-ddns Dynamic DNS for Name.com using v4 name.com API Usage docker run --rm \ -e "NAME_DDNS_USER=namecom-user" \ -e "NAME_DDNS_TOKEN=namecom-toke

Aug 17, 2022
Fetch-npm-package - A small utility that can be used to fetch a given version of a NPM package

Use fetch-npm-package <package> <version> <output-dir> E.g. fetch-npm-package is

May 21, 2022
Ananas is an experimental project for kubernetes CSI (Container Storage Interface) by using azure disk. Likewise, Ananas is the name of my cute british shorthair.

ananas Ananas is an experimental project for kubernetes CSI (Container Storage Interface) by using azure disk. Likewise, Ananas is the name of my cute

Aug 4, 2021
A high-performance concurrent scanner written by go, which can be used for survival detection, tcp port detection, and web service detection.
A high-performance concurrent scanner written by go, which can be used for survival detection, tcp port detection, and web service detection.

aScan A high-performance concurrent scanner written by go, which can be used for survival detection, tcp port detection, and web service detection. Fu

Aug 15, 2022
A small GoLang app which can bruteforce ssh credentials

A small GoLang app which can bruteforce ssh credentials, was used before for a ctf and is now optimized for future ctf events.

Nov 8, 2022
Header Block is a middleware plugin for Traefik to block request and response headers which regex matched by their name and/or value

Header Block is a middleware plugin for Traefik to block request and response headers which regex matched by their name and/or value Conf

May 24, 2022