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

Bind zone error - Unexpected end of input

· 52CE 我爱测

Everyting seems OK but I get Unexpected end of input for this: $TTL 10800 @ IN SOA ns1.riddimdub.com. admin.radiohost.riddimdub.com. ( 1 ; Serial 10800 ; Refresh after 3 hours 3600 ; Retry after 1 hour 604800 ; Expire after 1 wee…

问题原文

原帖链接 · Sumutiu Marius · CC BY-SA 4.0

Everyting seems OK but I get Unexpected end of input for this:

$TTL    10800
@       IN      SOA     ns1.riddimdub.com.
admin.radiohost.riddimdub.com. (
        1        ; Serial
        10800       ; Refresh after 3 hours
        3600       ; Retry after 1 hour
        604800       ; Expire after 1 week
        3600 )     ; Negative caching TTL of 1 day
@       IN      NS      ns1.riddimdub.com.
@       IN      NS      ns2.riddimdub.com.
radiohost.riddimdub.com.        IN       MX     10      radiohost.riddimdub.com.
radiohost.riddimdub.com.        IN      A       185.40.20.124
ns1     IN      A       185.40.20.124
ns2     IN      A       185.40.20.124
www     IN      CNAME   radiohost.riddimdub.com.
mail    IN      A       185.40.20.124
ftp     IN      CNAME   radiohost.riddimdub.com.

I also get Unexpected RR type 10800.

What could be the problem?

已采纳解答

原帖链接 · Håkan Lindqvist · CC BY-SA 4.0

As a human, I can identify this part of the file as what is supposed to be the SOA record:

@       IN      SOA     ns1.riddimdub.com.
admin.radiohost.riddimdub.com. (
        1        ; Serial
        10800       ; Refresh after 3 hours
        3600       ; Retry after 1 hour
        604800       ; Expire after 1 week
        3600 )     ; Negative caching TTL of 1 day

But that is not how the above actually means if these lines are parsed properly.

The problems

Since the master file format uses line breaks as the separator between records*, the line break after the first field of record data means that this is supposed to be the SOA record:

 @       IN      SOA     ns1.riddimdub.com.

*) With the exception that one can get fancy and use parenthesis (( )) in order to format a single record in ways that span multiple lines (purely for style/human readability reasons).

Since a SOA record must have seven fields of record data, but this supposed SOA record only has one field, you get an "unexpected end of input" error.
(I fully expect that the original error message also referenced the line number where this occurred.)

Next up, you get a secondary failure when what should have been the rest of the SOA record data starts on the next line and is treated as the next record.
There you used parenthesis, so that whole bit is read as a single record split across multiple lines.

That supposed "next record" is then interpreted like this:

admin.radiohost.riddimdub.com.    1            10800     ...
^                                 ^            ^
owner name                        ttl          "must be the record type, I guess"?!

Which leads to the "unknown RR type 10800" error message.
This error is not all that relevant, it will go away as soon as you fix the first problem, which left half a SOA record worth of stuff floating around in the wrong context.

The fix

There are multiple ways of writing this:

Simplest (uses no fancy syntax, may be the most intuitive as to what the SOA record actually consists of):

@       IN      SOA     ns1.riddimdub.com. admin.radiohost.riddimdub.com. 1 10800 3600 604800 3600

Quite common multi-line formatting, to make space for annotating the serial and timers:

@       IN      SOA     ns1.riddimdub.com. admin.radiohost.riddimdub.com. (
        1        ; Serial
        10800    ; Refresh after 3 hours
        3600     ; Retry after 1 hour
        604800   ; Expire after 1 week
        3600 )   ; Negative caching TTL of 1 hour

Another option, if you want to annotate everything:

@       IN      SOA     ns1.riddimdub.com. ( ; Mname (master nameserver)
        admin.radiohost.riddimdub.com. ; Rname (email address)
        1        ; Serial
        10800    ; Refresh after 3 hours
        3600     ; Retry after 1 hour
        604800   ; Expire after 1 week
        3600 )   ; Negative caching TTL of 1 hour

Do note how you either write the fields of the record on the same line (typical way of writing records), or you have to use parenthesis to specify how you have split the record across multiple lines.

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

资料来源与适用范围

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

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

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