示例:在与语音 VLAN 共享接口的数据 VLAN 上配置 IP 源保护
以太网 LAN 交换机容易受到涉及欺骗(伪造)源 IP 地址或源 MAC 地址的攻击。这些欺骗性数据包是从连接到交换机上不受信任接入接口的主机发送的。您可以在 EX 系列交换机上启用 IP 源保护端口安全功能,以减轻此类攻击的影响。如果 IP 源保护确定传入数据包中绑定中的源 IP 地址和源 MAC 地址无效,则交换机不会转发数据包。
如果两个 VLAN 共享一个接口,则只能在其中一个 VLAN 上配置 IP 源保护;在此示例中,您将在未标记的数据 VLAN 上配置 IP 源保护,但不在标记的语音 VLAN 上配置 IP 源保护。您可以使用 802.1X 用户身份验证来验证数据 VLAN 上的设备连接。
此示例介绍如何在数据 VLAN 上使用 802.1X 用户身份验证配置IP 源保护,并在同一接口上使用语音 VLAN:
要求
此示例使用以下硬件和软件组件:
一台 EX 系列交换机
适用于 EX 系列交换机的 Junos OS 9.2 或更高版本
DHCP 服务器,用于向交换机上的网络设备提供 IP 地址
提供 802.1X 身份验证的 RADIUS 服务器
在为数据 VLAN 配置 IP 源保护之前,请确保您已:
已将DHCP服务器连接到交换机。
已将RADIUS服务器连接到交换机,并在服务器上配置用户身份验证。请参阅 示例:将 802.1X 的 RADIUS 服务器连接到 EX 系列交换机。
已配置VLAN。有关配置 VLAN 的详细信息,请参阅 示例:为 EX 系列交换机设置与多个 VLAN 的桥接 。
概述和拓扑
IP 源保护检查从连接到交换机上不受信任接入接口的主机发送的数据包中的 IP 源地址和 MAC 源地址。如果 IP 源保护确定数据包标头包含无效的源 IP 地址或源 MAC 地址,则会确保交换机不会转发数据包,即丢弃数据包。
配置 IP 源保护时,可以在一个或多个 VLAN 上启用该保护。IP 源保护将其检查规则应用于这些 VLAN 上不受信任的接入接口。默认情况下,在 EX 系列交换机上,接入接口不受信任,中继接口受信任。IP 源保护不会检查连接到中继接口或可信接入接口(即配置了 DHCP 可信 接口的接口)的设备发送到交换机的数据包,以便 DHCP 服务器可以连接到该接口以提供动态 IP 地址。
IP 源保护从 DHCP 侦听数据库中获取有关 IP 地址/MAC 地址/VLAN 绑定的信息。它会导致交换机根据该数据库中的条目验证传入的 IP 数据包。
拓扑学
此示例的拓扑包括一台 EX-3200-24P 交换机、一台 PC 和一部在同一接口上连接的 IP 电话、一个与 DHCP 服务器的连接,以及一个与 RADIUS 服务器进行用户身份验证的连接。
此示例中应用的 802.1X 用户身份验证适用于单个请求方。
您还可以将 IP 源保护与 802.1X 用户身份验证配合使用,以实现单安全请求方或多请求方模式。如果要在单安全请求方或多请求方模式下实施具有 802.1X 身份验证的 IP 源保护,则必须使用以下配置准则:
如果 802.1X 接口是未标记的基于 MAC 的 VLAN 的一部分,并且您希望在该 VLAN 上启用 IP 源保护和 DHCP 侦听,则必须在该接口具有未标记成员资格的所有动态 VLAN 上启用 IP 源保护和 DHCP 侦听。
如果 802.1X 接口是基于 MAC 的标记 VLAN 的一部分,并且您希望在该 VLAN 上启用 IP 源保护和 DHCP 侦听,则必须在该接口已标记成员资格的所有动态 VLAN 上启用 IP 源保护和 DHCP 侦听。
出于调试目的,可以在语句中 traceoptions (Access Port Security)
设置 ip-source-guard 标志。
此示例说明如何配置要添加到 DHCP 侦听数据库的静态 IP 地址。
配置
程序
CLI 快速配置
要在数据 VLAN 上快速配置 IP 源保护,请复制以下命令并将其粘贴到交换机终端窗口中:
set ethernet-switching-options voip interface ge-0/0/14.0 vlan voice set ethernet-switching-options secure-access-port interface ge-0/0/24.0 dhcp-trusted set ethernet-switching-options secure-access-port interface ge-0/0/14 static-ip 10.1.1.1 mac 00:11:11:11:11:11 vlan data set ethernet-switching-options secure-access-port vlan data examine-dhcp set ethernet-switching-options secure-access-port vlan data ip-source-guard set interfaces ge-0/0/24 unit 0 family ethernet-switching vlan members data set vlans voice vlan-id 100 set protocols lldp-med interface ge-0/0/14.0 set protocols dot1x authenticator authentication-profile-name profile52 set protocols dot1x authenticator interface ge-0/0/14.0 supplicant single
分步过程
要在数据 VLAN 上配置 IP 源保护,请执行以下操作:
配置 VoIP 接口:
[edit ethernet-switching-options] user@switch# set voip interface ge-0/0/14.0 vlan voice
将 DHCP 服务器连接到交换机的接口配置为可信接口,并将该接口添加到数据 VLAN:
[edit ethernet-switching-options] user@switch# set secure-access-port interface ge-0/0/24.0 dhcp-trusted [edit interfaces] user@switch# set ge-0/0/24 unit 0 family ethernet-switching vlan members data
在数据 VLAN 上的接口上配置静态 IP 地址(可选)
[edit ethernet-switching-options] user@switch# set secure-access-port interface ge-0/0/14 static-ip 10.1.1.1 mac 00:11:11:11:11:11 vlan data
在数据 VLAN 上配置 DHCP 侦听和 IP 源保护:
[edit ethernet-switching-options] user@switch# set secure-access-port vlan data examine-dhcp user@switch# set secure-access-port vlan data ip-source-guard
在数据 VLAN 和语音 VLAN 共享的接口上配置 802.1X 用户身份验证和 LLDP-MED:
[edit protocols] user@switch# set lldp-med interface ge-0/0/14.0 user@switch# set dot1x authenticator authentication-profile-name profile52 user@switch# set dot1x authenticator interface ge-0/0/14.0 supplicant single
设置语音 VLAN 的 VLAN ID:
[edit vlans] user@switch# set voice vlan-id 100
结果
检查配置结果:
[edit ethernet-switching-options] user@switch# show voip { interface ge-0/0/14.0 { vlan voice; } } secure-access-port { interface ge-0/0/14.0 { static-ip 10.1.1.1 vlan data mac 00:11:11:11:11:11; } interface ge-0/0/24.0 { dhcp-trusted; } vlan data { examine-dhcp; ip-source-guard; } }
[edit interfaces] ge-0/0/24 { unit 0 { family ethernet-switching { vlan { members data; } } } }
[edit vlans] voice { vlan-id 100; }
[edit protocols] lldp-med { interface ge-0/0/14.0; } dot1x { authenticator { authentication-profile-name profile52; interface { ge-0/0/14.0 { supplicant single; } } } }
如果要在语音 VLAN 和数据 VLAN 上配置 IP 源保护,则应像配置数据 VLAN 一样配置 DHCP 侦听和 IP 源保护。 安全访问端口 下语音 VLAN 的配置结果如下所示:
secure-access-port { vlan voice { examine-dhcp; ip-source-guard; } }
验证
要确认配置工作正常,请执行以下任务:
验证接口上的 802.1X 用户身份验证是否正常工作
目的
验证接口 ge-0/0/14 上的 802.1X 配置。
行动
使用操作模式命令 show dot1x interface
验证 802.1X 配置:
user@switch> show dot1x interface ge-0/0/14.0 detail ge-0/0/14.0 Role: Authenticator Administrative state: Auto Supplicant mode: Single Number of retries: 3 Quiet period: 60 seconds Transmit period: 30 seconds Mac Radius: Disabled Mac Radius Restrict: Disabled Reauthentication: Enabled Configured Reauthentication interval: 3600 seconds Supplicant timeout: 30 seconds Server timeout: 30 seconds Maximum EAPOL requests: 2 Guest VLAN member: <not configured> Number of connected supplicants: 1 Supplicant: user101, 00:04:0f:fd:ac:fe Operational state: Authenticated Authentication method: Radius Authenticated VLAN: vo11 Dynamic Filter: <not configured> Session Reauth interval: 60 seconds Reauthentication due in 50 seconds
意义
请求方模式输出字段显示为每个接口配置的管理模式。接口 ge-0/0/14.0 显示单一请求方模式。
验证 VLAN 与接口的关联
目的
显示接口状态和 VLAN 成员资格。
行动
user@switch> show ethernet-switching interfaces Ethernet-switching table: 0 entries, 0 learned user@switch> show ethernet-switching interfaces Interface State VLAN members Blocking ge-0/0/0.0 down default unblocked ge-0/0/1.0 down employee unblocked ge-0/0/2.0 down employee unblocked ge-0/0/12.0 down default unblocked ge-0/0/13.0 down default unblocked ge-0/0/13.0 down vlan100 unblocked ge-0/0/14.0 up voice unblocked data unblocked ge-0/0/17.0 down employee unblocked ge-0/0/23.0 down default unblocked ge-0/0/24.0 down data unblocked employee unblocked vlan100 unblocked voice unblocked
意义
VLAN 成员字段显示 ge-0/0/14.0 接口同时支持数据 VLAN 和语音 VLAN。“状态”字段显示接口已启动。
验证 DHCP 侦听和 IP 源保护是否在数据 VLAN 上正常工作
目的
验证 DHCP 侦听和 IP 源保护已启用且正在处理数据 VLAN。
行动
从连接到交换机的网络设备(此处为 DHCP 客户端)发送一些 DHCP 请求。
当 DHCP 服务器连接到交换机的接口受信任时,显示 DHCP 侦听信息。当从 MAC 地址发送请求并且服务器已提供 IP 地址和租约时,将产生以下输出:
user@switch> show dhcp snooping binding DHCP Snooping Information: MAC address IP address Lease (seconds) Type VLAN Interface 00:05:85:3A:82:77 192.0.2.17 600 dynamic employee ge-0/0/1.0 00:05:85:3A:82:79 192.0.2.18 653 dynamic employee ge-0/0/1.0 00:05:85:3A:82:80 192.0.2.19 720 dynamic employee ge-0/0/2.0 00:05:85:3A:82:81 192.0.2.20 932 dynamic employee ge-0/0/2.0 00:30:48:92:A5:9D 10.10.10.7 720 dynamic vlan100 ge-0/0/13.0 00:30:48:8D:01:3D 10.10.10.9 720 dynamic data ge-0/0/14.0 00:30:48:8D:01:5D 10.10.10.8 1230 dynamic voice ge-0/0/14.0 00:11:11:11:11:11 10.1.1.1 — static data ge-0/0/14.0 00:05:85:27:32:88 192.0.2.22 — static employee ge-0/0/17.0 00:05:85:27:32:89 192.0.2.23 — static employee ge-0/0/17.0 00:05:85:27:32:90 192.0.2.27 — static employee ge-0/0/17.0
查看数据 VLAN 的 IP 源保护信息。
user@switch> show ip-source-guard IP source guard information: Interface Tag IP Address MAC Address VLAN ge-0/0/13.0 0 10.10.10.7 00:30:48:92:A5:9D vlan100 ge-0/0/14.0 0 10.10.10.9 00:30:48:8D:01:3D data ge-0/0/14.0 0 10.1.1.1 00:11:11:11:11:11 data ge–0/0/13.0 100 * * voice
意义
当 DHCP 服务器连接到交换机的接口设置为受信任时,输出(请参阅前面的示例 show dhcp snooping binding
输出)会显示每个 MAC 地址的分配 IP 地址和租用时间,即租约到期前剩余的时间(以秒为单位)。静态 IP 地址没有分配租用时间。静态配置的条目永不过期。
IP 源保护数据库表包含启用 IP 源保护的 VLAN、这些 VLAN 上的不受信任接入接口、VLAN 802.1Q 标记 ID(如果有)以及相互绑定的 IP 地址和 MAC 地址。如果交换机接口与多个 VLAN 关联,并且其中一些 VLAN 启用了 IP 源保护,而另一些则未启用 IP 源保护,则未启用 IP 源保护的 VLAN 在 IP 地址 和 MAC 地址 字段中有一个星号 (*)。请参阅上述示例输出中 语音 VLAN 的条目。