如何配置 dhcpd 在拥有静态 ipv6 地址的同时使用绑定注册 ipv4?

如何配置 dhcpd 在拥有静态 ipv6 地址的同时使用绑定注册 ipv4?

我通过以下方式在本地网络上配置了 IPv6 radvd:它通告一个可路由的 IPv6 块,所有计算机都会自动配置该块。

我通过 dhcpd 将 IPv4 分配给 NAT 块并更新命名。

我的问题是,当我为主机的 IPv6 地址(不会更改)设置 AAAA 记录时,named 将开始拒绝来自 dhcpd 的 A 记录的名称更新。

命名报告以下错误:

'name not in use' prerequisite not satisfied (YXDOMAIN)

dhcpd 会报如下错误:

Has an A record but no DHCID, not mine

我怎样才能说服 dhcpdAAAA在执行指定更新时忽略该记录。

答案1

将以下行添加到/etc/dhcp/dhcpd.conf

update-conflict-detection false;

答案2

我在这里找到了答案http://www.gelato.unsw.edu.au/IA64wiki/IPv6DDNS

本质上 dhcpd 有一种为事件添加挂钩的方法,因此在 IPv4 注册时调用一个脚本,该脚本将生成基于标准 MAC 的 IPv6 地址并进行注册。

更新: (我使用的是 ICH DHCP 4.1)

当使用“on commit”钩子时,它会删除现有的动态更新,因此您需要将其复制到“on commit”部分,我的现在看起来像这样:

on commit {
    if (not static) {
        # Setup IPv6 Address
        set new-ddns-fwd-name = pick-first-value(ddns-hostname, host-decl-name);
        if (exists host-name and option host-name ~~ "^[a-z0-9.-]+$") {
                set new-ddns-fwd-name = option host-name;
        } elsif (exists dhcp-client-identifier and option dhcp-client-identifier ~~ "^[a-z0-9.-]+$") {
                set new-ddns-fwd-name = substring(option dhcp-client-identifier, 1, 50);
        } elsif (new-ddns-fwd-name = "") {
                set new-ddns-fwd-name = binary-to-ascii (16, 8, "-",
                                 substring (hardware, 1, 6));
        }
        set ddns-fwd-name = new-ddns-fwd-name;
        execute ("/opt/bin/ddns-ipv6", ddns-fwd-name, ucase(
                binary-to-ascii(16, 8, ":", substring(hardware, 1, 6))),
                binary-to-ascii(10, 8, ".", leased-address));
        unset new-ddns-fwd-name;

        switch (ns-update (not exists (IN, A, ddns-fwd-name, null),
                           add (IN, A, ddns-fwd-name, leased-address,
                                lease-time / 2))) {
        default:
            unset ddns-fwd-name;
            break;

        case NOERROR:
            set ddns-rev-name =
                concat (binary-to-ascii (10, 8, ".", reverse (1, leased-address)), ".", 
                        pick (config-option server.ddns-rev-domainname,
                              "in-addr.arpa."));

            switch (ns-update (delete (IN, PTR, ddns-rev-name, null),
                               add (IN, PTR, ddns-rev-name, ddns-fwd-name, lease-time / 2)))
            {
            default:
                unset ddns-rev-name;
                on release or expiry {
                    execute ("/opt/bin/ddns-ipv6", "-d",  pick-first-value(ddns-hostname, host-decl-name));
                    switch (ns-update (delete (IN, A, ddns-fwd-name,
                                           leased-address))) {
                    case NOERROR:
                       unset ddns-fwd-name;
                       break;
                    }
                    on release or expiry;
                }
                break;

            case NOERROR:
                on release or expiry {
                    execute ("/opt/bin/ddns-ipv6", "-d",  pick-first-value(ddns-hostname, host-decl-name));
                    switch (ns-update (delete (IN, PTR, ddns-rev-name, null))) {
                    case NOERROR:
                        unset ddns-rev-name;
                        break;
                    }
                    switch (ns-update (delete (IN, A, ddns-fwd-name,
                                           leased-address))) {
                    case NOERROR:
                        unset ddns-fwd-name;
                        break;
                    }
                    on release or expiry;
                }
            }
            break;
        }
   }
}

相关内容