OSX Mavericks - BIND不再安装...如何让本地DNS服务器工作?

ste*_*eve 21 dns macos bind osx-mavericks

我一直在OSX上使用BIND为我的本地开发机器提供本地DNS解析器,特别是为了方便虚拟机访问我的本地开发环境.

愚蠢地我决定在一夜之间升级到OSX Mavericks,看起来BIND已经不再安装 - 即使添加了命令行开发人员工具也是如此.

有人建议如何恢复此功能,或者最新的OSX是否有替代DNS解决方案?

谢谢,史蒂夫

Cam*_* S. 10

安装Homebrew并使用它来安装bind似乎是最好的选择.

几乎没有什么"陷阱",所以我把这个bash脚本放在一起以简化它.

1)安装Homebrew.

2)将此文件以"ConfigureBrewBindOnOSX10_9.sh"的形式保存到Mac并运行它(sh ./ConfigureBrewBindOnOSX10_9.sh),或者手动逐行运行命令(如果您想要查看更多详细信息).

ConfigureBrewBindOnOSX10_9.sh的内容

#!/bin/bash

# Last Updated: Jun 17, 2014
# camden@arrowtech.net
#
# Run as root or sudo the commands that need it as you go.

# 1) USE HOMEBREW TO INSTALL BIND

brew install bind

# 2) CONFIGURE BIND

# Create a custom launch key for BIND

/usr/local/sbin/rndc-confgen > /etc/rndc.conf
head -n 6 /etc/rndc.conf > /etc/rndc.key

# Set up a basic named.conf file.
# You may need to replace 9.10.0-P2 with the current version number if it is out of date.

cat > /usr/local/homebrew/Cellar/bind/9.10.0-P2/etc/named.conf  <<END
//
// Include keys file
//
include "/etc/rndc.key";

// Declares control channels to be used by the rndc utility.
//
// It is recommended that 127.0.0.1 be the only address used.
// This also allows non-privileged users on the local host to manage
// your name server.

//
// Default controls
//
controls {
        inet 127.0.0.1 port 54 allow {any;}
        keys { "rndc-key"; };
};

options {
        directory "/var/named";
};

// 
// a caching only nameserver config
// 
zone "." IN {
    type hint;
    file "named.ca";
};

zone "localhost" IN {
    type master;
    file "localhost.zone";
    allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
    type master;
    file "named.local";
    allow-update { none; };
};

logging {
        category default {
                _default_log;
        };

        channel _default_log  {
                file "/Library/Logs/named.log";
                severity info;
                print-time yes;
        };
};

END

# Symlink Homebrew's named.conf to the typical /etc/ location. 
ln -s /usr/local/homebrew/Cellar/bind/9.10.0-P2/etc/named.conf /etc/named.conf 


# Create directory that bind expects to store zone files

mkdir /var/named

curl http://www.internic.net/domain/named.root > /var/named/named.ca


# 3) CREATE A LuanchDaemon FILE: 

cat > /System/Library/LaunchDaemons/org.isc.named.plist <<END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
        <false/>
        <key>EnableTransactions</key>
        <true/>
        <key>Label</key>
        <string>org.isc.named</string>
        <key>OnDemand</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/sbin/named</string>
                <string>-f</string>
        </array>
        <key>ServiceIPC</key>
        <false/>
</dict>
</plist>
END

chown root:wheel /System/Library/LaunchDaemons/org.isc.named.plist 
chmod 644 /System/Library/LaunchDaemons/org.isc.named.plist 

# Shutdown bind (if it was running)
#launchctl unload /System/Library/LaunchDaemons/org.isc.named.plist


# Launch BIND and set it to start automatically on system reboot.
launchctl load -wF /System/Library/LaunchDaemons/org.isc.named.plist
Run Code Online (Sandbox Code Playgroud)

如果您需要任何帮助,请告诉我,我已经在安静的几台机器上成功配置了这个.


小智 9

您可以使用Homebrew安装bind:http://brew.sh/

  • 我已更新brew文件以生成初始配置文件(以匹配Mountain Lion中的系统安装)以及包含launchd plist.虽然它还没有合并,你可以在这里看到更新的文件:https://github.com/mxcl/homebrew/pull/23598使用`brew edit bind`打开BIND的公式,并复制到我的分叉版本中,然后用brew重新安装. (2认同)

jco*_*man 7

使用Homebrew安装BIND9.当前的brew安装并不像我想的那样完整,所以当我自己遇到这个问题时,我更新了brew文件以生成初始配置文件(以匹配Mountain Lion中的系统安装)以及包含launchd plist中.

虽然我的更改尚未合并,但您可以在此处看到更新的文件:github.com/mxcl/homebrew/pull/23598 brew edit bind用于打开BIND的公式,并在我的分叉版本中复制,保存并重新安装酿造使用brew install bind.