Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a-kr/trivialdns
Simple DNS proxy server with /etc/hosts-like local database editable via web interface. Written in Go.
https://github.com/a-kr/trivialdns
Last synced: 3 months ago
JSON representation
Simple DNS proxy server with /etc/hosts-like local database editable via web interface. Written in Go.
- Host: GitHub
- URL: https://github.com/a-kr/trivialdns
- Owner: a-kr
- License: mit
- Created: 2015-08-29T18:15:14.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-01-31T12:01:55.000Z (almost 5 years ago)
- Last Synced: 2024-03-09T20:44:12.735Z (8 months ago)
- Language: Go
- Size: 19.5 KB
- Stars: 12
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trivialdns
Simple DNS proxy server with /etc/hosts-like local database editable via web interface. Written in Go.* Handles `A` queries, everything else is proxied to upstream servers
* Anything not found in local database is also proxied
* Can respond with static IP address for a given domain (configured like in /etc/hosts)
* Can respond with IP address of _another_ domain (thus enabling something like DNS redirection:
client asks for foo.com and receives the address of bar.com)## How to run
Create a configuration file with IP addresses of upstream DNS servers (at least one address is required):
```
mkdir -p /etc/trivialdns
echo "8.8.8.8" > /etc/trivialdns/nameservers
echo "8.8.4.4" >> /etc/trivialdns/nameservers
```DNS queries for hostnames not found in local database will be proxied to these servers.
Fetch and compile the code:
```
git clone https://github.com/a-kr/trivialdns
cd trivialdns
make
```Run:
```
sudo ./trivialdns
```## /etc/trivialdns/hosts
This file stores a local DNS database for `trivialdns`. File uses the following format:
```
# anything after `#` is a comment# for A-queries about example.com, trivialdns will respond with address 2.4.3.1
example.com 2.4.3.1# wildcard entries also work
*.example.com 1.2.3.4# for A-queries about foo.com, trivialdns will respond with address of bar.com
foo.com bar.com
# (bar.com is resolved every time foo.com is requested, not just once)
```/etc/trivialdns/hosts is read once on server startup.
## Web interface
Web interface is available on port `8053`, a simple page which provides an editor for
`/etc/trivialdns/hosts` file. When changes are submitted, they are applied immediately
(no need to restart the server).## Debian Packaging
```
make pkg
# package/trivialdns_1.0-1.deb file is produced
```