I am trying to set up my RP3 in such a way that WiFi connections are routed over an L2TP VPN. I've got the VPN working and with the following settings all traffic is routed over the VPN connection (ppp0 is the VPN tunnel device):
route add VPN_PUBLIC_IP gw 192.168.1.1
route add default dev ppp0
However, as my title suggests, I want ONLY the WLAN traffic to be routed over the VPN connection. How do I achieve this? Below you will find some other settings that might help.
ifconfig:
root@raspberrypi:/home/pi# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.110 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::966b:f8b2:31f3:89c9 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:f0:e4:76 txqueuelen 1000 (Ethernet)
RX packets 151 bytes 13560 (13.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 132 bytes 20723 (20.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1280
inet 192.168.42.10 netmask 255.255.255.255 destination 192.168.42.1
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 4 bytes 70 (70.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 64 (64.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.220.1 netmask 255.255.255.0 broadcast 192.168.220.255
inet6 fe80::36c5:7f74:7936:c953 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:a5:b1:23 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 44 bytes 7290 (7.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
route:
root@raspberrypi:/home/pi# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 202 0 0 eth0
link-local 0.0.0.0 255.255.0.0 U 303 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
192.168.42.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.220.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
ip route:
default via 192.168.1.1 dev eth0 src 192.168.1.110 metric 202
169.254.0.0/16 dev wlan0 proto kernel scope link src 169.254.51.90 metric 303
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.110 metric 202
192.168.42.1 dev ppp0 proto kernel scope link src 192.168.42.10
192.168.220.0/24 dev wlan0 proto kernel scope link src 192.168.220.1
Any suggestions would be much appreciated!