2013年4月30日 星期二

DHCP IPv6

網頁:https://www.isc.org/software/dhcp/

手動安裝方式:
安裝版本:DHCP 4.2.5-P1
系統環境:CentOS 6.4
環境需求:
yum install gcc
安裝方式:
#./configure
#make
#mkae install
執行檔位置:/usr/local/sbin/dhcpd
設定檔位置:/usr/local/etc/dhcpd.conf 
( 如果同一台機器同時提供IPv6和IPv4的dhcpd服務執行檔同一支daemon 但設定檔要分開 )

執行指令:
  • IPv6
dhcpd -6 -cf /etc/dhcpd6.connf
  • IPv4
dhcpd -4 -cf /etc/dhcpd.connf

yum 方式安裝:
安裝版本:DHCP 4.1.1
系統環境:CentOS 6.4
安裝方式:
yum install dhcp
 設定檔位置:
  • IPv4
/etc/dhcp/dhcp.conf
  • IPv6
/etc/dhcp/dhcp6.conf
服務啟動 :
  •  IPv4
service dhcpd start
  • IPv6
service dhcpd6 start
說明:
dhcpd和dhcpd6 的啟動的script 中透過指令"diff /etc/init.d/dhcpd  /etc/init.d/dhcpd6"可以看到兩者都是透過dhcpd 執行 ,差別在於執行的參數( -4和 -6 )和設定檔的不同。
dhcpd6 的script 中 lease 檔案位於 /var/lib/dhcpd/dhcpd6.lease ,如果要放到/var/db 下 要修正 script內容。

範例 sample位置 :
/usr/share/doc/dhcp*/dhcpd6.conf.sample

default-lease-time 2592000;
preferred-lifetime 604800;
option dhcp-renewal-time 3600;
option dhcp-rebinding-time 7200;
allow leasequery;

option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:3f3e;
option dhcp6.domain-search "test.example.com","example.com";
option dhcp6.info-refresh-time 21600;
dhcpv6-lease-file-name "/usr/local/var/db/dhcpd6.leases";

host myclient {
        host-identifier option
                dhcp6.client-id 00:01:00:01:00:04:93:e0:00:00:00:00:a2:a2;
        fixed-address6 3ffe:501:ffff:100::1234;
        fixed-prefix6 3ffe:501:ffff:101::/64;
        option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:4f4e;
}

host otherclient {
        hardware ethernet 01:00:80:a2:55:67;
        fixed-address6 3ffe:501:ffff:100::4321;
}
subnet6 3ffe:501:ffff:100::/64 {
        range6 3ffe:501:ffff:100::10 3ffe:501:ffff:100::11;
        range6 3ffe:501:ffff:100:: temporary;
        prefix6 3ffe:501:ffff:100:: 3ffe:501:ffff:111:: /64;
}

subnet6 3ffe:501:ffff:101::/64 {
        range6 3ffe:501:ffff:101::10 3ffe:501:ffff:101::11;
        option dhcp6.name-servers 3ffe:501:ffff:101:200:ff:fe00:3f3e;
}

subnet6 3ffe:501:ffff:102::/64 {
        range6 3ffe:501:ffff:102::10 3ffe:501:ffff:102::11;
}

DHCPv6 message
DHCPv6 message

DHCPv6 server log

 dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P1
 dhcpd: Copyright 2004-2010 Internet Systems Consortium.
 dhcpd: All rights reserved.
 dhcpd: For info, please visit https://www.isc.org/software/dhcp/
 dhcpd: Wrote 0 deleted host decls to leases file.
 dhcpd: Wrote 0 new dynamic host decls to leases file.
 dhcpd: Wrote 0 leases to leases file.
 dhcpd: Bound to *:547
 dhcpd: Listening on Socket/5/eth0/2001:288:2274:5::/64
 dhcpd: Sending on   Socket/5/eth0/2001:288:2274:5::/64
 dhcpd: Solicit message from fe80::853b:3223:1d42:98b4 port 546, transaction ID 0xA791A600
 dhcpd: Sending Advertise to fe80::853b:3223:1d42:98b4 port 546
 dhcpd: Request message from fe80::853b:3223:1d42:98b4 port 546, transaction ID 0xA791A600
 dhcpd: Sending Reply to fe80::853b:3223:1d42:98b4 port 546

沒有留言:

張貼留言