1

I have a Raspberry PI 2, running several servers (FTP, SSH, HTTP… etc).
I started using it as a wireless router (forward tap0 connection to wlan0); I used this great tutorial. Everything is working great.

When I installed OpenVPN and connected to it, can share my VPN connection to Wi-Fi clients and it’s working well; can access to servers too. But using the VPN’s public IP, can’t connect to my servers but ping is working.

It might be some routing problem, but I can’t figure out what.

The routing table:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.4.1.1        128.0.0.0       UG    0      0        0 tap0
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
default         10.4.1.1        0.0.0.0         UG    512    0        0 tap0
10.4.1.0        *               255.255.255.0   U     0      0        0 tap0
128.0.0.0       10.4.1.1        128.0.0.0       UG    0      0        0 tap0
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
192.168.150.0   *               255.255.255.0   U     0      0        0 wlan0
rxkk.vekoll.uni 192.168.0.1     255.255.255.255 UGH   0      0        0 eth0

Loaded IP table:

# Generated by iptables-save v1.4.14 on Fri Oct  2 00:01:10 2015
*filter
:INPUT ACCEPT [447645:303647899]
:FORWARD ACCEPT [31:2073]
:OUTPUT ACCEPT [388590:80274564]
-A FORWARD -i wlan0 -o tap0 -j ACCEPT
-A FORWARD -i tap0 -o wlan0 -j ACCEPT
COMMIT
# Completed on Fri Oct  2 00:01:10 2015
# Generated by iptables-save v1.4.14 on Fri Oct  2 00:01:10 2015
*nat
:PREROUTING ACCEPT [11041:767122]
:INPUT ACCEPT [2671:258110]
:OUTPUT ACCEPT [385:27556]
:POSTROUTING ACCEPT [253:17828]
-A POSTROUTING -o tap0 -j MASQUERADE
COMMIT

I’d be happy if someone can help me.

2 Answers 2

0

But using the VPN’s public IP, can’t connect to my servers but ping is working.

Your public IPs are not part of your VPN .. you need to port forward the service ports of your services to the correct service IP address.

This has nothing to do with your VPN

0
0

Finally, managed to solve this, it was too obvious.

The problem was this 2 lines:

default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
default         10.4.1.1        0.0.0.0         UG    512    0        0 tap0

The connection come in tap0 interface, but the response is send to the lower metric interface, to eth0. Changing the default gateway solved my problem.

3
  • What about your 1st self answer ? It was correct or do you understand (how?) that it was not that?
    – Hastur
    Oct 3, 2015 at 20:42
  • I don't even know. I changed this, and solved my problem, but somehow a kernel update was the solution. Updated, and everything is working, with the same settings.
    – user504310
    Oct 5, 2015 at 5:14
  • @Schzolee, what did you change the default gateway to ? Does this look similar to you : superuser.com/questions/1317976/…. I have updated the kernel, but that did not solve the problem for me.
    – Gautam
    May 1, 2018 at 14:30

You must log in to answer this question.