Route all traffic to IPSEC/L2TP vpn

Hi folks,

I'm trying to connect openwrt router to ipsec/l2tp vpn.

I have succeed it but I do not know how I can redirect all traffic through the vpn.

I see the vpn ppp0 configured in ifconfig:

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:XX.XX.XX.X  P-t-P:XX.255.255.0  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1280  Metric:1
          RX packets:5 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:206 (206.0 B)  TX bytes:220 (220.0 B)

I can ping remote hosts if I add this rule:

ip route add XX.XX.XX.0/24 dev ppp0

But how I can force to redirect all traffic to through by the vpn?

Thanks.

You can use pbr package.

1 Like