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

Return A records but not AAAA records on specific domain in bind9

· 52CE 我爱测

I've setup a caching DNS server with bind9 using a root-hints method (like this ). It works as desired--but, our IPv6 traffic goes through a gateway outside of my country that makes Netflix think we're visiting from that other co…

问题原文

原帖链接 · Ole Wolf · CC BY-SA 3.0

I've setup a caching DNS server with bind9 using a root-hints method (like this). It works as desired--but, our IPv6 traffic goes through a gateway outside of my country that makes Netflix think we're visiting from that other country, and this prevents my kids from watching their favorite shows. So I'm thinking that if I can prevent bind9 from returning any AAAA records for netflix.com, the clients will only attempt IPv4 connections to Netflix.

That is: how do I configure bind9 so that AAAA record look-ups for netflix.com are suppressed while valid A record results are returned for netflix.com?

I realize I can create a zone file with just the Netflix domain and have it contain all of the A records for netflix.com that I can find and no AAAA records. But I'm wondering if maybe the above is possible so I don't have to keep the A records in the zone file updated.

社区高分解答

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

I know this is an old post, but (at least) in my version of bind (9.11 on Ubuntu 18.04) I discovered that you can use filter-aaaa-on-v4 combined with match-destinations in a view.

It still requires you to have bind listening on 2 ip adresses, but at least you don't need multiple instances.

192.168.1.1 is the normal dns server. 192.168.1.2 is the ipv6 blocking one.

My config looks kind of like this (partial):

options {
    listen-on port 53 { 192.168.1.1; };
    listen-on port 5353 { 192.168.1.2; };
};

view "ipv4only" {
  match-destinations { 192.168.1.2/24; };
  filter-aaaa-on-v4 yes;
};

view "normal" {
  match-clients { 192.168.1.1/24; };
  zone "netflix.com" {
    type forward;
    forward only;
    forwarders { 192.168.1.2 port 5353; };
  };
};

That makes bind do a forward lookup to itself on another ip, when the domain matches netflix.com.

This eliminates the need for two instances, but sadly requires 2 internal ip adresses. It would be nice if we also could specify a port number in "match-destinations".

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

资料来源与适用范围

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

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

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