Score:0

How to route traffic with Linux

rw flag

I have a rather simple question, which I thought I knew the answer, but I'm stuck with it.

I have two linux boxes:

Server A :

  • IP : 10.10.19.1/24
  • Can contact 10.10.18.0/24 through an IPsec VPN (works fine)
  • ip forwarding set to 1

Server B :

  • IP : 10.10.19.55/24
  • One route has been added to reach 10.10.18.0/24 : => 10.192.18.0/24 via 10.192.19.1 dev ens8

Some facts :

  • Server B and Server A can ping each other
  • Server A can ping everything on 10.10.18.0/24

Problem : when I try to ping something in 10.10.18.0/24 from server B, I can see the ping going through the IPsec VPN and coming back on server A, but with the IP of server B, and the packet is not forwarded.

For example, if I try to ping 10.10.18.113 from Server B and I capture ICMP on Server A, I see something like:

source: 10.10.19.55
dest: 10.10.18.113
type: request

then

source: 10.10.18.113
dest: 10.10.19.55
type: reply

It's great, but since Server A is 10.10.19.1, I think it does not know what to do with that packet, and it's not forwarded toward 10.10.19.55 (Server B) neither.

I was sure it was something masquerade could do so I tried :

iptables -t nat -A POSTROUTING -s 10.10.19.0/24 -j MASQUERADE

On Server A, and I thought it would work but when I set this masquerade rule, but it looks like it does not change anything at all.

What am I missing ?

ws flag
Did you enable forwarding on server A? What are ALL the iptables rules on all the machines? Does 10.10.19.55 have a route back to 10.10.18.0/24?
DBCL avatar
rw flag
Except for all the iptables rules, the other questions are already answered in my original post. In short, yes the ip forwarding is enabled on A and yes there is a route toward 10.10.18.0/24 on B. If it was not the case, no ICMP packets would reach Server A when pinging 10.10.18.0/24 on server B. My packets are reaching server A, and even the IPsec tunnel. Coming back to server A and this is the last delivery part that does not happen. Just as if the forwarding was not enabled, but it is.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.