Hello Forum!
Iran blocks sites like facebook and youtube. It also blocks OpenVPN connections. So I'm using Stunnel to prevent this. Im able to connect to my OpenVPN server which is located in Sweden from Iran without any problems by "tunneling" the OpenVPN traffic through Stunnel. However here is where the problem begins, No Internet access.
In order to get around the censorship, I need to redirect all Internet traffic to OpenVPN, using
push "redirect-gateway def1 bypass-dhcp"
Im using DD-WRT as a router, but my OpenVPN server is hosted on a FreeBSD "distro" called Nas4Free.
Quick summary
Internet -> Router(192.168.2.1) -> Nas4Free(192.168.2.10) -> OpenVPN(10.5.4.1)
When accessing the router via telnet, I'm able to ping the OpenVPN IP-pool, Also when connected to the OpenVPN server I'm able to ping my router, So the 192.168.2.x net can see the 10.5.4.x net, But I cannot access the Internet when I'm connected to the OpenVPN server.
I've enabled
gateway_enable="YES"
and
net.inet.ip.forwarding=1
On my Nas4Free machine.
I've also tried putting this firewall rule in my DD-WRT router without success.
iptables -t nat -A POSTROUTING -s 10.5.4.0/24 -o eth0 -j MASQUERADE
Nas4Free does not support NAT in the kernel, unlike FreeBSD that does have the support for it. But it has IPFW but it is turned off.
My OpenVPN server config
port 6521
mode server
tls-server
proto tcp-server
dev tun
client-cert-not-required
ca /usr/local/etc/openvpn/ca.crt
cert /usr/local/etc/openvpn/server.crt
key /usr/local/etc/openvpn/server.key
dh /usr/local/etc/openvpn/dh1024.pem
plugin /usr/local/lib/openvpn-auth-pam.so login
server 10.5.4.0 255.255.255.0
push "route 192.168.2.0 255.255.255.0"
push "dhcp-option DNS 192.168.2.1"
push "redirect-gateway def1 bypass-dhcp"
keepalive 10 120
cipher AES-128-CBC
comp-lzo
user root
group wheel
persist-key
persist-tun
verb 3
script-security 2
I appreciate any help I could get. Thanks for reading.