1

I want to establish a local communication between a client and a server using TUN interfaces.

  1. The client program will be attached to interface TUN1 and we suppose that it has IP address @IP1.

  2. The server program will be attached to interface TUN2 and we suppose that it has IP address @IP2.

  3. We must define routing rules so that packet with destination address IP2 (server's IP) will go through TUN2 and those with destination address IP1 (client's IP) wille go through TUN1 interface.

Rules example:

route add -net 10.2.0.0/24 dev tun2  #we suppose that the server's IP is in the subnet 10.2.0.0/24
route add -net 10.1.0.0/24 dev tun1  #the client's IP is in the subnet 10.1.0.0/24

I need to know the iptables chain that will be traversed by a packet sent from the client to the server.

From my understanding I think it should be this:

Client==TUN1--->(PREROUTING)--->Routing--->(FORWARD)--->Routing--->(POSTROUTING)--->TUN2==Server
  • I'd try adding a rule ... -j LOG to every chain I could find, run a short test, restore the original rules and then look at the log file. – Stefan Schmiedl Jun 12 '14 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.