1

I'm trying to establish a VPN bridge between 2 embedded computers. VPN gets established correctly, however once tap0 interface gets created on the client's side, it creates a duplicate route:

192.168.127.0   *               255.255.255.0   U     0      0        0 tap0
192.168.127.0   *               255.255.255.0   U     0      0        0 eth0

here are the configuration of both interfaces:

eth0      Link encap:Ethernet  HWaddr 00:90:e8:44:76:1c
          inet addr:192.168.127.20  Bcast:192.168.127.255  Mask:255.255.255.0
          inet6 addr: fe80::290:e8ff:fe44:761c/64 Scope:Link
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:1578 errors:0 dropped:0 overruns:0 frame:0
          TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:141027 (137.7 KiB)  TX bytes:8351 (8.1 KiB)

tap0      Link encap:Ethernet  HWaddr a6:ed:36:87:50:12
          inet addr:192.168.127.50  Bcast:192.168.127.255  Mask:255.255.255.0
          inet6 addr: fe80::a4ed:36ff:fe87:5012/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:1380 (1.3 KiB)  TX bytes:468 (468.0 B)

What I'm trying to do is route traffic of devices connected to the client (in the same subnet as the client) to the server and eventually to a PC connected to the server. The server has the IP address 192.168.127.10 and the PC connected to it 192.168.127.200

With the current routing table, the server is unable to ping the client and vice versa.

Attempts to resolve the issue

  1. If I remove the eth0 route:

    192.168.127.0 0.0.0.0 255.255.255.0 U 5 0 0 tap0

    Ping Client's tap0 --> Server's tap0 : OK
    Ping Server's tap0 --> Client's tap0 : OK
    Ping Client's tap0 --> PC connected to server : OK
    Ping PC connected to server --> PC connected to client : FAIL
    Ping PC connected to server --> Client's tap0 : OK
    Ping PC connected to client --> Client's tap0 : FAIL
    Ping PC connected to client --> Server's tap0 : FAIL
    Ping PC connected to client --> PC connected to Server : FAIL
    
  2. Since the client is only supposed to reach 2 IP addresses on the server side, let's add static routes to these IPs & let normal traffic be handled by eth0:

192.168.127.0 * 255.255.255.0 U 5 0 0 eth0 192.168.127.10 * 255.255.255.255 UH 0 0 0 tap0 192.168.127.200 * 255.255.255.255 UH 0 0 0 tap0

notice the route priority!

Ping Client's tap0 --> Server's tap0 : FAIL
Ping Server's tap0 --> Client's tap0 : FAIL
Ping Client's tap0 --> PC connected to server : FAIL
Ping PC connected to server --> PC connected to client : FAIL
Ping PC connected to server --> Client's tap0 : FAIL
Ping PC connected to client --> Client's tap0 : OK
Ping PC connected to client --> Server's tap0 : FAIL
Ping PC connected to client --> PC connected to Server : FAIL

Any idea how to set up the routing table in my case?

0

Solved it.

I ended up simply bridging eth0 with tap0 on the client. This united both initial routes into a single route pointing to br0. Unlike the server, the interface bridging on the client's side must take place after the openvpn connection has been established!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.