網頁

2009年7月3日 星期五

IPV6 DHCPV6 Configuration

Router Advertisement Daemon (radvd)
/etc/radvd.conf

interface eth0 { 
  AdvSendAdvert on; 
  MinRtrAdvInterval 3; 
  MaxRtrAdvInterval 10; 
  prefix 2001:0db8:0100:f101::/64 { 
     AdvOnLink on; 
    #Disable Stateless Address Autoconfiguration 
    #AdvAutonomous on; 
    AdvRouterAddr on; 
  }; 
};
 
Wide-DHCPv6
Server configuration: dhcp6s.conf

option domain-name-servers 2001:470:1f01:2191::1 2001:470:1f01:2191::2; 
option domain-name "dean.net"; 
interface eth0{ 
  address-pool pool1 3600; 
}; 
pool pool1 { 
  range 2001:5c0:1101:b700::1000 to 2001:5c0:1101:b700::2000 ; 
}; 
host host0 { 
  duid 00:00:00:00:a0:a0; 
  prefix 3ffe:ffff:102::120/64 infinity; 
};
Client configuration
DHCPV6 client for the stateful autoconfigutation

interface eth0 {
         send ia-na 0;
         request domain-name-servers;
         request domain-name;
         script "/tmp/dean/dhcp6c-script";
};
id-assoc na 0 {
         # non-temporary addresses
};
DHCPV6 client for the stateless autoconfigutation
interface eth0
{
 information-only;


 request domain-name-servers;
 request domain-name;
 script "/tmp/dean/dhcp6c-script";

};
DHCPV6 script
update DNS in resolv.conf
#!/bin/sh

if [ -n "$new_domain_name" -o -n "$new_domain_name_servers" ]; then
    new_resolv_conf=/tmp/resolv.conf.dhcp6c-new
    rm -f $new_resolv_conf
    if [ -n "$new_domain_name" ]; then
        echo search $new_domain_name >> $new_resolv_conf
    fi
    if [ -n "$new_domain_name_servers" ]; then
        for nameserver in $new_domain_name_servers; do
            echo nameserver $nameserver >> $new_resolv_conf
        done
    fi

    # To preserve IPv4 informations...
    cat /etc/resolv.conf >> $new_resolv_conf
    mv -f $new_resolv_conf /etc/resolv.conf
fi

exit 0