大网数据广告活动
服务器运维问答

DNSmasq on 2 interfaces

· 52CE 我爱测

SysInfo: ubuntu 18.04 external access point (with its own internal linux system) => interface ap1, IP: 192.168.13.1 external access point (USB stick) => interface ap0, IP: 192.168.12.1 hostapd running on ap0 dnsmasq running witho…

问题原文

原帖链接 · ZioCain · CC BY-SA 4.0

SysInfo:

  • ubuntu 18.04
  • external access point (with its own internal linux system) => interface ap1, IP: 192.168.13.1
  • external access point (USB stick) => interface ap0, IP: 192.168.12.1
  • hostapd running on ap0
  • dnsmasq running without being binded to any interface bc I need it to work on both interfaces
  • DNS must work on local-network only.

The problem is that when I connect through the ap1 and type "mydomain.com" on my browser it's not working unless I have the USB stick (ap0) attached and working.

IDK if the issue is with hostapd itself or dnsmasq.

My dnsmasq.conf:

localise-queries
resolv-file=/etc/dnsmasq.resolv.conf
no-hosts
addn-hosts=/etc/my.hosts
dhcp-range=192.168.12.20,192.168.12.150,255.255.255.0,12h
dhcp-range=192.168.13.20,192.168.13.150,255.255.255.0,12h
dhcp-option=option:domain-search,local
bind-dynamic

The addresses in the my.hosts file are setup like this:

<IP>\t<DOMAIN>

In that file I have all the addresses for both interfaces 192.168.12.1 and 192.168.13.1)

How do I make it work for both interfaces?

Ask for any extra information.

已采纳解答

原帖链接 · ChandanK · CC BY-SA 4.0

You need to specify dnsmasq which interface to use what network. You can do this with below change in your dnsmasq.conf file:

dhcp-range=ap0,192.168.12.20,192.168.12.150,255.255.255.0,12h
dhcp-range=ap1,192.168.13.20,192.168.13.150,255.255.255.0,12h

or,

dhcp-range=interface:ap0,192.168.12.20,192.168.12.150,255.255.255.0,12h
dhcp-range=interface:ap1,192.168.13.20,192.168.13.150,255.255.255.0,12h

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-02-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。