megadofer
Hello,
I have configured OpenVPN Server and Client and it's working well.
OpenVPN Server is located on a fisical machine with hipotetic ip 192.168.3.5 address. When connection from client is established, client have a ip like 10.8.0.X and OpenVPN have 10.8.0.0. The machine and OpenVPN Mask is 255.255.255.0
Well, the question is I want that client only can be access to 192.168.3.5 but not to the rest of ip addresses 192.168.3.XXX and at the same time the client have to access to internet too.
Is this possible? how can i will do it?
Thanks,
george
Yes using iptables, but I you would have to allow the gateway IP as well:
iptables -A FORWARD -i tun0 -s 10.8.3.0/24 -d 192.168.3.5/32 -j ACCEPT
iptables -A FORWARD -i tun0 -s 10.8.3.0/24 -d x.x.x.x/32 -j ACCEPT (x.x.x.x = your network gateway IP)
iptables -A FORWARD -i tun0 -s 10.8.3.0/24 -d 192.168.1.151/32 -j ACCEPT
iptables -A FORWARD -i tun0 -s 10.8.3.0/24 -d 192.168.3.0/24 -j DROP
blakezeros
Hi,
I know this post is old but I would like to know if you were able to accomplish your setup. I'm trying to accomplish the same but I can't. I also did what george suggested but it doesnt work for me.
Basically, I want the openvpn client has access to my internet as it were his internet and block the client to my LAN. Below is my setup:
Home LAN: 192.168.1.0/24
Router/Switch: 192.168.1.2
OpenVPN server: 192.168.1.139
VPN network: 10.8.0.0/24
Server configuration:
proto udp
dev tun
ca ca.crt
cert openvpn-server.crt
key openvpn-server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 68.237.161.12"
push "dhcp-option DNS 71.250.0.12"
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3
Client Configuration:
client
dev tun
proto udp
remote 98.113.188.12 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert andres.crt
key andres.key
remote-cert-tls server
comp-lzo
verb 3
Thank you,