当前位置: 首页 > 系统与网络 > 正文

ROS的设置请前往:https://blog.ich8.com/post/6015

*下文如有过错,,,指出就好了,博主对IPv6也并不是很深入很熟悉。。。
*以下内容基于福建电信的IPv6分配方式。不同地区可能略微有区别。部分地区没有IPv6分配。目前99%联通和移动用户暂时靠边站。
*关于安全性,防火墙这边没设置,那么你的主机在IPv6下就完全暴露在IPv6公网中了。安全性则需要提高。
*如果你的路由是TP-Link国行(包括TP的企业产品),以及什么D-Link,腾达之类的,通通靠边站……全是玩具。关于梅林啥的,这种高大上的东西博主也不爱……明明是博主口袋紧,,,
*关于如何设置光猫让其分配IPv6地址,请前往上述地址。
*光猫设置也请前往该地址:https://blog.ich8.com/post/6033

关于前戏,还是前往上面那个地址。看后再回来,啪啪啪。

必须说一点,Ubnt EdgeMax EdgeRouter 固件版本必须升级到1.8.0,v1.7.0有bug,当PPPoE断线重连后,原分配的Network Prefix依旧会配置在接口中。而v1.8.0则有一些奇葩的bug,这边我也不好说。升级后务必恢复出厂设置,重设!经过多次测试,使用v1.7.0或者以前版本的配置可能会导致无法分配IPv6地址。

回到正题。基本Ubnt设置,拨号,接口地址,IPv4 DHCP等各种基本功跳过。
*set命令就不发了,GUI吧,看着清晰明了。其实还是最后的接口配置看着清晰明了。

路由配置:我的PPPoE拨号在eth0接口下,lan2-4为网桥接口,共处于switch0下。PPPoE Number:1。

1.进入Config Tree,进入左侧的 Configuration 。配置树
位置:interfaces / ethernet / eth0 / pppoe / 1。
启用:
①DHCPv6-PD,使用DHCPv6-PD方式获取IPv6前缀。
②no-dns 可选是否启用,因为我已经有指定的dns了,就没必要获取。
③prefix-only 启用。
④展开pd,建立一个Number为1的接口。
⑤展开interface,将前缀应用于switch0接口上。*图1
⑥展开switch0,host-address 接口主机地址设置为 ::1 即前缀+::1为Switch0的地址。prefix-id为1。service服务类型为slaac,即无状态地址自动配置,系统会根据前缀自动推算主机地址。*图2
⑦no-dns依旧按需启用。

Interface for prefix delegation图1

switch0图2

2.位置:
位置:interfaces / ethernet / eth0 / pppoe / 1
启用:
①ipv6 enable启用。*图3
ipv6图3

3.位置:
位置:interfaces / switch / switch0
启用:
①ipv6 enable启用。
②address – autoconf 启用。启用无状态地址自动配置。
③router-advert 启用。Router Advertisement,启用路由器通告。只有启用RA,路由器接收到RA报文中的M(Managed address configuration flag,被管理地址配置标志位)标志位为0,O(Other stateful configuration flag,其他配置标志位)标志位为1后才会自动启用DHCPv6无状态配置功能。
④router-advert 保持默认配置。*图4
⑤router-advert – prefix 添加 ::/64 地址块。在v1.7.0版本中并不需要就会自动分配IPv6地址。
展开 ::/64 ,valid-lifetime 必须修改。默认为30天,但是我发现在v1.8.0固件中如果保持默认(30天*24小时*60秒=?)则无法分配IPv6地址,不知为何。*图5

router-advert图4

prefix图5

4.添加IPv6默认路由
位置:protocols / static / interface-route6
启用:
①interface-route6中输入::/0 ,点击Update List。 *图6
②展开设置,next-hop-interface,下一跳路由选择 pppoe1 *图7
③最后点击Preview来生效刚才的配置。
④*无关:system / offload : Setting for hardware offload 可选择IPv4/IPv6开启,据说可以降低系统负载?

ipv6-default-route图6

next-hop-interface图7

5.查看接口IPv6信息,查看是否switch0获取到IPv6地址。
使用ssh登陆edgerouter,使用 show interfaces 命令查看。如获取到,则在switch0下会有ipv6地址。
show-interfaces
获取到之后再连接电脑查看是否获取到IPv6地址并且测试IPv6网络连通性。PING方式为域名+ -6 。tracert方式为 -6 。linux为ping6和traceroute6。

***配置文件内容***

admin@edgemax# show interfaces
ethernet eth0 {
address 192.168.0.1/24
description “Internet – WAN1”
poe {
output off
}
pppoe 1 {
dhcpv6-pd {
no-dns
pd 1 {
interface switch0 {
host-address ::1
prefix-id 1
service slaac
}
prefix-length /56
}
prefix-only
}
ipv6 {
enable {
}
}
password mima
user-id zhanghao
}
}
ethernet eth1 {
description “Internet – WAN2”
poe {
output off
}
}
ethernet eth2 {
description Local
poe {
output off
}
}
ethernet eth3 {
description Local
poe {
output off
}
}
ethernet eth4 {
description Local
poe {
output off
}
}
loopback lo {
}
switch switch0 {
address 192.168.1.1/24
description Switch0
ipv6 {
address {
autoconf
}
router-advert {
prefix ::/64 {
valid-lifetime 86400
}
}
}
switch-port {
interface eth2
interface eth3
interface eth4
}
}
[edit]

*转载请注明源地址,谢谢合作。

[分享]Ubnt EdgeRouter 配置电信双栈原生IPv6 及IPv6公网地址分配:目前有 2 条评论

  1. 沙发
    kevinqyr

    可以请博主留个QQ吗 请教点问题

发表评论