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

Using different DNS server via different interface to resolve different domain name

· 52CE 我爱测

My VM has 2 interfaces, eth1 & eth2 and I need to resolve 2 domain names *.abc.exanple and *.xzy.example For *.abc.example I want to use DNS server 192.0.2.1 via eth1 For *.xyz.example I want to use DNS server 192.0.2.2 via eth2 …

问题原文

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

My VM has 2 interfaces, eth1 & eth2 and I need to resolve 2 domain names *.abc.exanple and *.xzy.example

For *.abc.example I want to use DNS server 192.0.2.1 via eth1 For *.xyz.example I want to use DNS server 192.0.2.2 via eth2

Much appreciate if you can advise me a solution as simple as possible since I'm quite new to Linux :-) Host file is is not an option, since I have to implement

已采纳解答

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

If you run your own DNS server locally on that server, you can create conditional forwarders for these two domains. Using static routing you can force traffic for 192.0.2.1 to leave eth1 and traffic destined to 192.0.2.2 to leave eth2.

For BIND9, a sample (snippet) configuration would be:

zone "abc.example" {
   type forward;
   forwarders { 192.0.2.1; };
};
zone "xyz.example" {
   type forward;
   forwarders { 192.0.2.2; };
};

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

资料来源与适用范围

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

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

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