ILD

ubuntu搭建ipv6 ra/dhcpv6 server
作者:YuanJianpeng 邮箱:yuanjianpeng@360.cn
发布时间:2020-3-4 站点:Inside Linux Development

ra使用radvd。安装方法:

$ sudo apt install radvd


配置文件radvd.conf

interface enp0s25
{
    AdvSendAdvert on;
    AdvManagedFlag on;
    AdvOtherConfigFlag off;
    prefix 2001::/64
    {
        AdvOnLink on;
        AdvAutonomous on;
    };
};


dhcpv6 server使用isc-dhcp-server,安装方法:

$ sudo apt install isc-dhcp-server


配置文件dhcp6s.conf

option dhcp6.name-servers 2001::1;
option dhcp6.domain-search "example.com";

subnet6 2001::/64 {
    range6 2001::2 2001::10;
    prefix6 2002:: 2008:: /64;
}


其它时间参数保持默认,如果设置不要随便设置,时间参数是有长短要求的。比如preferred time应该要比valid time小,如果不对,客户端可能认为没有地址,而只请求information。


配置接口,添加一个ipv6地址:2001::1/64,和radvd一个网段,和dhcpv6的rang6一个网段,dhcpv6的prefix应该为另外一个网段。


启动radvd和dhcpv6 server

$ sudo radvd -C /work/radvd.conf

$ sudo dhcpd -6 -cf /work/dhcpv6s.conf -lf /work/dhcpv6s.leases enp0s25


Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.