Ubuntu20作为路由,设置IPv6 PPPoe slaac配置例子

Dnsmasq配置如下:

enable-ra
dhcp-range=::1,constructor:eth2,ra-only,12h
except-interface=ppp0

Wide-dhcpv6配置如下:

  profile default
{
   information-only;
  
  request domain-name-servers;
  request domain-name;

  script "/etc/wide-dhcpv6/dhcp6c-script";
};
interface ppp0 {
    # Request Prefix Delegation on ppp0, and give the received prefix id 0
    send ia-pd 0;
};

# Use subnets from the prefix with id 0
id-assoc pd 0 {
        prefix ::/64 infinity;
        prefix-interface eth2 {
        sla-len 0;
        sla-id 1;
        ifid 1;
    };
};
如果有多个内网网口,配置变更如下:

profile default
{
   information-only;
  
  request domain-name-servers;
  request domain-name;

  script "/etc/wide-dhcpv6/dhcp6c-script";
};
interface ppp0 {
    # Request Prefix Delegation on ppp0, and give the received prefix id 0
    send ia-pd 0;
};

# Use subnets from the prefix with id 0
id-assoc pd 0 {
        prefix ::/64 infinity;
              prefix-interface eth1 {
        sla-len 0;
        sla-id 1;
        ifid 1;
    };        prefix-interface eth2 {
        sla-len 0;
        sla-id 1;
        ifid 1;
    };
};

sysctl.conf部分配置如下:

net.ipv6.conf.eth2.accept_ra=2
net.ipv6.conf.ppp0.accept_ra=2
net.ipv6.conf.all.use_tempaddr=0
net.ipv6.conf.default.use_tempaddr=0

service服务文件如下:

[Unit]
Description=wide-dhcpv6
Before=dnsmasq.service
After=network.target 
[Service]
ExecStart=/usr/sbin/dhcp6c -c /etc/wide-dhcpv6/dhcp6c.conf -P default -d -D -f ppp0
RemainAfterExit=true

[Install]
WantedBy=multi-user.target

/etc/ppp/option配置文件部分如下:

+ipv6 ipv6cp-use-ipaddr

警惕无线AP热点软件,警惕ipv6地址

最近连公司WI-FI总会多出来个ipv6地址。怎么也抓不到原mac地址是多少(能抓到的就是一个33:33:ff开头的地址,搜了一下基本就是AP软件产生的)。排查了所有机器,也没发现AP类软件。

想想只有一个可能,公司Wi-Fi密码被泄漏了。然后那个家伙还用AP软件做了个接入点,接入了本地有线。不知道设置了什么模式,ipv6的广播包被发送到我公司网络。

然后我改掉了公司Wi-Fi密码。这个IPV6地址就不见了。应证了事实。

如果你的Wi-Fi有不知名的ipv6地址不妨也试一试。

ps:多余的ipv6地址会导致网络异常,因为现在很多设备都是ipv6优先,但是ipv6在国内就是个残废。导致dns来回解析延迟,表现就是网络很慢,甚至连不上。如果是个无效的ipv6路由,那就是直接断网了。但是坑爹的是苹果很多设备默认优化ipv6,没有ipv6 会有一大堆问题。