Giter VIP home page Giter VIP logo

fakedns's Introduction

Build Status Analytics

FakeDNS

FakeDNS, to use as dynamic dns for Docker containers

FakeDNS is a fake dynamic DNS server. It allows you to dynamically bind hostnames to clients ip addresses. Originally, it is created to dynamically resolve hostnames inside Docker container, so there are following limitations (in current version):

  • It knows only about registred domain names (it means whose names it was told about)
  • It requires every client to connect to FakeDNS server to register its domain name, or it won't be resolved by FakeDNS
  • Registred IPtoHostname map doesn't survive FakeDNS restart

To use it with Docker you should run server somewhere (for example in separate container like in demo below) and run your Docker containers with the following command line argument

 --dns=<IP_ADDRESS_OF_FAKE_DNS_CONTAINER> --dns=8.8.8.8 --dns=8.8.4.4

You can find details of what this docker run command line argument actually means here.

Important. I'd recommend to add Google DNS as well, 'cause FakeDNS knows only about registred domain names.

Demo

To run demo you should checkout this repository and follow instructions you can find here.

Docker

Image is based on Alpine 3.5.

Binary version of FakeDNS server is built with GraalVM.

Final image size is about 20 MB.

Usage

Run FakeDNS server:

docker run -d --name=fakedns-server silvmike/fakedns-server:latest
echo FAKE DNS IS READY ON $(docker inspect --format '{{ .NetworkSettings.IPAddress }}' fakedns-server)

Building (dev)

cd fakedns-server && docker build -t silvmike/fakedns-server .

Server

  1. DNS server listens to 53 port on specified host for UDP
  2. Registrator listens on specified port

Registrator is an application used to register host with provided hostname.

Building jar

cd fakedns-server && mvn package && cd ..

The result must be here in the end:

fakedns-server/target/fakedns-server.jar

Usage (jar)

  • java -jar fakedns-server.jar <hostname to listen: localhost, 0.0.0.0, etc.> <registrator port>

Example:

 java -jar fakedns-server.jar localhost 8099

P.S. You can easily check it:

 dig @localhost myfake.host.org

Java Client

Connects to specified registrator running on specified host and listening to specified port, and registering this host (that running client) with specified hostname.

Building jar

cd fakedns-client && mvn package && cd ..

The result must be here in the end:

fakedns-client/target/fakedns-client.jar

Usage

  • java -jar fakedns-client.jar <hostname of registrator> <registrator port> <your fake hostname>

Example:

 java -jar fakedns-client.jar localhost 8099 myfake.host.org

Bash Client

Connects to specified registrator running on specified host and listening to specified port, and registering this host (that running client) with specified hostname.

Usage

  • sh fakedns-client.sh <hostname of registrator> <registrator port> <your fake hostname>

Example:

 sh fakedns-client.sh localhost 8099 myfake.host.org

P.S. netcat is required.

Used resources

http://www.zytrax.com/books/dns/ch15/

http://www.freesoft.org/CIE/Topics/78.htm

Microsoft TechNet 'How DNS Works'

fakedns's People

Contributors

silvmike avatar dependabot[bot] 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.