第 2 层通道协议 (L2TP)
第 2 层通道协议 (L2TP) 是用于在第 3 层网络上隧道第 2 层流量的协议。您可以使用 L2TP 在网络中启用点对点协议 (PPP) 隧道。
L2TP 需要一个 L2TP 接入集中器 (LAC) 和一个 L2TP 网络服务器 (LNS)。LNS 是 L2TP 隧道的一个端点。在接入设备上配置的 LAC 从远程客户端接收数据包,并转发至远程网络上的 LNS。LAC 和 LNS 是对等方。
有关如何为订阅者访问配置 L2TP 的信息,请参阅 L2TP for Subscriber Access 概述。
最小 L2TP 配置
要定义 L2TP 的最低配置,请在层次结构级别至少包括以下语句 [edit access]
:
[edit access] address-pool pool-name { address address-or-prefix; address-range low <lower-limit> high <upper-limit>; } profile profile-name { authentication-order [ authentication-methods ]; client client-name { chap-secret chap-secret; l2tp { interface-id interface-id; maximum-sessions-per-tunnel number; ppp-authentication (chap | pap); shared-secret shared-secret; } pap-password pap-password; ppp { framed-ip-address ip-address; framed-pool framed-pool; interface-id interface-id; primary-dns primary-dns; primary-wins primary-wins; secondary-dns secondary-dns; secondary-wins secondary-wins; } } } radius-server server-address { accounting-port port-number; port port-number; retry attempts; secret password; }
使用 RADIUS 身份验证配置 LNS 时,默认行为是接受首选 RADIUS 分配的 IP 地址。以前,默认行为是接受和安装互联网协议控制协议 (IPCP) 配置请求数据包中收到的非零对等方 IP 地址。
L2TP 配置文件
为 L2TP 配置配置文件。
配置多种类型的配置文件时,操作系统仅实施一个配置。操作系统按如下顺序分配优先级,其中 [edit access profile profile-name]
替代所有其他配置文件配置:
[edit access profile profile-name]
[edit access group-profile profile-name]
[edit access profile profile-name user-group-profile profile-name]
访问配置文件
要验证 L2TP 连接和会话请求,您可在层次结构级别配置配置文件语句 [edit access]
来设置访问配置文件。您可以配置多个配置文件。您还可以为每个配置文件配置多个客户端。
配置 L2TP 客户端
要配置客户端,请在层次结构级别中[edit access profile profile-name]
包括client
语句:
[edit access profile profile-name] client client-name;
client-name
是对等方身份
对于 L2TP,您可以选择使用通配符 (*
) 来定义默认隧道客户端,以验证具有相同密钥和 L2TP 属性的多个 LAN。如果配置中未定义具有特定名称的 LAC,通配符隧道客户端将对其进行认证。
默 *
认客户端配置仅适用于 M 系列路由器。在 MX 系列路由器上,改为使用 default
。有关 MX 系列路由器的详细信息,请参阅 L2TP LNS 内联服务接口 。
客户端特定配置文件
要为客户端特定配置文件定义 L2TP 属性,请在层次结构级别包含 [edit access profile profile-name client client-name l2tp]
以下一个或多个语句:
配置配置文件时,可以同时配置 L2TP 或 PPP 参数。
[edit access profile profile-name client client-name l2tp] interface-id interface-id; lcp-renegotiation; local-chap; maximum-sessions-per-tunnel number; multilink { drop-timeout milliseconds; fragment-threshold bytes; } ppp-authentication (chap | pap); shared-secret shared-secret;
interface-id
(语句中 interface-id
)是代表在层次结构级别上配置的 L2TP 会话的接口的 [edit interfaces interface-name unit local-unit-number dial-options]
标识符。
number
(语句中 maximum-sessions-per-tunnel
)是 L2TP 隧道的最大会话数。
shared-secret
(语句中 shared-secret
)是用于验证对等方的共享密钥。
您可以指定 PPP 身份验证(语句中 ppp-authentication
)。默认情况下,PPP 身份验证使用 CHAP。您可以将此配置为使用密码认证协议 (PAP)。
您可以配置 LNS,以便重新协商 LCP 与 PPP 客户端(语句中 lcp-negotiation
)。默认情况下,PPP 客户端会与 LAC 协商 LCP。执行此操作时,LNS 会放弃最后发送的 LCP 配置请求,而最后收到的 LCP 配置请求是来自 LAC 的 AVP;例如,PPP 客户端与 LAC 之间协商的 LCP。
您可以配置 Junos OS,以便 LNS 忽略 LAC 中的代理身份验证 AFP,并使用 CHAP 挑战重新验证 PPP 客户端(语句中 local-chap
)。默认情况下,PPP 客户端不会由 LNS 重新授权。执行此操作时,LNS 会直接对 PPP 客户端进行身份验证。
如果从 LAC 进入 LNS 的 PPP 会话已协商多链路 PPP,则可以为 L2TP 配置 PPP MP。执行此操作时,您将根据端点识别器(语句中 multilink
)加入多链路捆绑包。
-
milliseconds
(语句中drop-timeout
)指定了与重组队列上第一个分片相关的超时数毫秒数。如果超时在收集所有分片之前过期,则会丢弃重组队列开始时的分片。如果未指定丢弃超时,Junos OS 将固定在分片上(如果多链路重组算法确定重组队列上属于数据包的另一个分片丢失,则仍可能丢弃分片)。注意:捆绑多链路的丢弃超时和分段阈值可能属于不同的隧道。不同的隧道可能会有不同的丢弃超时和分段阈值。当您拥有 L2TP 隧道时,我们建议配置组配置文件,而不是配置文件。
-
bytes
指定数据包的最大大小(以字节为单位)(在语句中fragment-threshold
)。如果数据包超过分片阈值,Junos OS 会将其分片为两个或更多多链路分片。
示例:定义默认隧道客户端
[edit access profile profile-name] client * { l2tp { interface-id interface1; lcp-renegotiation; local-chap; maximum-sessions-per-tunnel 500; ppp-authentication chap; shared-secret "$ABC123"; } }
对于任何通道客户端,您可以选择使用用户组配置文件为通过隧道进入的所有用户定义默认 PPP 属性。用户组配置文件必须定义 PPP 属性。如果指定了用户组配置文件,则所有用户(PPP 会话)均使用用户组配置文件中指定的 PPP 属性。本地或 RADIUS 服务器中指定的 PPP 属性优先于用户组配置文件中指定的属性。
或者,您可以使用通配符客户端来定义用户组配置文件。执行此操作时,进入此通道的任何客户端都使用 PPP 属性(定义的用户组配置文件属性)作为其默认 PPP 属性。
配置访问配置文件
配置配置文件时,只能配置 L2TP 或 PPP 参数。不能同时配置两者。
另请参阅
示例:访问配置文件配置
以下示例显示访问配置文件的配置:
[edit access] profile westcoast_bldg_1 { client white { chap-secret "$ABC123"; # SECRET-DATA ppp { idle-timeout 22; primary-dns 198.51.100.10; framed-ip-address 198.51.100.12/24; } group-profile westcoast_users; } client blue { chap-secret "$ABC123"; # SECRET-DATA group-profile sunnyvale_users; } authentication-order password; } profile westcoast_bldg_1_tunnel { client test { l2tp { shared-secret "$ABC123"; # SECRET-DATA maximum-sessions-per-tunnel 75; ppp-authentication chap; } group-profile westcoast_tunnel; } client production { l2tp { shared-secret "$ABC123”; # SECRET-DATA ppp-authentication chap; } group-profile westcoast_tunnel; } }
组配置文件
您可以选择性地配置组配置文件。引用配置的组配置文件的任何客户端都会继承所有组配置文件属性。这样可以更轻松地大规模应用 L2TP。
要为组配置文件配置 L2TP,请在层次结构级别上 [edit access group-profile profile-name l2tp]
包含以下语句:
[edit access group-profile profile-name l2p] interface-id interface-id; lcp-renegotiation; local-chap; maximum-sessions-per-tunnel number;
interface-id
是表示在层次结构级别上配置的 L2TP 会话的接口的 [edit interfaces interface-name unit local-unit-number dial-options]
标识符。
您可以配置 LNS ,使其与 PPP 客户端重新协商链路控制协议 (LCP)(语句中 renegotiation
)。默认情况下,PPP 客户端会与 L2TP 接入集中器 (LAC) 协商 LCP。执行此操作时,LNS 会丢弃来自 LAC 的最后一个已发送和最后收到的 LCP 配置请求属性值对 (AVP);例如,PPP 客户端与 LAC 之间协商的 LCP。
您可以配置 Junos OS,以便 LNS 忽略 LAC 中的代理身份验证 AFP,并使用 CHAP 挑战重新验证 PPP 客户端(语句中 local-chap
)。执行此操作时,LNS 会直接对 PPP 客户端进行身份验证。默认情况下,PPP 客户端不会由 LNS 重新授权。
number
是每个 L2TP 隧道的最大会话数。
参考 L2TP 配置文件中的组配置文件
您可以从 L2TP 隧道配置文件中参考已配置的组配置文件。
要参考在层级配置的[edit access group-profile profile-name]
组配置文件,请在层次结构级别中[edit access profile profile-name client client-name]
包含group-profile
语句:
[edit access profile profile-name client client-name] group-profile profile-name;
profile-name
参考 PPP 用户配置文件中配置的组配置文件。
示例:用于 L2TP 的 PPP MP
[edit access] profile tunnel-profile { client remote-host { l2tp { multilink { drop-timeout 600; fragmentation-threshold 100; } } } }
配置 L2TP 身份验证
L2TP 不包含任何身份验证方法,因此具有灵活性,可与您的首选安全功能配合使用。为 L2TP 配置文件配置 PPP 属性时,通常会chap-secret
配置语句或pap-password
语句。
为 L2TP 配置文件配置 CHAP 密钥
CHAP 允许 PPP 链路的每一端对等方进行身份验证,如 RFC 1994 中定义。验证方向其对等方发送一个随机生成的挑战,即对等方必须使用单向散列进行加密;然后,对等方必须对加密结果做出响应。哈希的密钥是只有认证方才知道并经过身份验证的秘密。收到响应时,验证方会将其计算结果与对等方的响应进行比较。如果它们匹配,则对等方将经过身份验证。
链路的每个端都通过将其名称包括在其发送给对等方的 CHAP 挑战和响应数据包中,向其对等方标识自身。此名称默认用于本地主机名,或者您可以使用 local-name
选项显式设置。当主机在特定接口上收到 CHAP 挑战或 CHAP 响应数据包时,它会使用对等方身份查找要使用的 CHAP 密钥。
为第 2 层通道协议 (L2TP) 配置文件配置 PPP 属性时,通常会配置 chap-secret
语句或 pap-password
语句。
要配置 CHAP,请在层次结构级别中包括语 profile
句并指定配置文件名称 [edit access]
:
[edit access] profile profile-name { client client-name chap-secret data; }
然后参考层级的 [edit interfaces interface-name ppp-options chap]
CHAP 配置文件名称。
您可以配置多个配置文件。您还可以为每个配置文件配置多个客户端。
profile
是对等方标识符和 CHAP 密钥之间的映射。CHAP 挑战中包含的对等方身份,或响应查询要使用的密钥配置文件。
client
是对等方身份
chap-secret secret
是与该对等方关联的秘密密钥。
示例:配置 L2TP PPP CHAP
[edit] access { profile westcoast_bldg1 { client cpe-1 chap-secret "$ABC123"; # SECRET-DATA client cpe-2 chap-secret "$ABC123"; # SECRET-DATA } }
为 L2TP 配置文件配置 PAP 密码
要配置密码认证协议 (PAP) 密码,请在层次结构级别中[edit access profile profile-name client client-name]
包含pap-password
语句:
[edit access profile profile-name client client-name] pap-password pap-password;
pap-password
是 PAP 的密码
示例:为 L2TP 配置文件配置 PAP
[edit access] profile sunnyvale_bldg_2 { client green { pap-password "$ABC123"; ppp { interface-id west; } group-profile sunnyvale_users; } client red { chap-secret "$ABC123"; group-profile sunnyvale_users; } authentication-order radius; } profile Sunnyvale_bldg_1_tunnel { client test { l2tp { shared-secret "$ABC123"; ppp-authentication pap; } } }
示例:配置 L2TP
[edit] access { address-pool customer_a { address 10.1.1.1/32; } address-pool customer_b { address-range low 10.2.2.2 high 10.2.3.2; } group-profile westcoast_users { ppp { framed-pool customer_a; idle-timeout 15; primary-dns 10.192.65.1; secondary-dns 10.192.65.2; primary-wins 10.192.65.3; secondary-wins 10.192.65.4; interface-id west; } } group-profile eastcoast_users { ppp { framed-pool customer_b; idle-timeout 20; primary-dns 10.192.65.5; secondary-dns 10.192.65.6; primary-wins 10.192.65.7; secondary-wins 10.192.65.8; interface-id east; } } group-profile westcoast_tunnel { l2tp { maximum-sessions-per-tunnel 100; } } group-profile east_tunnel { l2tp { maximum-sessions-per-tunnel 125; } } profile westcoast_bldg_1 { client white { chap-secret "$ABC123"; # SECRET-DATA ppp { idle-timeout 22; primary-dns 10.192.65.10; framed-ip-address 10.12.12.12/32; } group-profile westcoast_users; } client blue { chap-secret "$ABC123"; # SECRET-DATA group-profile sunnyvale_users; } authentication-order password; } profile west-coast_bldg_2 { client red { pap-password "$ABC123"; # SECRET-DATA ppp { idle-timeout 22; primary-dns 10.192.65.11; framed-ip-address 10.12.12.12/32; } group-profile westcoast_users; } } profile westcoast_bldg_1_tunnel { client test { l2tp { shared-secret "$ABC123"; # SECRET-DATA maximum-sessions-per-tunnel 75; ppp-authentication chap;# The default for PPP authentication is CHAP. } group-profile westcoast_tunnel; } client production { l2tp { shared-secret "$ABC123 ABC123"; # SECRET-DATA ppp-authentication chap; } group-profile westcoast_tunnel; } } profile westcoast_bldg_2_tunnel { client black { l2tp { shared-secret "$ABC123 ABC123"; # SECRET-DATA ppp-authentication pap; } group-profile westcoast_tunnel; } } }
为 M7i 和 M10i 路由器配置 L2TP
对于 M7i 和 M10i 路由器,您可以在自适应服务物理接口卡 (PIC) 或多服务 PIC 上配置第 2 层隧道协议 (L2TP) 隧道安全服务。
要配置 L2TP,请在层次结构级别上 [edit access]
包括以下语句:
[edit access] address-pool pool-name { address address-or-prefix; address-range low <lower-limit> high <upper-limit>; } group-profile profile-name { l2tp { interface-id interface-id; lcp-renegotiation; local-chap; maximum-sessions-per-tunnel number; ppp { cell-overhead; encapsulation-overhead bytes; framed-pool pool-id; idle-timeout seconds; interface-id interface-id; keepalive seconds; primary-dns primary-dns; primary-wins primary-wins; secondary-dns secondary-dns; secondary-wins secondary-wins; } } profile profile-name { authentication-order [ authentication-methods ]; accounting-order radius; client client-name { chap-secret chap-secret; group-profile profile-name; l2tp { interface-id interface-id; lcp-renegotiation; local-chap; maximum-sessions-per-tunnel number; ppp-authentication (chap | pap); shared-secret shared-secret; } pap-password pap-password; ppp { cell-overhead; encapsulation-overhead bytes; framed-ip-address ip-address; framed-pool framed-pool; idle-timeout seconds; interface-id interface-id; keepalive seconds; primary-dns primary-dns; primary-wins primary-wins; secondary-dns secondary-dns; secondary-wins secondary-wins; } user-group-profile profile-name; } } radius-disconnect-port port-number { radius-disconnect { client-address { secret password; } } } radius-server server-address { accounting-port port-number; port port-number; retry attempts; routing-instance routing-instance-name; secret password; source-address source-address; timeout seconds; } }