0005-network 626 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  3. echo -n ' routing'
  4. ROUTER=$(grep : /proc/mounts | head -1 | awk -F ':' '{print $1}')
  5. if /sbin/route -n | grep ^192.168.100 > /dev/null; then
  6. ROUTER=192.168.100.206
  7. fi
  8. if /sbin/route -n | grep ^192.168.0.0 > /dev/null; then
  9. ROUTER=192.168.2.2
  10. fi
  11. if /sbin/route -n | grep ^10.4.67 > /dev/null; then
  12. ROUTER=10.4.67.9
  13. fi
  14. for NET in 10.0.0.0/8 172.16.0.0/12 192.168.100.0/24; do
  15. if [ "$ROUTER" = "192.168.100.206" -a "$NET" = "192.168.100.0/24" ]; then
  16. continue;
  17. fi
  18. route add -net "$NET" gw "$ROUTER" 2>/dev/null
  19. done
  20. echo -n '(OK)'
  21. exit 0