I have a server with 1 interface bridged to tap0
. Also a client with 2 interfaces that have public Internet connection (eth1
and eth2
) and a tunnel for interface 2, so I can send traffic through tap0
and will actually send data through eth2
.
if I do
curl ifconfig.co
I get the public IP of eth1
. If I do
curl ifconfig.co --interface eth2
I get the public IP of eth2
, and if I do
curl ifconfig.co --interface tap0
I get the public IP of the server (it went through the tunnel, so everything is fine).
tap0
is in 192.168.0.0/24
subnet (the other ones are 192.168.1.0/24
and 192.168.3.0/24
, so no conflict here) and I can connect correctly to 192.168.0.1
, 192.168.0.22
(which is the server local IP) and etc.
I have set in the server router (192.168.0.1
) a redirection for the ports I need to the machine at 192.168.0.22
(iperf3, 80, OpenVPN and such).
In short, I think that I have everything working correctly up to this point.
The problem comes when I want to connect to the server public IP. Lets say the public IP is 1.2.3.4
through the VPN. If I do
curl 1.2.3.4
I get all the info I need, as the connection goes through eth1
to the server router, which redirects it to the local machine where the server sits. But if I do
curl 1.2.3.4 --interface tap0
NOTHING HAPPENS!
Checking client tap0
with tcpdump I can see that a request is created
But that request never reaches tap0
on the server (checked eth0 on the server for incoming OpenVPN UDP packets and no new packets arrive when this one is created in client tap0
). This is eth0
on the server when connecting to whatever else from client:
This becomes a decrypted packet on tap0
and needless to say that no decrypted packet appears on tap0
when no UDP packet appears there.
I don't know what is happening here. I thought that all packets that go through tap0
on the client will be sent to the server, without limitations, but this don't seem the case.
Also, if I go to the server machine 192.168.0.22
and do a curl to the public IP, I get a connect back to the web server and curl receives the result, so the server don't has problems connecting to itself.
What can I do so connections to my server public IP works when sent over tap0
?