Wednesday, 30 July 2014

PTCL vDSL modem hang issue and its workaround

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/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=":local currentIP\r\
    \n:local externalInterface \"pppoe-out1\"\r\
    \n\r\
    \n# get the current IP address from the external interface\r\
    \n:set currentIP [/ip address get [find interface=\"\$externalInterface\"] address]\r\
    \n# Strip netmask\r\
    \n:for i from=( [:len \$currentIP] - 1) to=0 step=-1 do={\r\
    \n:if ( [:pick \$currentIP \$i] = \"/\") do={\r\
    \n:set currentIP [:pick \$currentIP 0 \$i]\r\
    \n\r\
    \n:log warning \"PTCL LINK RE - CONNECTED with new WAN IP = \$currentIP, Please check and confirm / zaib\"\r\
    \n\r\
    \n/tool e-mail send to=\"aacable@hotmail.com\" password=GMAIL_PASSWORD subject=\"\$[/system clock get date] \$[/system clock get time] -- PTCL DSL pppoe Dialer RE-CONNECTED AND UP NOW, New WAN IP is \$curre\
    ntIP / zaib\" from=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 ppp\
    oe-out1 dialer and reconnected after 10 seconds of delay. New WAN IP is \$currentIP  . Thank you / aacable@hotmail.com\"\r\
    \n\r\
    \n}\r\
    \n}\r\
    \n"
.

EMAIL CONFIGURATION 

You can skip this email config section if you dont want to receive notifications via email.
1
2
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 …
1- link up
.

1 comment:

  1. Assalam O alaikum sir me bridge mood pe kaisy karo Modem ko Or Usko MT k sath kaisy connect karo?

    ReplyDelete