Skip to content

Instantly share code, notes, and snippets.

@frk1
Last active November 17, 2024 00:27
Show Gist options
  • Save frk1/8fb578b36bd9a36a48109f412c844a1f to your computer and use it in GitHub Desktop.
Save frk1/8fb578b36bd9a36a48109f412c844a1f to your computer and use it in GitHub Desktop.
Get Netflix IP ranges
# 2017-10-01T14:14:44+00:00
108.175.32.0/20
108.175.34.0/24
108.175.35.0/24
192.173.64.0/18
198.38.100.0/24
198.38.101.0/24
198.38.108.0/24
198.38.109.0/24
198.38.110.0/24
198.38.111.0/24
198.38.112.0/24
198.38.113.0/24
198.38.114.0/24
198.38.115.0/24
198.38.116.0/24
198.38.117.0/24
198.38.118.0/24
198.38.119.0/24
198.38.120.0/24
198.38.121.0/24
198.38.124.0/24
198.38.125.0/24
198.38.96.0/19
198.38.96.0/24
198.38.97.0/24
198.38.98.0/24
198.38.99.0/24
198.45.48.0/20
198.45.48.0/24
198.45.49.0/24
198.45.56.0/24
198.45.57.0/24
23.246.0.0/18
23.246.14.0/24
23.246.15.0/24
23.246.16.0/24
23.246.17.0/24
23.246.20.0/24
23.246.2.0/24
23.246.22.0/24
23.246.23.0/24
23.246.24.0/24
23.246.25.0/24
23.246.26.0/24
23.246.27.0/24
23.246.28.0/24
23.246.29.0/24
23.246.30.0/24
23.246.3.0/24
23.246.31.0/24
23.246.36.0/24
23.246.4.0/24
23.246.42.0/24
23.246.46.0/24
23.246.47.0/24
23.246.48.0/24
23.246.49.0/24
23.246.50.0/24
23.246.5.0/24
23.246.51.0/24
23.246.52.0/24
23.246.54.0/24
23.246.55.0/24
23.246.56.0/24
23.246.57.0/24
23.246.58.0/24
23.246.6.0/24
23.246.7.0/24
37.77.184.0/21
37.77.186.0/24
37.77.187.0/24
37.77.188.0/24
37.77.189.0/24
37.77.190.0/24
37.77.191.0/24
45.57.0.0/17
45.57.1.0/24
45.57.11.0/24
45.57.14.0/24
45.57.15.0/24
45.57.16.0/24
45.57.17.0/24
45.57.18.0/24
45.57.19.0/24
45.57.20.0/24
45.57.2.0/24
45.57.21.0/24
45.57.22.0/24
45.57.23.0/24
45.57.3.0/24
45.57.36.0/24
45.57.37.0/24
45.57.4.0/24
45.57.42.0/24
45.57.44.0/24
45.57.45.0/24
45.57.48.0/24
45.57.49.0/24
45.57.5.0/24
45.57.54.0/24
45.57.55.0/24
45.57.58.0/24
45.57.59.0/24
45.57.60.0/24
69.53.225.0/24
207.45.72.0/22
207.45.73.0/24
45.57.40.0/24
45.57.8.0/23
45.57.8.0/24
45.57.9.0/24
192.173.64.0/24
192.173.65.0/24
192.173.66.0/24
192.173.67.0/24
192.173.68.0/24
208.75.76.0/24
69.53.230.0/24
69.53.231.0/24
69.53.233.0/24
69.53.235.0/24
69.53.240.0/24
69.53.241.0/24
69.53.242.0/24
69.53.245.0/24
69.53.246.0/24
69.53.254.0/24
# 2017-10-01T14:14:44+00:00
2607:fb10:7071::/48
2620:10c:7000::/44
2620:10c:7002::/48
2620:10c:7008::/48
2a00:86c0:1002::/48
2a00:86c0:1003::/48
2a00:86c0:100::/48
2a00:86c0:1008::/48
2a00:86c0:1009::/48
2a00:86c0:1010::/48
2a00:86c0:1011::/48
2a00:86c0:1012::/48
2a00:86c0:1013::/48
2a00:86c0:1016::/48
2a00:86c0:1017::/48
2a00:86c0:1018::/48
2a00:86c0:1021::/48
2a00:86c0:1022::/48
2a00:86c0:1023::/48
2a00:86c0:1024::/48
2a00:86c0:1025::/48
2a00:86c0:1026::/48
2a00:86c0:1027::/48
2a00:86c0:1034::/48
2a00:86c0:1046::/48
2a00:86c0:1047::/48
2a00:86c0:1048::/48
2a00:86c0:1049::/48
2a00:86c0:1050::/48
2a00:86c0:1051::/48
2a00:86c0:1052::/48
2a00:86c0:1054::/48
2a00:86c0:1055::/48
2a00:86c0:1056::/48
2a00:86c0:1057::/48
2a00:86c0:108::/48
2a00:86c0:109::/48
2a00:86c0:110::/48
2a00:86c0:111::/48
2a00:86c0:112::/48
2a00:86c0:113::/48
2a00:86c0:114::/48
2a00:86c0:115::/48
2a00:86c0:116::/48
2a00:86c0:117::/48
2a00:86c0:118::/48
2a00:86c0:119::/48
2a00:86c0:120::/48
2a00:86c0:121::/48
2a00:86c0:124::/48
2a00:86c0:125::/48
2a00:86c0:126::/48
2a00:86c0:127::/48
2a00:86c0:2002::/48
2a00:86c0:2003::/48
2a00:86c0:2004::/48
2a00:86c0:2005::/48
2a00:86c0:2011::/48
2a00:86c0:2014::/48
2a00:86c0:2015::/48
2a00:86c0:2016::/48
2a00:86c0:2017::/48
2a00:86c0:2018::/48
2a00:86c0:2019::/48
2a00:86c0:2020::/48
2a00:86c0:2021::/48
2a00:86c0:2036::/48
2a00:86c0:2037::/48
2a00:86c0:2042::/48
2a00:86c0:2044::/48
2a00:86c0:2045::/48
2a00:86c0:2048::/48
2a00:86c0:2049::/48
2a00:86c0:2051::/48
2a00:86c0:2054::/48
2a00:86c0:2055::/48
2a00:86c0:2058::/48
2a00:86c0:2059::/48
2a00:86c0:2060::/48
2a00:86c0:2677::/48
2a00:86c0::/32
2a00:86c0:39bc::/48
2a00:86c0:39bd::/48
2a00:86c0:4::/48
2a00:86c0:5::/48
2a00:86c0:600::/48
2a00:86c0:601::/48
2a00:86c0:7002::/48
2a00:86c0:98::/48
2a00:86c0:99::/48
2a00:86c0:a2a6::/48
2a00:86c0:a2a7::/48
2a00:86c0:ff0a::/48
2a00:86c0:ff0b::/48
2a00:86c0:2008::/47
2a00:86c0:2008::/48
2a00:86c0:2009::/48
2a00:86c0:2040::/48
2607:fb10:16::/48
2607:fb10:31::/48
2607:fb10:45::/48
2607:fb10:46::/48
2607:fb10:5011::/48
2607:fb10:7011::/48
2607:fb10:7020::/44
2607:fb10:7035::/48
2607:fb10:7038::/48
2607:fb10:7040::/44
2607:fb10:7060::/44
#!/usr/bin/env bash
set -e
# This command finds the ASNUMs owned by netflix
curl -s http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum2.zip | gunzip | cut -d"," -f3 | sed 's/"//g' | sort -u | grep -i netflix
# For the four ASNUMs currently in possession of netflix that would be:
whois -h whois.radb.net -- '-i origin AS2906' | grep -Eo "([0-9.]+){4}/[0-9]+" | tee netflix_ranges.txt \
&& whois -h whois.radb.net -- '-i origin AS394406' | grep -Eo "([0-9.]+){4}/[0-9]+" | tee netflix_ranges.txt \
&& whois -h whois.radb.net -- '-i origin AS40027' | grep -Eo "([0-9.]+){4}/[0-9]+" | tee netflix_ranges.txt \
&& whois -h whois.radb.net -- '-i origin AS55095' | grep -Eo "([0-9.]+){4}/[0-9]+" | tee netflix_ranges.txt
# Done!
@angristan
Copy link

@tynyt
Copy link

tynyt commented May 4, 2019

As Netflix is using Amazon AWS too (https://blog.thousandeyes.com/how-netflix-tracks-ip-addresses-within-aws/), you might want to use those IP ranges as well.
https://aws.amazon.com/blogs/aws/aws-ip-ranges-json/

I have updated the IPv4 script in a somehow clumsy way to accomodate all these ranges, allowing them to be used for policy routing.

#!/bin/bash
# Gather Netflix and Amazon AWS IP ranges and put them into single file

set -e
if [ -e getflix.txt ] ; then rm getflix.txt ; fi
# This command finds the ASNUMs owned by netflix
curl -s https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN-CSV.zip >nflix.zip
for as in $(unzip -p nflix.zip `unzip -l nflix.zip |grep -e GeoLite2-ASN-Blocks-IPv4.csv | sed 's/^.\{30\}//g'` | grep -i netflix | cut -d"," -f2 | sort -u)
    do
    whois -h whois.radb.net -- '-i origin AS'$as | grep -Eo "([0-9.]+){4}/[0-9]+" | tee netflix_ranges.txt >>getflix.tmp
done

# Get the Amazon AWS ip range list
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json |grep ip_prefix |cut -d"\"" -f4 >>getflix.tmp

# unify both the IP address ranges
cat getflix.tmp | sort -u >getflix.txt
#tidy the tempfiles
rm nflix.zip
rm getflix.tmp

Yet to confirm: this list is definitely NOT complete, as there are ISPs who transparently cache the Netflix traffic - greetings to O2 Czech/ IP 194.228.248.66, so you have to investigate by yourself.

@corredor28
Copy link

Now you have to change the first curl line to:

curl -s 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN-CSV&license_key=YOUR_LICENSE_KEY&suffix=zip' >nflix.zip

@scarpy71
Copy link

@corredor28 Hi! Where can I find the license key ? Thanks, Alex

@bartbroere
Copy link

I have made an updated list of Netflix IP's (not using the MaxMind database). Doing this I've also noticed the original list contains some fully overlapping ranges, for example the top two:

from ipaddress import ip_network
ip_network('108.175.34.0/24').subnet_of(ip_network('108.175.32.0/20'))
# returns True

At first glance it therefore might seem that some entries from the original list are missing, but they are probably still in the list of ranges below:

IPv4 ranges

108.175.32.0/20
12.195.36.0/28
12.195.36.16/30
12.235.240.0/26
125.16.4.104/29
125.16.7.180/30
13.52.146.148/30
13.52.200.128/29
13.52.32.4/30
138.121.136.28/30
138.121.139.228/30
138.121.75.192/30
138.121.75.204/30
138.121.75.212/30
149.14.198.184/29
149.14.76.24/29
149.14.76.40/29
149.38.0.128/29
149.6.23.184/29
152.194.23.128/28
153.143.174.232/29
154.18.19.32/29
154.18.2.176/29
154.18.8.176/29
160.72.195.88/29
173.11.70.224/29
177.129.160.232/30
177.129.160.52/30
177.43.225.232/29
177.84.111.32/30
177.87.64.64/30
179.189.48.240/30
18.204.64.128/25
18.232.1.0/29
18.232.233.16/28
18.232.233.32/27
18.232.233.64/27
18.233.213.0/27
18.233.213.32/29
18.234.32.24/29
18.236.4.152/29
18.236.4.160/27
180.189.15.8/30
185.2.220.0/23
185.2.222.0/23
185.9.188.0/22
189.125.15.232/30
189.125.38.8/29
192.173.64.0/18
194.244.37.128/28
195.110.92.168/29
195.235.152.200/29
198.38.96.0/19
198.45.48.0/20
199.36.132.124/30
200.175.6.80/29
201.49.80.96/27
201.49.81.96/27
206.249.0.32/29
207.45.72.0/22
208.251.216.0/27
208.252.12.80/28
208.253.182.96/29
208.255.245.80/28
208.64.176.88/29
208.75.76.0/22
209.131.254.0/28
209.133.7.80/28
212.124.243.128/25
212.146.63.152/29
212.46.111.0/30
212.59.50.72/29
212.59.50.80/29
213.141.104.112/29
213.146.71.176/28
213.212.128.24/29
213.246.233.160/29
216.168.119.0/29
216.35.131.128/25
217.111.110.176/29
23.246.0.0/18
3.227.250.32/29
3.248.216.64/29
3.91.171.32/27
34.195.253.0/25
34.210.91.8/29
34.211.108.48/29
34.216.110.0/27
34.216.110.32/28
34.216.226.0/26
34.216.24.24/29
34.216.67.128/25
34.217.141.144/29
34.217.141.48/28
34.218.119.184/29
34.218.119.192/26
34.218.216.0/29
34.223.14.80/29
34.223.199.16/29
34.223.37.176/28
34.223.37.192/28
34.226.36.120/29
34.226.36.8/29
34.226.36.96/29
34.231.44.176/29
34.238.188.16/28
34.238.188.8/29
34.238.195.128/25
34.239.145.0/27
34.241.204.128/28
34.241.204.176/28
34.241.204.192/29
34.241.204.32/28
34.241.204.64/26
34.245.205.144/28
34.245.205.192/26
34.245.240.136/29
34.245.240.144/28
34.245.240.160/28
34.253.190.80/28
34.255.102.48/28
35.168.231.64/26
35.83.248.72/29
37.77.184.0/23
37.77.186.0/23
37.77.188.0/22
38.104.115.208/29
38.104.138.200/29
38.104.163.136/29
38.104.182.80/29
38.104.211.0/29
38.140.136.240/29
38.140.200.224/29
38.140.58.200/29
38.142.225.96/29
38.142.245.136/29
38.142.246.88/29
38.32.89.184/29
38.88.189.216/29
38.88.239.96/29
38.88.252.144/29
38.88.54.72/29
44.192.255.208/29
44.205.24.72/29
45.57.0.0/17
52.13.255.0/26
52.13.255.128/26
52.13.255.64/27
52.19.255.128/27
52.19.255.192/26
52.193.127.128/26
52.200.127.224/27
52.200.60.128/26
52.200.60.64/26
52.200.61.128/25
52.200.61.64/26
52.200.62.0/24
52.200.63.0/29
52.200.63.8/31
52.202.127.224/27
52.202.63.224/27
52.206.190.192/26
52.209.127.224/27
52.209.191.192/27
52.210.127.240/28
52.215.192.120/29
52.215.218.80/28
52.215.218.96/29
52.215.254.0/29
52.35.127.224/27
52.37.63.240/28
52.4.255.96/27
52.40.126.128/25
52.40.126.64/26
52.40.127.0/24
52.40.61.0/26
52.40.63.64/26
52.42.191.192/26
52.43.255.192/29
52.49.127.240/28
52.49.255.224/27
52.51.191.128/27
52.51.191.96/27
52.51.253.224/27
52.51.254.128/26
52.51.254.224/27
52.51.255.32/27
52.51.63.128/25
52.51.63.32/27
52.51.63.64/26
52.52.127.240/28
52.52.58.224/27
52.53.205.160/27
52.53.205.192/26
52.53.206.0/24
52.53.63.128/25
52.53.63.64/26
52.70.191.160/27
52.70.63.96/27
52.8.191.0/25
52.86.127.192/26
52.9.127.152/29
52.9.63.192/29
52.9.63.48/28
52.90.37.120/29
52.90.38.0/29
54.149.234.144/29
54.152.255.244/30
54.153.127.208/30
54.153.187.0/30
54.154.254.180/30
54.154.254.96/29
54.165.127.248/29
54.171.187.232/29
54.171.191.176/29
54.173.62.176/29
54.178.191.8/30
54.183.122.252/30
54.183.123.160/27
54.183.123.192/26
54.183.255.88/29
54.183.61.240/30
54.199.124.8/29
54.201.217.32/30
54.203.243.0/29
54.203.243.64/26
54.207.255.128/29
54.213.255.200/29
54.213.255.224/30
54.215.244.216/29
54.215.255.124/30
54.215.255.52/30
54.217.200.128/28
54.218.127.176/29
54.219.190.218/31
54.219.190.220/30
54.219.191.176/29
54.227.235.64/28
54.227.235.96/27
54.229.122.68/30
54.229.126.184/30
54.232.40.0/26
54.235.159.224/27
54.236.250.128/26
54.236.251.24/30
54.237.252.0/26
54.237.252.64/27
54.241.189.0/25
54.241.191.60/30
54.244.239.192/27
54.244.49.128/29
54.244.54.224/29
54.244.54.248/30
54.244.55.128/26
54.244.55.192/27
54.244.88.0/27
54.244.88.80/28
54.246.251.156/30
54.64.33.164/30
54.64.43.56/30
54.64.94.220/30
54.67.63.40/30
54.68.42.68/30
54.68.46.192/29
54.69.19.128/30
54.72.209.4/30
54.75.255.192/26
54.77.127.216/29
54.77.177.88/30
54.77.191.248/29
54.77.255.216/29
54.82.128.64/26
54.82.134.80/28
54.84.114.220/30
54.84.7.252/30
54.85.240.164/30
54.85.41.64/30
54.88.127.224/27
54.88.41.252/30
54.89.245.208/28
61.95.142.120/29
62.165.151.80/29
62.183.204.120/29
62.72.124.232/29
63.110.110.56/29
63.78.148.48/28
63.79.208.96/27
63.82.148.80/28
63.87.98.240/28
63.99.147.0/28
64.120.128.0/17
64.14.10.0/24
64.14.30.0/24
64.41.202.0/24
65.196.64.48/29
65.199.214.144/28
65.204.153.80/28
65.204.220.80/28
65.207.248.232/29
65.208.93.0/27
65.210.83.240/28
65.211.124.48/28
65.215.228.16/28
65.218.134.192/28
65.242.93.56/29
65.243.23.144/28
66.197.128.0/17
67.23.56.88/29
67.71.226.64/29
69.53.224.0/20
69.53.240.0/21
69.53.248.0/24
69.53.249.0/24
69.53.250.0/23
69.53.252.0/23
69.53.254.0/24
69.53.255.0/24
69.75.51.192/29
75.17.166.40/29
80.169.78.160/29
80.69.16.156/30
80.69.8.192/28
83.102.33.192/29
83.102.33.224/29
92.70.251.56/30
98.152.166.80/29
98.153.198.244/30
98.154.40.128/29

IPv6 ranges

2001:1890:16fa:eb00::/56
2001:1890:1c1d:ba00::/56
2001:1890:1c1d:be00::/56
2001:1890:1c1d:c200::/56
2001:1890:1c1d:cd00::/56
2001:1890:1c1d:ce00::/56
2001:1890:1c1d:d000::/53
2001:1890:1c1d:d800::/54
2001:1890:1c1d:ec00::/56
2001:1890:1c1e:5100::/56
2001:1890:1c1e:7300::/56
2001:1890:1c1e:b100::/56
2001:1890:1c1e:b200::/55
2001:1890:1c1e:d300::/56
2001:1890:1c1e:d400::/56
2001:1890:1c48:ef00::/56
2001:1890:1c48:f000::/55
2001:918:fffa::/48
2600:5c00:421b::/48
2600:5c00:4788::/48
2607:fb10:2000::/44
2607:fb10:2010::/48
2607:fb10:2011::/48
2607:fb10:2012::/48
2607:fb10:2013::/48
2607:fb10:2014::/47
2607:fb10:2016::/47
2607:fb10:2018::/45
2607:fb10:2020::/43
2607:fb10:2040::/42
2607:fb10:2080::/41
2607:fb10:2100::/40
2607:fb10:2200::/39
2607:fb10:2400::/38
2607:fb10:2800::/37
2607:fb10:3000::/36
2607:fb10:4000::/34
2607:fb10:8000::/33
2607:fb10::/35
2620:0:ef0::/48
2620:10c:7000::/44
2a00:86c0::/32
2a02:560:1000:114::/63
2a03:5640::/32

@poldemo
Copy link

poldemo commented Mar 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment