Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of building DNS server in 1 minute by Docker

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Here we use the docker version of docker-dnsmasq corresponding to dnsmasq.

User's guide

Download the image

Docker pull docker-dnsmasq

Create the simplest configuration / opt/dnsmasq.conf

# dnsmasq config, for a complete example, see:# http://oss.segetech.com/intra/srv/dnsmasq.conf#dns parsing log log-queries# defining host and IP mapping address=/h0/172.17.205.28address=/h2/172.17.205.32...

Run the container

Docker run\-- name dnsmasq\-d\-p 53:53/udp\-- p 8080 opt/dnsmasq.conf:/etc/dnsmasq.conf 8080\-v / opt/dnsmasq.conf:/etc/dnsmasq.conf\-- log-opt "max-size=100m"\-e "HTTP_USER=admin"\-e "HTTP_PASS=admin"\-- restart always\ jpillora/dnsmasq

Parameter description

Name description max-size log maximum save HTTP_USER login username HTTP_PASS login password

Visit to pull http://localhost:8080

Log in with your admin/admin account password.

Dnsmasq interface

DNS configuration

Adding the following two sentences before the / etc/resolv.conf file will only add 172.17.205.28 DNS to parse the failed nameserver 127.0.0.1 # required nameserver 172.17.205.28 # required [main local network card].

test

The configuration of this machine, like other machines, must be added before it will take effect, because DNS parsing will parse root@center ~ # ping h2PING H2 (172.17.205.32) 56 (84) bytes of data.64 bytes from 172.17.205.32 (172.17.205.32): icmp_seq=1 ttl=64 time=0.155 ms64 bytes from 172.17.205.32 (172.17.205.32): icmp_seq=2 ttl=64 time=0.203 Ms ^ C-- H2 ping statistics-- 2 packets transmitted, 2 received 0% packet loss, time 1000msrtt min/avg/max/mdev = 0.155 ms, 0.179 ms, 0.203 ms

Add parsing

Click Save, and it will take effect automatically in a few seconds.

Address=/h0/172.17.205.28address=/h2/172.17.205.32address=/h3/172.17.205.33address=/h4/172.17.205.34address=/h5/172.17.205.35....

Be careful

It is recommended to keep the hostname of other machines the same as above, otherwise the following problems may occur: root@asdf ~ # ping h0ping: H0: Name or service not known

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report