通过 IP 黑白名单配置自定义 IP 黑/白名单及规则和内容,通过请求 IP 对请求进行过滤,实现访问限制,保护直播内容。
配置原理
配置 IP 白名单:只有配置的 IP 地址能够向云直播推流。
配置 IP 黑名单:只有配置的 IP 地址无法向云直播推流。
注意事项
IP 黑白名单配置完成后约10分钟生效。
IP 黑白名单配置成功后,直播中的流需断流重推才能生效。
前提条件
已开通云直播服务,并登录 云直播控制台。
已添加 推流域名。
配置 IP 黑白名单
1. 选择 域名管理,单击需要配置 IP 黑名单的推流域名或右侧的管理,进入域名管理页。![](https://qcloudimg.tencent-cloud.cn/image/document/90c965d079f469aadd86007b8139ae5b.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/90c965d079f469aadd86007b8139ae5b.png)
2. 在高级配置 > IP 黑白名单配置中,单击![](https://qcloudimg.tencent-cloud.cn/image/document/f37c7c558b82e8de2eccc1ab550048c6.png)
开启 IP 黑白名单。
![](https://qcloudimg.tencent-cloud.cn/image/document/f37c7c558b82e8de2eccc1ab550048c6.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/db6d66dd9d068f662a533779b0aa7582.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/db6d66dd9d068f662a533779b0aa7582.png)
3. 开启 IP 黑白名单后,进入 IP 黑白名单配置页,并进行如下配置:
![](https://qcloudimg.tencent-cloud.cn/image/document/2c27db0e20d7e3de7777a6db7b5fbdaf.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/2c27db0e20d7e3de7777a6db7b5fbdaf.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/679abebc3db66c8ebb23d86fa9caaae6.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/679abebc3db66c8ebb23d86fa9caaae6.png)
配置项 | 说明 |
鉴权类型 | 单击选择配置 IP 白名单或黑名单: 白名单和黑名单互斥,同一时间仅可生效一种。 若配置了 IP 白名单,则允许白名单内的 IP 地址访问,可请求到直播内容;拒绝白名单外的 IP 地址访问,无法请求直播内容。 若配置了 IP 黑名单,则拒绝黑名单内的 IP 地址访问,无法请求直播内容;允许黑名单外的 IP 地址访问,可请求到直播内容。 |
IP 名单 | IP 黑名单最多支持配置 200 条规则, IP 白名单最多支持配置 500 条规则。请使用换行符分隔。 支持 IP 及网段格式(/8/16/24),不支持 IP:端口格式。 暂不支持 IPv6。 |
4. 单击保存即可保存配置,配置需要一定时间才可生效。
![](https://qcloudimg.tencent-cloud.cn/image/document/bb64563137088b8267c8919472db7f66.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/bb64563137088b8267c8919472db7f66.png)
修改 IP 黑白名单
1. 选择 域名管理,单击需修改 IP 黑白名单配置的推流域名或右侧的管理 ,进入域名管理页。![](https://qcloudimg.tencent-cloud.cn/image/document/24620e5727564a65e1721b6bfa7f8ad0.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/24620e5727564a65e1721b6bfa7f8ad0.png)
2. 在高级配置 > IP 黑白名单配置中,单击编辑进入 IP 黑白名单配置页。
![](https://qcloudimg.tencent-cloud.cn/image/document/2049bf6e249e30554ef04b27aa80845d.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/2049bf6e249e30554ef04b27aa80845d.png)
3. 根据您的实际需求修改配置项信息,单击保存即可完成修改。
关闭 IP 黑白名单
开启 IP 黑白名单后,若您需关闭此功能,具体操作如下:
1. 选择 域名管理,单击需关闭 IP 黑白名单配置的推流域名或右侧的管理,进入域名管理页。![](https://qcloudimg.tencent-cloud.cn/image/document/a7509cbd67ad5850d25af4159119a700.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/a7509cbd67ad5850d25af4159119a700.png)
2. 在高级配置 > IP 黑白名单配置中,单击![img](https://qcloudimg.tencent-cloud.cn/image/document/afd953f369bb066476a16cadc8efc307.png)
,选择关闭 IP 黑白名单。
![](https://qcloudimg.tencent-cloud.cn/image/document/ce8c504d139d5e21f90e656ef8249b36.png)
![img](https://qcloudimg.tencent-cloud.cn/image/document/afd953f369bb066476a16cadc8efc307.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/ce8c504d139d5e21f90e656ef8249b36.png)