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

启动并使用

相关推荐
啦啦啦小石头11 小时前
Docker 换源
docker
等什么君!14 小时前
docker -数据卷技术
运维·docker·容器
上天_去_做颗惺星 EVE_BLUE15 小时前
Docker高效使用指南:从基础到实战模板
开发语言·ubuntu·docker·容器·mac·虚拟环境
好好沉淀16 小时前
Docker开发笔记(详解)
运维·docker·容器
禅口魔心17 小时前
Win10 + WSL2 + Docker:K510(DongshanPI-Vision)开发环境从踩坑到跑通全记录(交叉编译 + 上板运行)
docker·嵌入式开发·wsl2·k510
Free Tester19 小时前
基于已有容器生成Dockerfile
docker
lcx_defender19 小时前
【Docker】Docker部署运行nacos
运维·docker·容器
啦啦啦小石头20 小时前
docker添加用户权限不使用sudo
运维·docker·容器
cuber膜拜20 小时前
Weaviate 简介与基本使用
数据库·python·docker·向量数据库·weaviate
xuefuhe20 小时前
Docker常用命令
docker