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

启动并使用

相关推荐
仙柒4152 小时前
Docker存储原理
运维·docker·容器
快乐的哈士奇5 小时前
LangFuse 自托管实战:选型理由、Docker 部署与常用配置全解析
运维·人工智能·docker·容器
weixin_449290017 小时前
Docker + MySQL 在 Windows 11 上的本地安装部署文档
mysql·docker·容器
Ysn07197 小时前
中文乱码:在 Docker 容器中设置中文语言环境
运维·python·docker·容器
zxd0203118 小时前
EFK(Elasticsearch + Fluentd + Kibana) 日志收集系统
运维·docker·jenkins
终端行者8 小时前
Jenkins Pipeline 企业级用法 参数化构建+Ansible发布---上
docker·ansible·jenkins·cicd
亚空间仓鼠9 小时前
Docker容器化高可用架构部署方案(十三)
docker·容器·架构
米高梅狮子9 小时前
01.mysql的备份与恢复
运维·数据库·mysql·docker·容器·kubernetes·github
console.log('npc')10 小时前
Windows 11 → WSL2 → Ubuntu → Docker → Codex → Sub2API
windows·ubuntu·docker