DNSmasq搭建与配置

Docker搭建

docker-dnsmasq支持通过web页面配置域名映射,镜像地址:
https://hub.docker.com/r/jpillora/dnsmasq

使用步骤如下:

1、在Docker宿主上创建 /home/gary/dnsmasq.conf 配置文件

1
touch /home/gary/dnsmasq.conf

2、docker run启动容器

1
2
3
4
5
6
7
8
9
10
11
docker run \
--name dnsmasq \
-d \
-p 53:53/udp \
-p 5380:8080 \
-v /home/gary/dnsmasq/a_dns/dnsmasq.conf:/etc/dnsmasq.conf \
--log-opt "max-size=100m" \
-e "HTTP_USER=admin" \
-e "HTTP_PASS=123456" \
--restart always \
jpillora/dnsmasq

HTTP_USER:web页面登录的管理员帐号
HTTP_PASS:web页面登录的管理员密码

3、通过 ip:5380 地址访问web页面,使用帐户密码登录后在线编辑 dnsmasq.conf 文件

我的dnsmasq.conf配置文件内容如下:

1
2
server=192.168.1.8
address=/www.vlab.syb/192.168.1.8

项目地址:https://github.com/jpillora/docker-dnsmasq

直接安装

1
yum install -y dnsmasq

web-ui管理界面:https://github.com/jpillora/webproc

1
webproc --configuration-file /etc/dnsmasq.conf -- dnsmasq --no-daemon
文章目录
  1. 1. Docker搭建
  2. 2. 直接安装