Bind on Windows Server 2k8; rndc reload fails for no obvious reason

Nelson asked:

I’m trying to install Bind 9.9 on Windows Server 2008, but calling “rndc reload” fails with a very strange error message:

PS C:\bind\etc> ..\bin\rndc.exe reload
rndc: error: C:\bind\etc\rndc.conf:1: unknown option ' ■#...'
rndc: error: C:\bind\etc\rndc.conf:5: unknown option ''
rndc: error: C:\bind\etc\rndc.conf:11: unknown option ''
rndc: error: C:\bind\etc\rndc.conf:13: unexpected token near end of file
rndc: could not load rndc configuration

Here’s the contents of rndc.conf. I opened the file up in Notepad++ and verified that there are no non-printing characters and the line endings look fine (normal Windows line endings):

# Start of rndc.conf
key "rndc-key" {
    algorithm hmac-md5;
    secret "vP+yTbzcnlq90UFC4GuNCg==";

options {
    default-key "rndc-key";
    default-port 953;
# End of rndc.conf

Here’s the contents of named.conf:

# Use with the following in named.conf, adjusting the allow list as needed:
key "rndc-key" {
    algorithm hmac-md5;
    secret "vP+yTbzcnlq90UFC4GuNCg==";

controls {
    inet port 953
        allow {; } keys { "rndc-key"; };
# End of named.conf

For what it’s worth, I have gotten Bind and rndc to work properly on Windows 7 following the same installation process. Any ideas what’s going on?

My answer:

Looks like you got a UTF-8 BOM at the beginning of your configuration file. Use a different editor (or editor setting in Notepad++) which doesn’t add the BOM (and with which you can strip this one out).

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.