Recently at a network, the operator facing PTCL vDSL modem (HUAWEI HG622) hangs frequently. The interval between hanging was different , sometimes 3-4 times daily or after 14-16 hours. Ping to the modem also timeout and when the operator restart the modem, every thing works fine, but its painful to do it manually specially in late night hours when no one at help desk to do the stupid job of resetting.
[It is also observed that PTA is actively blocking users public ips from which suspected grey traffic (Like VPN, HOTSPOT SHIELD and tunneling type applications, and specially VOIP) is passing through, so disconnecting , and reconnecting again assigns you new public ip and internet starts working again.)
The workaround I made was to
- Try Using Good Quality UPS with automatic voltage control,
- First configure the modem in BRIDGE mode,
- Add pppoe client dialer in the Mikrotik ppp section,
- Then add a simple netwatch script which keeps checking the internet connectivity at 1 minute interval) , and if it found no reply from the internet within 10 seconds from the internet (actually single host like Google dns 8.8.8.8) then it disables the default dialer (pppoe-out1) and redial the connection after 10 seconds of PAUSE/DELAY (to prevent any dial-flood). However Its more recommended to monitor your ISP gateway rather then Google DNS dueto various reasons.
- It also sends an email to admin so that he should be aware of what happening behind his back :P . You can skip email section if you dont require notifications.
NETWATCH SCRIPT
Following is an EXPORT version of the netwatch script. You should modify it as per your local need.
/tool netwatch add comment="Monitor Internet Connectivity 8.8.8.8" disabled=no down-script=":log error \"PTCL LINK SEEMS TO BE DOWN, Resetting PPPoE Dialer and wait for at least 10 seconds before redialing / zaib\"\r\ \n /interface pppoe-client disable pppoe-out1\r\ \n:delay 10\r\ \n /interface pppoe-client enable pppoe-out1\r\ \n" host=8.8.8.8 interval=1m timeout=10s up-script=":log warning \"PTCL LINK RE - CONNECTED, Please check and confirm / zaib\"\r\ \n\r\ \n/tool e-mail send to=\"your_email@yourdomain.com\" password=your_gmail_password subject=\"\$[/system clock get date] \$[/system clock get time] — PTCL DSL pppoe Dialer RE-CONNECTED AND UP NOW / zaib\" from=your_gmail_account@gmail.com server=173.194.69.109 tls=yes body=\"\$[/system clock get date] \$[/system clock get time] : PTCL Link was down, so the netwatch script disconnected the pppoe-out1 dialer and reconnec\ ted after 10 seconds of delay. Thank you / aacable@hotmail.com\"\r\ \n"
.
EMAIL CONFIGURATION
You can skip this email config section if you dont want to receive notifications via email.
tool e-mail set address=173.194.69.109 from=your_email@gmail.com password=your_password port=587 starttls=no user=your_username
Done.
When there will be no response from the internet (Google dns) , then netwatch will trigger down script section, which will disconnect the active pppoe-out1 dialer connection, wait 10 seconds, then redial the connection again and log alert and shoots email.
As showed in the image below ...
.
.
.
.
NOTES:
- You can increase the interval and timeout value as per your requirement, ideally it should be a bit higher.
- Its more recommended to monitor your ISP gateway rather then Google DNS dueto various reasons.
- This script simply checks single host, BUT what if only Google dns is not responding, rest of internet is working fine. The netwatch will still think that the whole internet connectivity is down because its checking single host only, and will keep disconnecting/reconnecting the dialer. To prevent this, its better to create a separate DOWN script which will check at least 2-4 multiple HOSTS, including your ISP gateway , internet Hosts like Google dns, and some other reliable hosting servers.
.
Regard's
Syed Jahanzaib
Filed under: Mikrotik Related
