Firmware Versions and IPTables on NetComm NB5 (vanilla)

All about firmwares for routers. Support for RouterTech firmwares is here too.
User avatar
hiteck
Regular
Regular
Posts: 47
Joined: Wed Dec 02, 2009 7:45 am
Location: N. America

SIP / UDP session lockups

Post by hiteck » Tue Jan 24, 2012 9:22 pm

I too have suffered with a SIP registration problem for years. When the WAN IP changes, the SIP (udp) session locks up and rebooting the router has been my only fix, unless I use dd-wrt with a short UDP timeout like 60 seconds. Since I now want my ATA plugged directly into the RT modem, using a dd-wrt router is no longer a solution in this particular case. Enabling STUN server monitoring in the ATA did not help either as the issue is inside the router. Even forcing the ATA to re-register every 2 minutes does not unlock the dead session.

Seems that the cause is what the OP described above and is NOT specific to Routertech fw. I discovered this issue with Actiontec and other modems also. This is actually a serious problem as my ATA is part of an ABN based security system, and this has plagued the alarm company for years also. The typical symptom is a report that the alarm system is "OFFLINE". Not good, especially when it occurs more than once a month.

I am now trying to figure out a way to cause the RT firmware (modem) to reboot when the wan IP changes (or when PPP goes down). Using checksync.sh does not help because DSL sync is not lost when the IP changes.

I guess I could edit ip-down (or make a new script in NVRAM) to cause a reboot but my question to the resident experts is: How can I automatically detect when the wan IP changes ?

Does ip-down get called automatically based on some event during standard RT operation ?

I am not good at writing scripts, so I am looking for a way to do this using Routertech's built-in features or scripts :)
Any fool can make things complicated. It takes a genius to make things simple. - Einstein Jobs
BandB
Novice
Novice
Posts: 12
Joined: Tue Sep 23, 2008 9:56 am

Re: Firmware Versions and IPTables on NetComm NB5 (vanilla)

Post by BandB » Tue Jan 24, 2012 10:15 pm

Here is the script I use for this application. It does NOT require rebooting of the DSL modem to get around this issue. My ATA (a Minitar MVA11A running version 30 firmware) is configured with a 90 second SIP expiry time and also a 15 second SIP keep alive, so there is a good supply of packets to age out the bad conntrack entry after the router ADSL interface recovers and the ip_conntrack_udp_sip_expires value is temporarily reduced to 3 seconds. Assistance from "thechief" with this matter gratefully acknowledged. I too am not much good writing scripts. The end result works very well.

~ # cd nvram
/nvram # cat sipfix.sh
#!/bin/sh

. /usr/local/bin/rt_utils.sh

SE="/proc/sys/net/ipv4/netfilter/ip_conntrack_udp_sip_expires"
fname="/proc/net/ip_conntrack"
proto=udp
port=5060
IP=$(showip.sh)

cat "$fname" | grep $proto | grep $port | {

while read line; do

if [ $(has_substr "$line" "dst=$IP") -eq 0 ]; then

LOG_MSG "SIP conntrack not updated! Fixing it now ..."
echo 3 > $SE
sleep 120
echo 3600 > $SE
exit

fi
done;

}
/nvram #


This requires the NB5 to be changed to include a minix partition, as reflected below:

/usr/local/bin # printenv
bootloaderVersion 1.2.5.9
ProductID AR7RD
HWRevision Unknown
SerialNumber none
MAC_PORT 0
MEMSZ 0x00800000
FLASHSZ 0x00200000
MODETTY0 9600,n,8,1,hw
MODETTY1 9600,n,8,1,hw
CPUFREQ 150000000
SYSFREQ 125000000
BOOTCFG m:f:"mtd1"
PROMPT (psbl)
mtd2 0x90000000,0x90010000
mtd3 0x90010000,0x90020000
azcpmac_config 1
StaticBuffer 120
model NB5 ADSL2+
vcc_encaps0 0.0
vcc_encaps1 0.0
vcc_encaps2 0.0
vcc_encaps3 0.0
vcc_encaps4 0.0
vcc_encaps5 0.0
vcc_encaps6 0.0
vcc_encaps7 0.0
usb_flag 1
modulation 0x1
connection0 0
cron_enable 1
HWA_0 xx:xx:xx:xx:xx:xx
HWA_3 xx:xx:xx:xx:xx:xx
HWA_HRNDIS xx:xx:xx:xx:xx:xx
HWA_RNDIS xx:xx:xx:xx:xx:xx
usb_vid 0x0451
usb_pid 0x6060
mtd1 0x90020090,0x9009A000
IPA xxx.xxx.xxx.xxx
TZ AEST-10:00
mtd0 0x9009A000,0x901F0000
mtd4 0x90020000,0x901F0000
mtd5 0x901F0000,0x90200000
RT_init_nvram mount -t minix /dev/mtdblock/5 /nvram
RT_init_50 echo "/nvram/sipfix.sh > /dev/null 2>&1 & " >> /var/tmp/onconnectWAN
setdate_enable 1 4
/usr/local/bin #

Cheers,
Brian
User avatar
hiteck
Regular
Regular
Posts: 47
Joined: Wed Dec 02, 2009 7:45 am
Location: N. America

Re: Firmware Versions and IPTables on NetComm NB5 (vanilla)

Post by hiteck » Tue Jan 24, 2012 11:13 pm

Thanks Brian. Nice to see you and The Chief created a solution. However... as all my modems are Adam2 based, I cannot enter a long command into the environment for Adam2 bootloaders. The limit is like 32 bytes? per line, so I cannot enter

Code: Select all

RT_init_50 echo "/nvram/sipfix.sh > /dev/null 2>&1 & " >> /var/tmp/onconnectWAN
I know I could try to shorten the command with another script maybe, but I am going to attempt to eliminate the need for a router for the ATA by utilizing the PPPOE logon feature of the ATA, as I am using the modem in bridge mode (HB mode?) and my ISP allows multiple pppoe logons (from multiple routers/devices). Not a software solution but can be good for those users without Routertech fw and Minix partitions as long as they can put the modem in bridge mode. 8)
Any fool can make things complicated. It takes a genius to make things simple. - Einstein Jobs
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Firmware Versions and IPTables on NetComm NB5 (vanilla)

Post by thechief » Tue Jan 24, 2012 11:28 pm

You can use the autoexec script "/nvram/startup.sh". Put the command in such a script, and the script will be executed automatically during bootup.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
User avatar
hiteck
Regular
Regular
Posts: 47
Joined: Wed Dec 02, 2009 7:45 am
Location: N. America

PPPOE on ATA

Post by hiteck » Tue Jan 24, 2012 11:33 pm

Maybe that attempt to use PPPoE is not a good idea. My Sunrocket ATA always has ports 23 and 80 open, and my Linksys PAP2 ATA's do not support PPPoE. :cry: I will try The Chief's method for the ENV entry.
Any fool can make things complicated. It takes a genius to make things simple. - Einstein Jobs
User avatar
hiteck
Regular
Regular
Posts: 47
Joined: Wed Dec 02, 2009 7:45 am
Location: N. America

sipfix.sh appended to onconnectWAN at startup

Post by hiteck » Wed Jan 25, 2012 6:41 pm

This is what gets appended to /var/tmp/onconnectWAN at startup:

Code: Select all

/nvram/sipfix.sh > /dev/null 2>&1 & 
It ends with "& ". Is that complete and correct ?
Any fool can make things complicated. It takes a genius to make things simple. - Einstein Jobs
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Firmware Versions and IPTables on NetComm NB5 (vanilla)

Post by thechief » Wed Jan 25, 2012 6:53 pm

Well, that is what your command told it to do - and it is a good idea to do it like that (it means that the system can go on while the script is running).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
deggy
Newbie
Newbie
Posts: 3
Joined: Tue Oct 26, 2010 12:38 pm

Re: Firmware Versions and IPTables on NetComm NB5 (vanilla)

Post by deggy » Thu Feb 16, 2012 5:49 pm

Massive thanks for this fix - the nightly disconnects had me completely stumped.

I wonder how many other users of all types of routers have had to abandon their attempts at DIY VoIP because of problems like this.

Still - It works for me!
User avatar
hiteck
Regular
Regular
Posts: 47
Joined: Wed Dec 02, 2009 7:45 am
Location: N. America

SIP / VOIP timeout fix

Post by hiteck » Thu Feb 16, 2012 7:21 pm

Yes indeed it works good !
No need to mess with the Environment variables either.

Put the attached files into /nvram, change names to *.sh and set flags to executable. Reboot.

NOTE: The /nvram folder must be in MTD5 (flash), not in ram, if you want it to stick after reboots.
Attachments
sipfix.txt
Put this in /nvram, change name to sipfix.sh and set flags to executable.
(412 Bytes) Downloaded 369 times
startup.txt
Put this in /nvram, change name to startup.sh and set flags to executable.
(69 Bytes) Downloaded 346 times
Any fool can make things complicated. It takes a genius to make things simple. - Einstein Jobs
Post Reply