Here we use the docker version docker-dnsmasq corresponding to dnsmasq.
Guide to Use
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 #Define Host to IP Mapping address=/h0/172.17.205.28 address=/h1/172.17.205.32 ...
docker run \ --name dnsmasq \ -d \ -p 53:53/udp \ -p 8080: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
|max-size||Maximum Log Save|
Visit Pull http://localhost:8080
- Log in with admin/admin account password.
- In/etc/Resolv.confAdd the following two sentences before the file
- Adding only 172.17.205.28 DNS will fail resolution
nameserver 127.0.0.1 #Required nameserver 172.17.205.28 #Mandatory [local primary network card] ...
- This machine is configured like any other machine
- Required before it will take effect because DNS resolution will resolve from top to bottom
root@center ~# ping h1 PING h1 (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 ms 64 bytes from 172.17.205.32 (172.17.205.32): icmp_seq=2 ttl=64 time=0.203 ms ^C --- h1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 0.155/0.179/0.203/0.024 ms
- Click Save to take effect automatically in a few seconds
address=/h0/172.17.205.28 address=/h1/172.17.205.32 address=/h2/172.17.205.33 address=/h3/172.17.205.34 address=/h4/172.17.205.35 ....
- It is recommended to keep the hostname of other machines as configured above
- Otherwise, the following problems may occur
root@asdf ~# ping h0 ping: h0: Name or service not known