media

Your Own Smart DNS Proxy


Why do you need your own smart DNS proxy? Here is one reason. If you live in a country other than the US, you may find that popular media providers (like Netflix, Hulu etc.) may not serve you all the movies or TV shows in their library. This is because of copyright and licensing restrictions.

But as the Chinese proverb goes, every crisis is an opportunity. So there are Internet companies providing you with VPN or smart DNS services that trick the media providers into thinking that you are in another geographical location, allowing you to access a larger library.

If you have a VPS or a dedicated server, you can actually do this yourself. Here is how you can set up a simple smart DNS to serve yourself Netflix. Of course, once you set up your VPS this way, it will capture the http and https ports, and forward proxy it to the world. So you will not be serving your web content from the VPS.

I have a second VPS with this kind of smart DNS proxy, which I plan to sell on a subscription basis. If you are interested, set up a subscription, monthly or weekly. It gives you a trial period of two days, followed by a monthly rate of $4 or a weekly rate of $1.5, which is lower than the lowest rate I could find on the Internet. If you find one lower, please send me a link and I will reduce my rate (for everybody, not just you).

If you would rather set up one yourself on your own VPS, follow the steps below.

Build NGINX with SSL support

wget http://nginx.org/download/nginx-1.9.9.tar.gz
tar xvzf nginx-1.9.9.tar.gz
cd nginx-1.9.9
./configure --with-http_ssl_module
make install

Create config file with SSL

cd /usr/local/nginx/conf/
openssl req -new -x509 -nodes -out server.crt -keyout  server.key
chmod 600 server.key

Configure nginx by editing /usr/local/nginx/conf/nginx.conf
Enter the following

worker_processes  4;

events {
  worker_connections  1024;
}

http {
  include       mime.types;
  default_type  application/octet-stream;

  sendfile        on;
  keepalive_timeout  65;

  server {
    listen 80;

    location / {
        resolver 8.8.8.8;
        proxy_pass http://$http_host$uri$is_args$args;
    }
  }

  server {
    listen 443;
    ssl on;
    ssl_certificate server.crt;
    ssl_certificate_key server.key;

    location / {
        resolver 8.8.8.8;
        proxy_pass https://$http_host$uri$is_args$args;
    }
  }
}

Install/Configure dnsmasq

First, free up the port for DNS by killing named/bind.

service named stop

Configure dnsmasq by entering the following into /etc/dnsmasq.conf near the end (replace 192.168.1.1 with the public static IP address of your VPS).

address=/movies.netflix.com/192.168.1.1
address=/cbp-us.nccp.netflix.com/192.168.1.1
address=/moviecontrol.netflix.com/192.168.1.1

Start it all up

service dnsmasq start
service nginx start