I have set up a pptp vpn to connect to another site, the link comes up and I can ping Internet sites and the vpn remote gateway, but not any hosts on the remote LAN. Basically, I want to set up a LAN-LAN vpn for traffic between the LANs and all other traffic to go the default local gw to Internet.
Local LAN: 192.168.11.0/24
Remote LAN: 192.168.1.0/24
`ip -o link show up` -->
...
11124: pptp-SCD_pptp01: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN qlen 3\ link/ppp
It is expected behavior.
The static routes that are bound to an interface will be erased when the interface goes down. You need to add this route with an if-up script, if there is no option in Luci.
It would be a better idea to leave pptp and go to Wireguard or Openvpn for site-to-site tunnels. Better security and you can automatically install routes.
"expected behavior", no, it is a deficiency: a design deficiency; a not yet implemented issue; or a bug. Beta behavior at best.
So, lets move this to a design recommendation list.
pptp is another issue which will be remedied later, however; this is probably a common denominator issue for any vpn that is used. An option that needs to be implemented.
So, looks like a if-up script is the only answer to my question at this stage. Hopefully, that will be mainline implemented, as a basic route or based on policy-based routing in the future.
I am having to re-visit this problem, for a pptp vpn and later an ip-sec vpn, but for now the pptp. I have added logger line into scripts at various locations, including /etc/hotplug.d/iface/, /etc/ppp/ without getting any log events/messages.
So, when a pptp vpn is brought up (usually via LuCi) and at other times via uci; what file if the location to add a few lines of script code to set routes for the vpn?
I need to automate this as much as possible, as vpn code is not adding the appropriate network route. Thence, removing the network route on closing down the vpn.
Device is like ppp0 as I understand
and via is ip for gateway like pppo0 ip
And why for server it is hotplug script with
Ip route 2
And for client it is ip tables ?
Client side interface is managed by netifd, since it supports the PPTP client protocol.
So, we can attach the route to the PPTP interface with native UCI syntax.
Server side interface is managed by pptpd.
Thus, we cannot rely on netifd, but need to use PPP scripts instead.
There is another problem when first client connects it has ppp0 interface and the script make right gw for it ( I made server ppp interface like gw for 44.0/24 )
But the second interface connects and gets ppp1 interface with default route through wan
I need only one route for any numbers of clients
Because if client router lost power and then up it will get new interface new ip address and I need that route to (44.0/24) working for it
#!/bin/sh
case ${IPREMOTE} in
(192.168.27.20) ip route add 192.168.44.0/24 dev ${IFNAME} via ${IPREMOTE} ;;
(192.168.27.21) ip route add 192.168.44.0/24 dev ${IFNAME} via ${IPREMOTE} ;;
esac
Did like this didn't work
Only for first one route was created
Maybe it needs some metric parametr or something