在PPPoE接入网络中配置IPv4和IPv6双协议栈的最佳实践
最佳实践:使用 NDRA 的静态 PPPoE 接口
将静态 PPPoE 接口与 NDRA 配合使用时,为路由器通告配置的前缀必须与逻辑 pp0 接口配置中在家族 inet6 下指定的源地址匹配。如果这些值不匹配,则前缀不会正确播发。
例如:
[edit protocols router-advertisement]
interface pp0.2004 {
prefix 2001:db8:2040:2004::/64;
}
[edit interface pp0]
unit 2004 {
family inet6 {
address 2001:db8:2040:2004::10.1.1.1/64;
}
}
要查看 ICMPv6 数据包中的前缀,请使用 monitor traffic interface pp0.xxx extensive 命令。如果缺少前缀,请确保在路由器播发配置中为接口配置的家族 inet6 地址与为接口配置的前缀之间没有不匹配。
最佳实践:通过 PPPoE 接入网络的 DHCPv6 前缀委派
通过 PPPoE 接入网络使用 DHCPv6 前缀委派时,需要在 inet6 系列配置中启用无编号寻址。
对于动态 PPPoE 接口,请在动态配置文件中启用无编号寻址。例如:
[edit dynamic-profiles]
PPPoE-dyn-ipv4v6-dhcp {
interfaces {
pp0 {
unit "$junos-interface-unit" {
. . .
family inet6 {
unnumbered-address lo0.0;
}
}
}
}
}
对于静态 PPPoE 接口,请在接口配置中启用无编号寻址。例如:
[edit interface pp0]
unit 2004 {
family inet6 {
unnumbered-address lo0.0;
最佳实践:使用 NDRA 的 PPPoE 动态配置文件中逻辑接口的 IPv6 寻址
使用 NDRA 时,请始终将动态配置文件 $junos-ipv6-address 中的 IPv6 互联网地址设置为预定义变量。此变量将替换为用于路由器播发的接口的 IPv6 地址。
[edit dynamic-profiles]
dyn-v4v6-ndra {
interfaces {
pp0 {
unit "$junos-interface-unit" {
family inet6 {
address "$junos-ipv6-address ";
}
}
}
}
}
最佳实践:使用 DHCPv6 的 PPPoE 动态配置文件中的逻辑接口 IPv6 寻址
使用 DHCPv6 时,PPPoE 动态配置文件中逻辑接口的 IPv6 地址配置取决于是否使用路由实例。
如果您使用的是路由实例,请对 IPv6 地址使用 $junos-loopback-interface 预定义变量。例如:
[edit dynamic-profiles]
dyn-v4v6-ri {
routing-instances {
"$junos-routing-instance" {
interface "$junos-interface-name";
}
}
interfaces {
pp0 {
unit "$junos-interface-unit" {
family inet6 {
unnumbered-address "$junos-loopback-interface";
}
}
}
}
}
如果不使用路由实例,请使用未编号的地址作为 IPv6 地址。未编号地址允许从指定接口派生本地地址,并允许在接口上进行 IP 处理,而无需为接口分配显式 IP 地址。例如:
[edit dynamic-profiles]
dyn-v4v6-ndra {
interfaces {
pp0 {
unit "$junos-interface-unit" {
pppoe-options {
underlying-interface "$junos-underlying-interface";
server;
}
family inet6 {
unnumbered-address lo0.0;
}
}
}
}
}
最佳实践:PPPoE 动态配置文件中逻辑接口的 IPv4 寻址
PPPoE 动态配置文件中逻辑接口的 IPv4 地址配置取决于是否使用路由实例。
如果您使用的是路由实例,请将变量用作 $junos-loopback-interface IPv6 地址。
[edit dynamic-profiles]
dyn-v4v6-ri {
routing-instances {
"$junos-routing-instance" {
interface "$junos-interface-name";
}
}
interfaces {
pp0 {
unit "$junos-interface-unit" {
family inet {
unnumbered-address "$junos-loopback-interface";
}
}
}
}
}
如果不使用路由实例,请使用未编号的地址作为 IPv6 地址。未编号地址允许从指定接口派生本地地址,并允许在接口上进行 IP 处理,而无需为接口分配显式 IP 地址。
[edit dynamic-profiles]
dyn-v4v6-ndra {
interfaces {
pp0 {
unit "$junos-interface-unit" {
pppoe-options {
underlying-interface "$junos-underlying-interface";
server;
}
family inet {
unnumbered-address lo0.0;
}
}
}
}
}
最佳实践:在 PPPoE 访问网络上配置 DHCP 订阅者的身份验证
在大多数情况下,PPPoE 用于对 PPPoE 接入网络中的用户进行身份验证。但是,如果您希望使用 DHCP 执行身份验证,请不要在 [edit system services dhcp-local-server] 或 [edit system services dhcp-local-server dhcpv6] 层次结构级别配置订阅者身份验证。而要在 [edit system services dhcp-local-server dhcpv6 group] 层次结构级别配置订阅者身份验证。例如:
[edit system services dhcp-local-server dhcpv6]
group v6-dhcp-client {
authentication {
password $ABC123;
username-include {
user-prefix StaticUser;
}
}
}