Dear all,
my home network is 192.168.2.0/24, and the known hosts are:
192.168.2.1 router
192.168.2.38 raspberry pi (aka openvpn server)
I followed some howto on the internet and successfully setup a VPN that lets me to connect to the raspberry. Anyway, all the internet traffic is tunneled throught the vpn and I am unable to ping the router.
This is my server.conf:
dev tun
proto udp
port 7794
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/server.crt
key /etc/openvpn/easy-rsa/keys/server.key
dh /etc/openvpn/easy-rsa/keys/dh1024.pem
user nobody
group nogroup
server 192.168.2.200 255.255.255.248
persist-key
persist-tun
status /var/log/openvpn-status.log
verb 3
client-to-client
push "redirect-gateway def1"
#set the dns servers
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
log-append /var/log/openvpn
comp-lzo
Moreover, I added this iptable rule:
@reboot iptables -t nat -A POSTROUTING -s 192.168.2.200/29 ! -d 192.168.2.0/24 -o eth0 -j MASQUERADE
I hoped, with this configuration, that a client joining the vpn could be a member of the original 192.168.2.0/24 network. Even removing "client-to-client" directive does not change anything.
I also commented the push "redirect-gateway def1", but no luck again.
My "goal" is to be able to join my home network as a real host connected to my router.
Moreover, I would like
not to tunnel my internet traffic (i.e., only the traffic directed to 192.168.2.0/24 go thourght the vpn).
My guess this is not the appropriate setup to gather my goal.
May I ask you some help on how to get there?
Many thanks in advance!
MJ