OpenVPN configuration on Ubuntu to share internet connection

2k views Asked by At

I am setting a OpenVPN server in US so my China team can connect to it to use google apps.

Now they can connect to the server, but still no google access.

Can anyone help me out? Anything else I need to configure on the server side?

The OS is: Ubuntu 14.04.1

Current openvpn config is:

port 1194
proto udp
dev tun
ca ca.crt
cert openvpn.crt
key  openvpn.key 
dh /etc/openvpn/dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt

;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
;server-bridge

push "redirect-gateway def1 bypass-dhcp"
keepalive 10 120
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3

I also enable ip_forwarding

root@ubuntu:/etc/openvpn# echo "1" > /proc/sys/net/ipv4/ip_forward
root@ubuntu:/etc/openvpn# more /proc/sys/net/ipv4/ip_forward
1

No firewall is enabled.

root@ubuntu:/etc/openvpn# ufw status
Status: inactive
1

There are 1 answers

0
Xarouma On BEST ANSWER

You need to set up NAT to share your connection to your VPN network :

iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

replace eth0 with your interface name and it should work