Skip to content

Instantly share code, notes, and snippets.

@mislav mislav/
Last active Jul 31, 2019

What would you like to do?
Watch Netflix as if you were in the US by proxying DNS through a DigitalOcean instance.

Watch US Netflix content without a VPN

Update: this approach doesn't seem to work anymore since Netflix cracked down on it. Sorry!

This command-line script sets up a virtual server on DigitalOcean that acts as a DNS proxy. Then, it configures your computer to use that proxy. To Netflix, your traffic will appear as if it were coming from within the US.

DigitalOcean is ultimately a paid service. The maximum that running a virtual server will cost you is USD$5/month. You can destroy the instance while you're not using it, though. They're disposable.

If this setup sounds complicated, or you're on a platform other than OS X, or you're not comfortable with the technical terms discussed here, you might be better off using another service such as or the Hola Chrome extension.

This small tool is made possible by Anton Belodedenko's netflix-proxy which does most of the hard work.


  • Sign up for a DigitalOcean account. You will get some initial credit for free.
  • Mac OS X. The DNS configuration of your own system depends on a utility called networksetup.
  • Ruby (comes by default with OS X). The tugboat library is installable via RubyGems.
  • tugboat CLI client for DigitalOcean. Install with gem install tugboat && tugboat authorize


Install the script from this gist as an executable somewhere in your PATH:

curl -fsSL '' -o ~/bin/netflix
chmod +x ~/bin/netflix


# Create and configure the virtual server. This can take up to 5 minutes.
# You should be ready to watch Netflix after this is done.
netflix create

# Check the status of your current DNS configuration and of the server instance:
netflix status

# When you want to stop using DNS proxying (you should close Netflix first):
netflix off

# When you want to turn DNS proxying back on, or if
# you happened to switch to a different Wi-Fi network:
netflix on

# To destroy the virtual server and stop paying:
netflix destroy

Netflix has heuristics in place to eventually detect unblockers like these and blacklist them. If that happens (you will see a notice like "It seems like you're using an unblocker"), simply destroy the current instance and create a new one.

set -e
us_regions=( nyc1 nyc2 nyc3 )
random_region() {
echo ${us_regions[RANDOM % ${#us_regions[@]}]}
server_ip() {
[ -n "$_server_ip" ] || _server_ip="$(tugboat info --name="$droplet" --attribute=ip4 --porcelain)"
echo "$_server_ip"
add_client_ip() {
ssh "
set -x
sudo iptables -I FRIENDS -s ${1}/32 -j ACCEPT
iptables-save > /etc/iptables/rules.v4 || iptables-save > /etc/iptables.rules
sudo_warmup() {
sudo -v -p "Local root password (for changing DNS settings): "
tugboat() {
if command -v tugboat &>/dev/null; then
command tugboat "$@"
echo "Error: you need \`tugboat' to continue. To install:" >&2
echo " gem install tugboat" >&2
echo " tugboat authorize" >&2
return 1
ssh() {
command ssh "root@$(server_ip)" "$@"
status() {
echo -n "DNS: "
networksetup -getdnsservers "$interface"
tugboat info --name="$droplet"
on() {
add_client_ip "$(curl -fsS"
sudo networksetup -setdnsservers "$interface" "$(server_ip)"
off() {
sudo networksetup -setdnsservers "$interface" empty
create() {
key_id="$(tugboat keys | grep -o 'id: [0-9]\+' | head -1 | awk '{print $2}')"
if [ -z "$key_id" ]; then
echo "Error: no SSH keys stored in your DigitalOcean settings." >&2
echo "Please visit and use 'Add SSH key'." >&2
return 1
tugboat create "$droplet" --size 512mb --image docker --region "$(random_region)" --keys "$key_id" --ip6
tugboat wait --name="$droplet"
sleep 10
ssh "
set -x
git clone /opt/netflix-proxy
cd /opt/netflix-proxy
destroy() {
tugboat destroy --name="$droplet" --confirm
case "$1" in
ssh | status | on | off | create | destroy )
* )
echo "Unknown command. Please use one of: status on off create destroy ssh" >&2
exit 1

This comment has been minimized.

Copy link

carlevans459 commented Mar 25, 2019

Very useful information. By the way, I use Surfshark for unblocking Netflix, Hulu, BBC iPlayer etc. because I am a streaming lover and I cannot compromise with my online privacy. Surfshark provides me full security that's why I watch my favorite movies and TV shows hassle-free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.