Cloudflare IP ranges
- IPv4 ranges
- 15
- IPv6 ranges
- 7
- Last change
- 06.12.2026
- Last check
- 06.12.2026
One range per line, IPv4 first, then IPv6.
Add the lines to a server or location block. The last line blocks every other address.
Add the lines to an .htaccess file or a Directory block. Access is allowed only from the addresses in the list.
The rules allow TCP connections to ports 80 and 443 from the addresses in the list, with iptables and ip6tables.
The rules allow TCP connections to ports 80 and 443 from the addresses in the list. IPv6 ranges work when IPV6=yes is set in /etc/default/ufw.
The commands create a separate zone named cloudflare, allow TCP connections to ports 80 and 443 in it from the addresses in the list, and reload the configuration.
Add the lines to /etc/csf/csf.allow and restart the firewall with csf -r. The lines allow TCP connections to ports 80 and 443, and IPv6 ranges work when the IPV6 option is enabled in csf.conf.
The rules allow TCP connections to ports 80 and 443 from the addresses in the list. The inet filter table and the input chain must already exist.
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
104.16.0.0/13
104.24.0.0/14
108.162.192.0/18
131.0.72.0/22
141.101.64.0/18
162.158.0.0/15
172.64.0.0/13
173.245.48.0/20
188.114.96.0/20
190.93.240.0/20
197.234.240.0/22
198.41.128.0/17
2400:cb00::/32
2405:8100::/32
2405:b500::/32
2606:4700::/32
2803:f800::/32
2a06:98c0::/29
2c0f:f248::/32Why your server needs the Cloudflare addresses
When your site runs through Cloudflare, every request reaches the server from the addresses in the list, not from the visitors themselves. So the list serves two purposes: blocking direct access to the server that bypasses Cloudflare and its protections, and restoring the real IP address of each visitor in your logs, your stats, and your site's security tools.
Direct access to the server is possible when someone finds its IP address, for example in an old DNS record. Restrict ports 80 and 443 to the addresses in the list with one of the ready-made formats above, and restrict the other ports, such as SSH, separately. The commands for this are in UFW commands and CSF commands.
Showing the real visitor IP behind Cloudflare
Cloudflare adds the CF-Connecting-IP header with the visitor's address to every request. In nginx, set the Cloudflare addresses as trusted in the realip module and tell it to read this header, and in Apache, do the same with mod_remoteip. Make sure you trust only the addresses in the list, otherwise any visitor can send a forged header and show up in your logs with a different address.
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/13;
set_real_ip_from 104.24.0.0/14;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2a06:98c0::/29;
set_real_ip_from 2c0f:f248::/32;
real_ip_header CF-Connecting-IP;RemoteIPHeader CF-Connecting-IP
RemoteIPTrustedProxy 103.21.244.0/22
RemoteIPTrustedProxy 103.22.200.0/22
RemoteIPTrustedProxy 103.31.4.0/22
RemoteIPTrustedProxy 104.16.0.0/13
RemoteIPTrustedProxy 104.24.0.0/14
RemoteIPTrustedProxy 108.162.192.0/18
RemoteIPTrustedProxy 131.0.72.0/22
RemoteIPTrustedProxy 141.101.64.0/18
RemoteIPTrustedProxy 162.158.0.0/15
RemoteIPTrustedProxy 172.64.0.0/13
RemoteIPTrustedProxy 173.245.48.0/20
RemoteIPTrustedProxy 188.114.96.0/20
RemoteIPTrustedProxy 190.93.240.0/20
RemoteIPTrustedProxy 197.234.240.0/22
RemoteIPTrustedProxy 198.41.128.0/17
RemoteIPTrustedProxy 2400:cb00::/32
RemoteIPTrustedProxy 2405:8100::/32
RemoteIPTrustedProxy 2405:b500::/32
RemoteIPTrustedProxy 2606:4700::/32
RemoteIPTrustedProxy 2803:f800::/32
RemoteIPTrustedProxy 2a06:98c0::/29
RemoteIPTrustedProxy 2c0f:f248::/32After the change, test the configuration with nginx -t or apachectl configtest, and reload the server. When the site shows an error from 520 to 526, the cause is usually on the origin server, and the full explanation is in common Cloudflare errors. Our packages for connecting a site to Cloudflare are on the Cloudflare services page.
- This list is published by Cloudflare in an official file, and we check it every week. The service is not affiliated with ErezNet.
- On a Linux VPS, you get full root access and configure the firewall and the web server yourself with these lists.
Cloudflare IP ranges FAQ
How do I allow access to my server only through Cloudflare?
Add a rule to your server's firewall that allows ports 80 and 443 only for the addresses in the list, and block all other addresses. The ready-made formats on this page, such as nginx, iptables, UFW, and firewalld, save you the work. When the list changes, update your rules too.
How do I show the real visitor IP behind Cloudflare?
The server receives requests from the Cloudflare addresses, and the visitor's address arrives in an HTTP header. Set the addresses in the list as trusted, for example in the nginx realip module or in Apache mod_remoteip, and your logs and site show the visitor's address.
How often is the list on this page updated?
We check the official Cloudflare file once a week and update the page when something changes. The date of the last check is at the top of the page, and the recent changes are at the bottom.