Share internet with openVPN [closed]
Question
I have setup a openVPN server on my centOS server. What I would like to do is use the internet of this centOS server form my macbook
On my mac i have installed and perfectly configured tunnelblick (i have imported the client.conf + the appropriate cert..) And im able to connect to my VPN server
But if a try to go on website that show my IP it doesn't work, I still have my local internet IP address. I would like to have the one of my server. How do i do that?
Thank you
La solution
To do what you want you don't need to use a VPN... I suppose your server has openSSH. SO what you can do is a SSH tunnel
ssh -D login:server 1080:localhost:1080
The in your broswer config, set the "socks" to localhost:1080
try to go on http://whatsmyip.com and bingo all the trafic on your server will be redireected to yours machine
Autres conseils
There are some changes to do in CentOS:
First, forwarding needs to be active on the CentOS server:
sysctl -w net.ipv4.ip_forward=1
sysctl -p /etc/sysctl.conf
Change the gateway to the LAN gateway. In OpenVPN configuration put:
push "redirect-gateway def1"
And the DNS:
push "dhcp-option DNS 192.168.1.2"
And finally, use NAT/MASQUERADE for the VPN network (output to Internet via eth0)
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE