This shows you the differences between two versions of the page.
monitoring_gateway_ping [2009/09/24 04:00] k2patel |
monitoring_gateway_ping [2020/08/10 02:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Loosing Gateway on freebsd 5.5 ====== | ||
- | |||
- | I have not seen any solution so far, so following custom scripts will help you. | ||
- | |||
- | add following line to rc.local. | ||
- | <code bash | /etc/rc.local> | ||
- | /usr/local/bin/netmonitor | ||
- | </code> | ||
- | |||
- | create script netmonitor | ||
- | <code bash | /usr/local/bin/netmonitor> | ||
- | #!/bin/sh | ||
- | |||
- | . /etc/rc.conf | ||
- | |||
- | netmonitor(){ | ||
- | while [ 1 ]; do | ||
- | ping -c 5 -t 1 $defaultrouter | ||
- | |||
- | if [ $? -ne 0 ]; then | ||
- | sh /etc/netstart | ||
- | sh /etc/rc.virtual | ||
- | fi | ||
- | sleep 5 | ||
- | done | ||
- | } | ||
- | |||
- | netmonitor & | ||
- | </code> | ||
- | |||
- | ==== OR ==== | ||
- | |||
- | Following script you should run from the crontab. | ||
- | |||
- | <code bash | gatewayping> | ||
- | #!/usr/local/bin/bash | ||
- | |||
- | gtway=24.24.222.25 | ||
- | ping -c 5 -t 1 $gtway | ||
- | if [ $? -ne 0 ]; then | ||
- | sh /etc/netstart | ||
- | sh /etc/rc.virtual | ||
- | echo "$date Gateway issue Detected" >> /var/log/messages | ||
- | fi | ||
- | </code> | ||
- | |||