V2ex上有2人问这个问题,就专门写文章总结一下吧
interface eth0 { ## 定义有IPv6的那个接口的名称,也就是旁路LAN口的名称 IgnoreIfMissing on; AdvSendAdvert on; MaxRtrAdvInterval 600; AdvReachableTime 0; AdvDefaultPreference high; ########重要 prefix ::/64 { ### SLAAC模式下获取的前缀都是/64 AdvAutonomous on; AdvPreferredLifetime 14400; AdvValidLifetime 86400; AdvOnLink on; }; clients { ### 在此枚举需要进行流量牵引的设备的Link local地址 #DEVICE 1 fe80::aabb:ccdd:eeff:gghh; }; };
实测手里的所有安卓都不支持,IOS未知,作为默认路由法的补充。
简单来说的话,就是把需要“牵引”流量的目的地址通过RA告诉客户端,相当于给客户端下发一些静态路由,你可以枚举所有的已经分配的公共单播IPv6地址前缀(数量也不是很多),也可以只声明你需要牵引的目的地址的前缀,这样做某些事情更加有针对性,这里给出一个示例
interface eth0 { # 省略其他的配置 route 2001:0000::/23 {}; route 2001:0200::/23 {}; route 2001:0400::/23 {}; route 2001:0600::/23 {}; route 2001:0800::/22 {}; route 2001:0c00::/23 {}; route 2001:0e00::/23 {}; route 2001:1200::/23 {}; route 2001:1400::/22 {}; route 2001:1800::/23 {}; route 2001:1a00::/23 {}; route 2001:1c00::/22 {}; route 2001:2000::/19 {}; route 2001:4000::/23 {}; route 2001:4200::/23 {}; route 2001:4400::/23 {}; route 2001:4600::/23 {}; route 2001:4800::/23 {}; route 2001:4a00::/23 {}; route 2001:4c00::/23 {}; route 2001:5000::/20 {}; route 2001:8000::/19 {}; route 2001:a000::/20 {}; route 2001:b000::/20 {}; route 2002:0000::/16 {}; route 2003:0000::/18 {}; route 2400:0000::/12 {}; route 2600:0000::/12 {}; route 2610:0000::/23 {}; route 2620:0000::/23 {}; route 2630:0000::/12 {}; route 2800:0000::/12 {}; route 2a00:0000::/12 {}; route 2a10:0000::/12 {}; route 2c00:0000::/12 {}; };