Dhcp

如何配置 dhcpd 以在具有靜態 ipv6 地址的同時使用綁定註冊 ipv4?

  • March 13, 2015

我在我的本地網路上配置了 IPv6 radvd;它通告一個可路由的 IPv6 塊,所有機器都自動配置。

我通過 dhcpd 將 IPv4 分配給了一個 NAT’d 塊並命名了更新。

我的問題是,當我為其 IPv6 地址(不會更改)設置主機的 AAAA 記錄時,named 將開始拒絕來自 dhcpd 的 A 記錄的名稱更新。

命名報告以下錯誤:

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

dhcpd 會報如下錯誤:

Has an A record but no DHCID, not mine

AAAA在進行命名更新時,如何說服 dhcpd 忽略記錄。

我在這裡找到了答案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;
       }
  }
}

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

update-conflict-detection false;

引用自:https://unix.stackexchange.com/questions/49600