B
B
Ba An Doan2018-10-23 20:16:23
linux
Ba An Doan, 2018-10-23 20:16:23

How to set up persistent reverse routing using ip route?

- There is a VPN server 192.168.42.1
- VPN clients (mikrotik branches) have static IPs 192.168.42.0/24
- An application is running behind the VPN server that requires reverse routing, i.e. obtaining access to the client's local network.
But, since the clients may not be permanent (the connection fell off, the Internet ended, Baba Zina washed the floor, etc.), the route may fall off after the clients disconnect, and, after a reverse connection, the routes are not restored, you have to manually restart write ip route add 192.168.3.0/24 via 192.168.42.2
How can I set up a permanent route for these clients so that routes are saved or restored after reconnection?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Ruslan Fedoseev, 2018-10-24
@doanbaanh

On the vpn server, in the /etc/ppp/if-up and /etc/ppp/if-down scripts, add / remove routes, depending on the client. man ppp

D
Dmitry Shitskov, 2018-10-23
@Zarom

Looks like it's a job for dynamic routing. Set up ospf on mikrotik and vpn server (quagga, bird).

D
Denis Sechin, 2018-10-24
@tamogavk

root if route | grep -q 10.11.12.0 ; then:; else if ping -qW1 -c1 172.18.203.139 >/dev/null; then route add -net 10.11.12.0 netmask 255.255.255.0 gw 172.18.203.139; fi; fi in crown

I
Ingvar, 2018-10-25
@take

On an iota, the connection constantly fell off ..

#!/bin/bash
 && route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.50.225 dev ppp0 && echo "reUP!"

I did watch -n10 this_script, well, or in cron, yes. here it’s just that vpn didn’t always raise it, so it was easier with hands. Not perfect, but in a bouquet for a change
ps
I have a rare distro and the /etc/ppp/if-up described above did not work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question