Unblock Netflix Using Raspberry as VPN Router

Buying Netflix doesnt allow you to watch all content, some content is blocked by country and accessible only to them, by changing your location you could solve this problem but all you need is raspberry pi, and Mininum 2Mbit/s connection(higher the better).

Following tutorial will guide to through whole procedure of unblocking Netflix content.

get fresh copy of Download Raspbian, now Flash the SD-card with new os using win32diskimager ,Once all this is done Boot  you Pi And login into with deflaut  username and password.

Static IP Address

Type this following command, Nano is editor and interfaces is the file that controls the network information about raspberry pi network interface.

sudo nano /etc/network/interfaces

paste this in editor  and press Cntrl+O and Enter.

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.4
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8 8.8.4.4

now the ip set  in the interface file but not actully set for the interface, to do so you need to reboot or restart networking services.

sudo reboot

now SSH into your pi using this  ip address 192.168.1.4, once you are logged in you can proceed futher.

Setup VPN Client

here we are goin to use OpenVPN client, you can use any client u like, OpenVPN is universal, it can be used with most of the vpn providers.

sudo apt-get install openvpn

Setup Forwarding and IPTables (routes)

To enable forwarding.

sudo nano /etc/sysctl.conf

uncomment the # to allow forwarding

net.ipv4.ip_forward = 1

you can enable the service by typing this command

sudo sysctl -p

IPTables Setup

IPTables this is best to just copy and paste this to your ssh session.

sudo iptables -A INPUT -i lo -m comment --comment "loopback" -j ACCEPT
sudo iptables -A OUTPUT -o lo -m comment --comment "loopback" -j ACCEPT
sudo iptables -I INPUT -i eth0 -m comment --comment "In from LAN" -j ACCEPT
sudo iptables -I OUTPUT -o tun+ -m comment --comment "Out to VPN" -j ACCEPT
sudo iptables -A OUTPUT -o eth0 -p udp --dport 1198 -m comment --comment "openvpn" -j ACCEPT
sudo iptables -A OUTPUT -o eth0 -p udp --dport 123 -m comment --comment "ntp" -j ACCEPT
sudo iptables -A OUTPUT -p UDP --dport 67:68 -m comment --comment "dhcp" -j ACCEPT
sudo iptables -A OUTPUT -o eth0 -p udp --dport 53 -m comment --comment "dns" -j ACCEPT
sudo iptables -A FORWARD -i tun+ -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o tun+ -m comment --comment "LAN out to VPN" -j ACCEPT
sudo iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE

let make sure to keep the rules persistent across reboots

sudo apt-get install iptables-persistent

the installer will ask to save the rules, select YES now if you have new rules you want to add, do

sudo netfilter-persistent save

now let’s apply this to startup

sudo systemctl enable netfilter-persistent

Now set raspberry IP address as gate on any device which you want to access it through VPN.

VPN Account Setup

Download this file

vpngate.py

Login into your Raspberry pi

sudo python vpngate.py US

change “US” to any country and you’ll be connected to that server.

here for example:

Japan	JP
  
Japan	JP
  
Sweden	SE
  

then you can setup your gateway as

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *