Netflix Gateway – DNS solution aka Look what I cobbled together

netflix-logo

Disclaimer

This information is provided as is without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. In no event shall the author be liable for any damages whatsoever including direct, indirect, incidental consequential, loss of business profits, or special damages.
I do not profess that I am a Linux guru or that this setup will even work for you. As a matter of fact its likely that by the time your read this its out of date and probably does not work anymore.

The Project

I only set this up  as a learning experience, I saw people offering this service for around USD $5/month and thought to myself ” If there a re several hosts offering this service I can build it… VPS‘s are cheap”. So I set out to get something working.

 The Ingredients

For this cake to bake all nice and fluffy you will need the following:

  • A VPS thats close to you. I would recommend ChicagoVPS. At the time of writing you could get a decent VPS close to you for around USD $10/year. Please use this referral link and help me out.
  • Linux (For this project I chose Debian Wheezy 7.0)
  • DNS Server – I chose Bind9 (installed and configured).
  • Proxy Server – HAProxy (installed and configured).
  • A static IP address
  • Maybe some other stuff I will add when I remember

You are going to need some kind of text editor, my editor of choice for this is nano
For this tutorial I am probably going to take some shortcuts and if you don’t get something or can’t follow my instructions then its probably going to better that you find another tutorial.
First of all make sure you OS is up to date

apt-get update && apt-get upgrade

If you don’t have nano installed

apt-get install nano

Edit /etc/bind/named.conf.local

include “/etc/bind/rndc.key”;
include “/etc/bind/zones.override”;
acl “trusted” {
xxx.xxx.xxx.xxx; // Internal IPv4 Address of your VPS
127.0.0.1; // Internal Loopback IP
xxx.xxx.xxx.xxx ;// Your home internets IP address
};

Edit /etc/bind/zones.override

zone “hulu.com.” {
type master;
file “/etc/bind/db.override”;
};
zone “huluim.com.” {
type master;
file “/etc/bind/db.override”;
};
zone “netflix.com.” {
type master;
file “/etc/bind/db.override”;
};

 Edit /etc/bind/db.override

You will need to replace xxx.xxx.xxx.xxx with the IP of your VPS.

;
; BIND data file for overridden IPs
;
$TTL  86400
@   IN  SOA ns1 root (
2015030401  ; serial
604800      ; refresh 1w
86400       ; retry 1d
2419200     ; expiry 4w
86400       ; minimum TTL 1d
)
@   IN  NS  ns1
ns1 IN  A   xxx.xxx.xxx.xxx
@   IN  A   xxx.xxx.xxx.xxx
*   IN  A   xxx.xxx.xxx.xxx

Edit /etc/bind/named.conf.options

options {
directory “/var/cache/bind”;
forwarders {
# these are the DNS servers from the VPS provider (look in /etc/resolv.$
8.8.8.8;
};
auth-nxdomain no;    # conform to RFC1035
listen-on-v6 { any; };
allow-query { trusted; };
allow-recursion { trusted; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
};

Pending

Proxy setup pending…..
 

By arkique