If you set the VPN up with
/etc/openvpn/server.conf
Code: Select all
port 1194
proto udp
dev tun0
dev-type tun
server 10.8.0.0 255.255.255.0
ifconfig 10.8.0.1 10.8.0.2
keepalive 10 120
comp-lzo
user openvpn
group openvpn
persist-key
persist-tun
log-append /var/log/openvpn.log
status /var/log/openvpn-status.log
verb 3
push "route 10.8.0.1 255.255.255.255"
push "route 10.8.0.0 255.255.255.0"
push "route 192.168.3.0 255.255.255.0"
push "dhcp-option DNS 192.168.3.14"
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
client-to-client
<ca>
-----BEGIN CERTIFICATE-----
insert certificate auth certificate here
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
insert server certificate here
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
insert private key here
-----END PRIVATE KEY-----
</key>
<dh>
-----BEGIN DH PARAMETERS-----
insert Diffie Hellman file here
-----END DH PARAMETERS-----
</dh>
And a client config
Code: Select all
client
dev tun
proto udp
remote openvpn-server.example.co.uk 1194 # can use a dotted decimal address
resolv-retry infinite
nobind
persist-key
persist-tun
remote-cert-tls server
comp-lzo
verb 3
<ca>
-----BEGIN CERTIFICATE-----
insert certificate auth certificate here
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
insert client certificate here
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN PRIVATE KEY-----
insert client private key here
-----END PRIVATE KEY-----
</key>
That gets you a routing tunnel, all remote traffic will reach the public internet appearing to originate from the servers location (using the server public IP address). [I've stripped out my IPv6 stuff that gets a globally unique routable IPv6 address pushed down the tunnel as well.
Once you do that you can also reach the local server at 10.8.0.1 and
http://10.8.0.1:9981 will get you to your TvHeadEnd server as long as it's running on the same machine as OpenVPN.
It gets ever more complex may need iptables masquerading if the OpenVPN and the TVHeadEnd are on seperate machines. Next time I'm in the pub on 14th for the monthly
SWAB Pi IG meeting I'll see what I can do with my OpenVPN and a raspberry running TvHeadEnd back at home.