The others are here:
1) OpenVPN server only connects local clients
2) How to copy OpenVPN Connect logfiles?
I want to summarize the state I am in right now:
- My OpenVPN server is installed on a Raspberry Pi running the Raspbmc distribution
- It is clearly not completely configured (see below) after mixing several tutorials and forum advice posts
- I can connect just fine using my Android OpenVPN Connect app (both from the mobile network and from a WiFi network)
- While I am connected I can FTP to my server (the Raspberry Pi) using an Android FTP client and the local address 192.168.0.150
- But I cannot reach my local FTP server or the Internet
I have followed a few tutorials on setting up the OpenVPN server and got to a situation where I could connect but then do basically nothing...
File edits:
I have the following in my server.conf file:
Code: Select all
local 192.168.0.150
dev tun
proto udp
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/BBOpenVPN.crt
key /etc/openvpn/easy-rsa/keys/BBOpenVPN.key
dh /etc/openvpn/easy-rsa/keys/dh1024.pem
server 10.8.0.0 255.255.255.0
#ifconfig 10.8.0.1 10.8.0.2
push "route 10.8.0.1 255.255.255.255"
push "route 10.8.0.0 255.255.255.0"
push "route 192.168.0.0 255.255.255.0"
push "dhcp-option DNS 192.168.0.129"
push "redirect-gateway def1"
#client-to-client
duplicate-cn
keepalive 10 120
tls-auth /etc/openvpn/easy-rsa/keys/ta.key 0
cipher AES-128-CBC
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn-status.log 20
log /var/log/openvpn.log
verb 4
Here I have the following:
Code: Select all
iptables -A INPUT -s $NETMASK -i $IFACE -j ACCEPT
iptables -t nat -A INPUT -i eth0 -p udp -m udp --dport 1194 -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
#iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j SNAT --to-source 192.168.0.150
iptables -I INPUT -p udp -m udp --dport 1194 -j ACCEPT
iptables -A INPUT -i $IFACE -j DROP
Finally /etc/sysctl.conf contains this:
Code: Select all
net.ipv4.ip_forward=1
vm.panic_on_oom = 0
vm.dirty_expire_centisecs = 1000
vm.dirty_writeback_centisecs = 1500
kernel.random.write_wakeup_threshold=128
kernel.random.read_wakeup_threshold=32
kernel.random.poolsize=512
kernel.random.entropy_avail=4096
vm.min_free_kbytes=16384
vm.swappiness=10
If I can't get this running soon I think I have to switch to a different solution like using DD-WRT on a compatible router.
In fact today I bought a D-Link DIR-615 (which is compatible with DD-WRT) only to find that its Ethernet ports were broken.
So I have to get a replacement tomorrow.
DD-WRT firmware for the routers contain both a PPTP and an OpenVPN server ready to be configured through a web interface.
Seems much easier to do, but it has one drawback and that is that I have to replace my existing router if I want to get access to my NAS.
The existing router is much newer than the 615 and has a gigabit Ethernet connection, which I would rather keep.
So I really want to keep the Pi as the server.