Reply To: Zeroshell 2RC3 and Static Route Down.

Home Page Forums Network Management ZeroShell Zeroshell 2RC3 and Static Route Down. Reply To: Zeroshell 2RC3 and Static Route Down.

#52883

redfive
Participant

For temporarily overcome this issue , I added few lines as cron-job.
let briefly describe the topology :
SiteA , vpn-server , lan 192.168.192.0/27 (must be reachable from SiteB) , tunnell ip address 10.10.10.1/30.
SiteB , vpn-client , lan 192.168.196.0/24 (must be reachable from SiteA) , tunnell ip address 10.10.10.2/30.
On both sites , I haven’t added any static routes, instead I created one (two*) cron-job ,add_route_vpn, wich is launched every minute (ten minutes*). On siteA

# Bash script: add_route_vpn-Cron
if route -n | grep '^192.168.196.0' ; then
exit ;
else
if ping -q -c 1 10.10.10.2; then
route add -net 192.168.196.0 netmask 255.255.255.0 gw 10.10.10.2 metric 1 ;
fi
fi

while , on siteB

# Bash script: add_route_vpn-Cron
if route -n | grep '^192.168.192.0' ; then
exit ;
else
if ping -q -c 1 10.10.10.1; then
route add -net 192.168.192.0 netmask 255.255.255.224 gw 10.10.10.1 metric 1 ;
fi
fi

The routes are added just after that the vpn is up , and in the routing table are marked as auto.
*Actually , I’ve added a second cron-job , otherwise the previous cron , rapidly fills the Scripts log . These second cron-job are launched every ten minutes , and clears the previous logs . Be careful about hostname , mine are server01 (vpn-server) and server02 (vpn-client) , so on SiteA

# Bash script: clear_log-Cron
year="$(date | awk '{print $NF}')" ;
month="$(date | awk '{print $(NF-4)}')" ;
day="$(date | awk '{print $(NF-3)}')" ;
sed --in-place '/VPN00/d' /Database/LOG/$year/$month/$day/server01/Scripts
sed --in-place '/add_route_vpn/d' /Database/LOG/$year/$month/$day/server01/Scripts

on siteB

# Bash script: clear_log-Cron
year="$(date | awk '{print $NF}')" ;
month="$(date | awk '{print $(NF-4)}')" ;
day="$(date | awk '{print $(NF-3)}')" ;
sed --in-place '/VPN00/d' /Database/LOG/$year/$month/$day/server02/Scripts
sed --in-place '/add_route_vpn/d' /Database/LOG/$year/$month/$day/server02/Scripts

I am aware that It could be done better ….any hints will be very appreciated.
greetings