局域网内dns服务器dnsmasq服务搭建

摘要:本文主要介绍dnsmasq的部署和简单使用;部署采用docker容器方式部署,带有ui界面管理的dnsmasq,让大家快速在内网中配置dns域名的解析,在内网中用域名访问服务。

背景

公司内网环境ip和端口错综复杂,各个服务大家容易记错,所以衍生出来内网DNS,方便大家在内网中访问公司提供的各种服务。

docker部署案例

docker的安装去官网,一键安装。

dnsmasq.conf

配置文件

ini 复制代码
#dnsmasq config, for a complete example, see:
#  http://oss.segetech.com/intra/srv/dnsmasq.conf
#log all dns queries
log-queries
#dont use hosts nameservers
no-resolv
#use google as default nameservers, prefer 1^4
server=8.8.8.8
server=8.8.4.4
strict-order
#serve all .company queries using a specific nameserver
server=/company/10.0.0.1
#explicitly define host-ip mappings
address=/mycompany.com/192.168.137.131

docker-compose.yml

配置了http的登陆认证,用户名是foo,密码是bar

yaml 复制代码
version: '3'
services:
  dnsmasq:
    image: jpillora/dnsmasq:latest
    container_name: dnsmasq
    networks:
      - default
    environment:
      - "TZ=Asia/Shanghai"
      - "HTTP_USER=foo"
      - "HTTP_PASS=bar"
    volumes:
      - ./dnsmasq.conf:/etc/dnsmasq.conf
    ports:
      - 53:53
      - 8080:8080
networks:
  default:
    external:
      name: nisec

启动并使用

相关推荐
七度光阴;16 小时前
Docker入门手册
运维·docker·容器
weixin_4050233717 小时前
使用docker 安装部署easy-mock
运维·docker·容器
Asuncion00717 小时前
Docker核心揭秘:轻量级虚拟化的革命
服务器·开发语言·docker·云原生
ZLRRLZ17 小时前
【Docker】Docker Image(镜像)
运维·docker·容器
Akshsjsjenjd21 小时前
Docker资源限制详解
运维·docker·容器
雲帝1 天前
1panel docker开启swap内存
运维·docker·容器
tryCbest1 天前
Linux使用Docker部署项目后期更新
linux·运维·docker
stark张宇1 天前
网络排错全流程:从DNS解析到防火墙,逐层拆解常见问题
linux·网络协议·dns
缘的猿1 天前
Docker 与 K8s 网络模型全解析
docker·容器·kubernetes
运维栈记1 天前
使用Grafana监控K8S中的异常Pod
docker·kubernetes·grafana