简单配置IGMP协议(#IGMPv2实验)
IGMP协议主要是组成员和路由器之间交互的一种协议,所以需要在路由与客户端相连的接口上进行相关配置。
图片.png
[R]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 1.1.1.1 24
Oct 10 2021 16:22:23-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]q
[R1]multicast routing-enable
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]igmp en
[R1-GigabitEthernet0/0/0]igmp enable
[R1-GigabitEthernet0/0/0]q
[R1]dis igmp int g0/0/0
Interface information of VPN-Instance: public net
GigabitEthernet0/0/0(1.1.1.1): #接口IP
IGMP is enabled IGMP协议已经启用
Current IGMP version is 2当前IGMP协议的版本号
IGMP state: up
IGMP group policy: none
IGMP limit: -
Value of query interval for IGMP (negotiated): -
Value of query interval for IGMP (configured): 60 s普通组查询的间隔,
Value of other querier timeout for IGMP: 0 s其他查询器失效时间
Value of maximum query response time for IGMP: 10 s 普通组查询最大响应时间
Querier for IGMP: 1.1.1.1 (this router)查询器接口IP
[R1]
图片.png
我们在R1的g0/0/0接口抓包,查看后
Frame 26: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface 0
Ethernet II, Src: HuaweiTe_03:6b:12 (00:e0:fc:03:6b:12), Dst: IPv4mcast_01 (01:00:5e:00:00:01)
Internet Protocol Version 4, Src: 1.1.1.1, Dst: 224.0.0.1
Internet Group Management Protocol
[IGMP Version: 2]
Type: Membership Query (0x11)(代表通用组查询报文,ox11)
Max Resp Time: 10.0 sec (0x64)最大响应时间10s
Checksum: 0xee9b [correct]校验和
[Checksum Status: Good]
Multicast Address: 0.0.0.0(查询的组地址,对于通用组查询报文来书,它是针对所有组做查询的,用0.0.0.0表示)
图片.png 图片.png
这里配置好目的ip后需要再次点击一下目的MAC,它会自动计算组播MAC地址01-00-5E,随后我们抓包就可以看到目的地址239.1.1.10的组收到了回复的报告报文。
图片.png
此时我们使用命令查看接收到了哪些组的报告
<R1>dis igmp group
Interface group report information of VPN-Instance: public net
GigabitEthernet0/0/0(1.1.1.1):在g/0/0口上
Total 1 IGMP Group reported一共有1个IGMP组报告
Group Address Last Reporter Uptime Expires
239.1.1.10报告组地址 0.0.0.0 成员地址 00:02:23 00:01:16
我们修改一下客户端的ip
图片.png
<R1>dis igmp group
Interface group report information of VPN-Instance: public net
GigabitEthernet0/0/0(1.1.1.1):
Total 1 IGMP Group reported
Group Address Last Reporter Uptime Expires
239.1.1.10 1.1.1.2 00:07:01 00:02:04
<R1>dis igmp routing-table
Routing table of VPN-Instance: public net
Total 1 entry
00001. (*, 239.1.1.10)
List of 1 downstream interface
GigabitEthernet0/0/0 (1.1.1.1),
Protocol: IGMP
表示任何收到239.1.1.10的流量都会向g0/0/0接口下发
现在我们进行离组实验,点击离开
图片.png
抓包查看
图片.png
但是我们查看发现目的地址是239.1.1.10,但是正确地应该是向224.0.0.2统一发送离组报文。继续看图,我们发现在离组报文发送后立即发送了指定组查询报文,随后以1s为间隔继续发送一次指定组查询报文。
修改其他参数
修改健壮系数为3,指定组查询的最大时间改为2s,
现象预测,指定组查询报文会以2s为间隔,6s内没有收到报告报文,就将这个组的表项删除
[R1-GigabitEthernet0/0/0]igmp robust-count 3
[R1-GigabitEthernet0/0/0]igmp lastmember-queryinterval 2
我们重新加组再离组
图片.png
验证成功!
实验前我们可以先关闭STP协议,在交换机上进行如下配置
[Huawei]stp disable
IGMPv1实验
下来我们使用igmpv1
首先我们要始终牢记,使用IGMPv2协议的时候需要先开启PIM协议,
[R1-GigabitEthernet0/0/0]pim dm
Error: Please disable IGMP first.
[R1-GigabitEthernet0/0/0]undo igmp enable
[R1-GigabitEthernet0/0/0]pim dm
[R1-GigabitEthernet0/0/0]igmp enable
[R1-GigabitEthernet0/0/0]igmp v 1
[R1-GigabitEthernet0/0/0]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0
ip address 1.1.1.1 255.255.255.0
pim dm
igmp enable
igmp version 1
igmp robust-count 3
igmp lastmember-queryinterval 2
#
return
[R1-GigabitEthernet0/0/0]
我们加入组
<R1>dis igmp group
Interface group report information of VPN-Instance: public net
GigabitEthernet0/0/0(1.1.1.1):
Total 1 IGMP Group reported
Group Address Last Reporter Uptime Expires
239.1.1.10 1.1.1.2 00:00:04 00:03:06
<R1>dis igmp ro
<R1>dis igmp routing-table
<R1>dis pim routing-table
VPN-Instance: public net
Total 1 (*, G) entry; 0 (S, G) entry
(*, 239.1.1.10)
Protocol: pim-dm, Flag: WC
UpTime: 00:01:18
Upstream interface: NULL
Upstream neighbor: NULL
RPF prime neighbor: NULL
Downstream interface(s) information:
Total number of downstreams: 1
1: GigabitEthernet0/0/0
Protocol: igmp, UpTime: 00:01:18, Expires: never
<R1>
只有group组,没有routing-table,而且当我们实验离开组织后,并不会立即删除这些表项,而是等到130s后才会删除
图片.png
接下来继续实验在PIM协议下的v2版本
[R1-GigabitEthernet0/0/0]igmp v 2
[R1]dis igmp group
Interface group report information of VPN-Instance: public net
GigabitEthernet0/0/0(1.1.1.1):
Total 1 IGMP Group reported
Group Address Last Reporter Uptime Expires
239.1.1.10 1.1.1.2 00:00:03 00:03:07
[R1]dis igmp group
Interface group report information of VPN-Instance: public net
GigabitEthernet0/0/0(1.1.1.1):
Total 1 IGMP Group reported
Group Address Last Reporter Uptime Expires
239.1.1.10 1.1.1.2 00:00:09 00:00:03
[R1]dis igmp group
[R1]dis igmp group
图片.png
为什么IGMP路由表时有时无呢?那是因为PIM协议的缘故,如果在IGMP v2和PIM共存的时候,路由表记录会存放在PIM routing-table上,如果只有IGMPv2,就会存放在IGMP routing-table上。
网友评论