AUTOMIC PPTP ROUTER SETUP FOR NETWORK LINKING

From NAT, 6 Years ago, written in Bash, viewed 505 times.
URL https://code.nat.moe/view/2ab88529 Embed
Download Paste or View Raw
  1. #!/bin/bash
  2.  
  3. ROUTES='192.168.0.0,10.1.0.3
  4. 192.168.1.0,10.1.0.2'
  5.  
  6. for route in $ROUTES
  7. do
  8.         from=$(echo "$route" | awk -F',' '{print $1}')
  9.         to=$(echo "$route" | awk -F',' '{print $2}')
  10.         (ifconfig | grep $to > /dev/null) && [[ -z $(route | grep $from) ]] && route add -net $from/24 gw $to && echo "[$(date)] Adding route for $from/24 as $to is online but no route was configured." >> /var/log/nat-route.log
  11. done
  12.  
  13. exit 0

Reply to "AUTOMIC PPTP ROUTER SETUP FOR NETWORK LINKING"

Here you can reply to the paste above

captcha