1

I have PC2 connected to a VPN (L2TP/IPsec) server I have setup on R2. I need PC2 to be able to ping PC3 and PC4, but it's not working. When I use a Windows machine to connect to the VPN I can ping hosts under R2, but that is not the case with my Linux machine (Raspbian Jessie). I believe the solution has to do with the routing table but I have no idea what I am doing there.

I know that I am connected to R2 from PC2 because when I type 192.168.1.1 into the browser I am greeted with the remote router's login screen.

Networking diagram

PC2 is 192.168.1.125 under R1, and it is 192.168.1.69 under R2. The public IP for R2 is 76.73.240.120. Here is the current routing information:

root@raspberrypi:/home/pi# ip route show
default dev ppp0  scope link
default via 192.168.1.1 dev wlan0  metric 303
76.73.240.120 via 192.168.1.1 dev wlan0
192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.125  metric 303
192.168.1.1 dev ppp0  proto kernel  scope link  src 192.168.1.69

What do I need to do in order to get PC2 to be able to ping the hosts under R2?

1

This looks a mess! First things first, routers connect different networks together. As a simplification, if things are on the same network then they should be able to talk to each other directly. You have 2 networks 192.168.1.0/24. The simplest solution would be to renumber one of them (PC1, PC2, R1) to be 192.168.2.0/24.

Let us say that PC3 is on 192.168.1.10.

The reason it is a problem is that you have 3 rules for how to get to PC3, one of them because it matches the 192.168.1.0/24 and two because it matches the default rules which could also be written 0.0.0.0/0 (once via the ppp0 interface (the tunnel) and once via the wlan0 interface).

The rules are ranked in order, because 24 is more than 0 it is more specific, and hence is used.

So this routing table says that PC2 can communicate directly with PC3 via the wlan0 interface. so when you ping PC3 it uses your wireless card.

If you renumbered PC1, PC2 and R1 to be on the 192.168.2.0/24 network then the rules for where PC2 become much simpler. If the packet has to go to 192.168.2.0/24, then send it via wlan0, otherwise send it to 192.168.1.1 via ppp0.

To get to 192.168.1.1 there are 4 choices 0.0.0.0/0 via ppp0, 0.0.0.0/0 via wlan0, 192.168.1.0/24 via wlan0 and 192.168.1.1/32 via ppp0. The /32 route is the most specific and hence is chosen, which explains why you see R2.

You could add extra routes for PC3 and PC4, something like

ip route add 192.168.1.10/32 dev ppp0
ip route add 192.168.1.11/32 dev ppp0

and hope that R2 sorts things out enough to enable packets to come back, but renumbering is much simpler.

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.