Dear Raspberry community,
I am using a raspberry with newest stretch version and facing a routing issue. My network:
Subnet mask 255.255.255.0
Default eth0 Gateway 192.168.178.1
(this network is connected to the raspberry)
Second available VPN Network (not yes used in Raspberry)
Subnet mask 255.255.255.0
Default eth0 Gateway 192.168.1.1
I want the setup like this: I want to access from all devices in my LAN to the raspberry (that already works perfect).
If it comes to internet (running updates in the raspberry or any other traffic caused my software in the raspberry) the (internet) traffic should be routed through the VPNLAN.
I think, therefore I have to add a routing and have as the only gateway the address of the vpnlan (192.168.1.1).
I am not an expert , tried some setting with route adding etc..nevertheless it did not work.
I added a route through the wan connection to the vpn network - that did not work. How can I connect to the vpn router through the eth0 (192.168.178.0/24) network.... I tried it like this:
ip route add 192.168.1.0/24 via 192.168.178.101 # (WAN 192.168.178.101 from LAN network).
I do not want to solve that for the entire network, just for the raspberry. How do I realize that, what kind of commands do I have to use here? How can I send internet bound traffic to the vpn router?
I now followed your advice and startet the vpn client on the raspberry. her is the output of the requested commands:
ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether b8:27:eb:19:cc:e0 brd ff:ff:ff:ff:ff:ff inet 192.168.178.35/24 brd 192.168.178.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::32a4:b141:4a75:79a2/64 scope link valid_lft forever preferred_lft forever 3: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100 link/none inet 10.16.33.194/24 brd 10.16.33.255 scope global tun0 valid_lft forever preferred_lft forever inet6 fe80::b3be:ceaf:ad86:696c/64 scope link flags 800 valid_lft forever preferred_lft forever > ip route 0.0.0.0/1 via 10.16.33.1 dev tun0 default via 192.168.178.1 dev eth0 src 192.168.178.35 metric 202 10.16.33.0/24 dev tun0 proto kernel scope link src 10.16.33.194 220.127.116.11/1 via 10.16.33.1 dev tun0 192.168.2.0/24 via 192.168.178.1 dev eth0 192.168.178.0/24 dev eth0 proto kernel scope link src 192.168.178.35 metric 202 213.152.028.210 via 192.168.178.1 dev eth0
Does that help...I want to make sure that the entire internet traffic is routed through the tun0 connection. Request from 192.168.2.0/24 should not be routet through the network and if tun0 is down, no internet connection should be possible immediately.
I have a local network (192.168.178.0/24) and a remote network (192.168.2.0/24) that are connected via a router vpn connection(2xfritzbox). It is possible that I reach every device from one to the other network - works great. My Raspberry is 192.168.178.35, has different software running and openvpn as well. i like to achieve that the ext. traffic from the raspberry to the internet is routet through the openvpn connection and everything else should stay, so that Rasp. can still be reached over the local networks ..
Is it possible at all? and how?
Thank you very much for your great help.
Warm regards Stefan