大网数据广告活动
服务器运维问答

Whitelist an Individual's IPv6 Range via .htaccess

· 52CE 我爱测

I have a section on a website that blocks access to all IPs, except for those that are whitelisted. For IPv4, this is very simple, because even with dynamic IPs, they generally won't changed for months, or even years. However, wi…

问题原文

原帖链接 · IPv6Quest · CC BY-SA 4.0

I have a section on a website that blocks access to all IPs, except for those that are whitelisted. For IPv4, this is very simple, because even with dynamic IPs, they generally won't changed for months, or even years.

However, with IPv6, these seem to alternate every 24 hours or so. This means that I can't simply whitelist the initial IPv6 IP and call it good, because it'll just change again too quickly. Therefore, I need to whitelist a whole range. Even after reading about and testing IPv6 over the past couple of days, I'm still not confident I've got a handle on it.

Here's what I've got:

order deny,allow
allow from 1234:123:4567:ab1::/64
deny from all

The first 4 sections of the IP address never change, but the last 4 sections constantly change. Is this the correct way to whitelist an individual's IP in this context?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

With IPv6 you have to start thinking in terms of subnets, rather than individual IP addresses. A /64 subnet is allocated to a physical LAN (or VLAN) and hosts in that subnet may be assigned addresses in that subnet in a variety of ways, and may change them arbitrarily if configured to do so (e.g. privacy addresses).

It is not possible to be certain that two different IPv6 addresses in a subnet correspond to the same machine, but you can be reasonably sure that a given IPv6 /64 corresponds to a subnet and of course all of the hosts in it.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-03-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。