After two days of google and trial and error I don't know what to do next.
I successfully run an openvpn server incl. the option "push "redirect-gateway def1 bypass-dhcp"" on my raspberry pi since two years and can use it with my Android phone via mobile or wlan, i.e. Android_VPNClient===Internet_viaWLAN_or_4G===FritzBox-Router===Raspi1_VPN_Server_onlocal_Wlan
Now I want to create the following setup with a 2nd Pi: Raspi2_OpenVPNclient===UMTS Stick==="Internet"===FritzBox-Router===Raspi1_VPN_Server_onlocal_Wlan. Should be very similar, but does not fully work so far.
What works if "redirect-gateway def1 bypass-dhcp" is NOT activated in the server:
- Connect Raspi2 to internet via UMTS stick
- Avtivate tunnel into Rasp1
- Ping VPNserver under 10.8.0.1
What does not work if "redirect-gateway def1 bypass-dhcp" IS ACTIVATED in the server:
- connection to Raspi1 with openvpn server seems to be activated, but nothing else works afterwards:
- No ping to VPNserver under 10.8.0.1, no ping to internet... nothing....
Thank you very much for a hint, what the problem could be!
Background:
When starting the client I get this output and one strange error:
Code: Select all
[server] Peer Connection Initiated with [AF_INET]123.456.789.12:1194
SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 8.8.8.8,route 10.8.0.0 255.255.255.0,topology net30,ifconfig 10.8.0.6 10.8.0.5'
OPTIONS IMPORT: --ifconfig/up options modified
OPTIONS IMPORT: route options modified
OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
ROUTE_GATEWAY ON_LINK IFACE=ppp0 HWADDR=00:00:00:00:00:00
TUN/TAP device tun0 opened
TUN/TAP TX queue length set to 100
do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
/sbin/ip link set dev tun0 up mtu 1500
/sbin/ip addr add dev tun0 local 10.8.0.6 peer 10.8.0.5
/sbin/ip route add 123.456.789.12/32 via 0.0.0.0
ERROR: Linux route add command failed: external program exited with error status: 2
/sbin/ip route add 0.0.0.0/1 via 10.8.0.5
/sbin/ip route add 128.0.0.0/1 via 10.8.0.5
/sbin/ip route add 10.8.0.0/24 via 10.8.0.5
Initialization Sequence Completed
After this I have this route-n table:
Code: Select all
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.8.0.5 128.0.0.0 UG 0 0 0 tun0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0
10.8.0.0 10.8.0.5 255.255.255.0 UG 0 0 0 tun0
10.8.0.5 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
128.0.0.0 10.8.0.5 128.0.0.0 UG 0 0 0 tun0
BTW: Yes I have on both raspberries (server and client) the 2.3 version of openvpn. Yes I have ip-forward etc on server up and running... my android phone can still connect and routes all its traffic over vpn according to the "redirect-gateway" set-up