iptables fun for VPN
I have managed to set up my openvpn server 90%.
If i disable iptables it connects properly but then i have no internet, but if i have it enabled, i cant connect to the vpn. I have the feeling it has somethign to do with these three lines from the tutorial i was following:
I take it the 10.8.0.0/24 is supposed to be my ip from the client in order to let me in? or perhaps it is supposed to be the ip of one of the two ethernet ports on the server. I know the server has a 50.*.*... eth0 ip that i ssh into it from and also has a 10.183.*.* eth1 port
Issue the following commands to configure iptables to properly forward traffic through the VPN:
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
iptables -A FORWARD -j REJECT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
If someone could explain in 'plain english' what those lines do I would be grateful and perhaps i could just figure it out. I really need to get a book in iptables. I know that I need it on otherwise I can connect to the vpn but my packets dont get forwarded to the outsid internet.
turns out that openvpn creates clients with ip 10.8.0.x where x changes so that explains that.
Just needed to have 'iptables -I INPUT -p tcp --dport 1194 -j ACCEPT' added to that tutorial.
Unfortunately my traffic still isnt getting correctly forwarded though... i have correctly set ip net forwarding to 1 in the sysctl file.