Route all traffic by OpenVPN

In October i posted a blog about setting up your OpenVPN server in 2 minutes.

This blog is a addon to your existing configuration to route all traffic over the VPN. 

Change server configuration

go to the config file (/etc/openvpn/server.conf) and add the following lines:

push "redirect-gateway def1"
push "dhcp-option DNS "
push "dhcp-option DNS"

 Restart your OpenVPN daemon

sudo /etc/init.d/openvpn restart

Change client configuration

Change your client config, and add the following line

redirect-gateway def1

Change IP Tables

Last thing to do is change your iptables to NAT traffic to the internet. (make sure you have the right to do this or run this as root)

iptables -I FORWARD -i tun0 -o wlan0 \
         -s -m conntrack --ctstate NEW -j ACCEPT
iptables -I FORWARD -m conntrack --ctstate RELATED,ESTABLISHED \
         -j ACCEPT
iptables -t nat -I POSTROUTING -o wlan0 \
          -s -j MASQUERADE


  • tun0: your virtual VPN network interface
  • eth0: your normal network interface (to make sure you will use the right interface, check with “ifconfig”)
  • your VPN network IP range

OpenVPN in Kali Linux

This how to describes how to configure Kali to use a openVPN for securing your traffic.

Why should u use VPN?

Here’s my top 5 why you want to use a VPN service.

  1. VPN provides Privacy and hides your own External IP address.
  2. Use any network (public or private or free (hotspot WiFi) with encryption.
  3. Login to your home or Work network from anywhere with confidence of encrypted traffic.
  4. Bypass censorship and content monitoring  by goverments.
  5. Browse and bypass Firewall and censorship policy from Anywhere!

As you can see from the list above, VPN not necessarily hides everything. Search engines  like google, bing and yahoo can still recognizes you based on your cookies or account sign-in. So make sure you use tools like Bleachbit (clear browsing data etc) and enable plugins in your browser for tracking and ads (privacy badger, uBlock Origin).

In the example below i’m using IPVanish VPN service, there are lot’s more VPN services. If you really want to be sure of logging, security and availability you can use the comparison chart (click here).

Continue Reading