局域网内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

启动并使用

相关推荐
极客先躯10 小时前
高级java每日一道面试题-2026年05月03日-实战篇[Docker]-如何实现容器化环境的数据加密?
java·运维·docker·容器·金融·加解密·高级面试
ChaITSimpleLove13 小时前
SimpleIdServer 6.0.4 Docker Compose 实战部署指南
运维·docker·容器·身份认证·id-server·simpleidserver
风曦Kisaki17 小时前
Kubernetes(K8s)笔记Day03: Pod命名空间,标签,Pod 的调度,污点与容忍度,Pod 常见状态和重启策略,Pod 生命周期
linux·运维·笔记·docker·云原生·容器·kubernetes
毛驴赶鹿18 小时前
低配置服务器怎么搭建监控?Komari Docker部署与公网访问完整教程
运维·服务器·docker
冷莫溪21 小时前
Docker——3.Harbor 核心架构与原理详解
docker·容器·架构
冷莫溪1 天前
Docker——1.安装与相关命令
运维·服务器·docker·容器
Allen_LVyingbo1 天前
基于结构化电子病历的临床风险预测模型构建与大模型协同优化
python·安全·机器学习·docker·vim·健康医疗
暖和_白开水1 天前
数据分析agent(十三_3):docker mysql容器镜像服务的异常错误
mysql·docker·容器
爱小黄1 天前
使用docker搭建集群-使用 Docker 搭建 KingbaseES 集群
运维·docker·容器
余—笙2 天前
Docker安装rabbitmq并安装延迟队列插件
docker·容器·rabbitmq