Kitz Forum

Broadband Related => Broadband Hardware => Topic started by: G.DMT on February 22, 2016, 03:38:38 PM

Title: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 22, 2016, 03:38:38 PM
A used  DLink DSL-320B-Z1  purchased on ebay arrived yesterday.

I am using it in 'modem only' mode bridged behind an OpenWRT router using PPPoE

The DSL-320B has only one Network port, so I had to setup OpenWRT to route a subnet out the red (WAN) interface to allow me to access ports on the modem for admin and telnet .

HOWTO here: https://simplebeian.wordpress.com/2014/03/12/accessing-your-modem-from-openwrt-router/

Code: [Select]
[root@k8 admin]# nmap -T4 192.168.0.6

Starting Nmap 7.00 ( https://nmap.org ) at 2016-02-22 15:33 GMT
Nmap scan report for 192.168.0.6
Host is up (0.0044s latency).
Not shown: 997 closed ports
PORT   STATE SERVICE
21/tcp open  ftp
23/tcp open  telnet
80/tcp open  http

Nmap done: 1 IP address (1 host up) scanned in 0.25 seconds
[root@k8 admin]#

Some ADSL statistics are visible in the web GUI.

If you have a Raspberry Pi you could run this little script to scrape them.
dsl-320b.sh

Code: [Select]
#!/bin/sh

## requires: curl,lynx

username='admin'
password='admin'

modem_ip='192.168.0.6'

curl --silent --anyauth --user "$username":"$password"   "http://$modem_ip/statsifcwan.html?Rtabhead=Status" | lynx --stdin --dump



[user@k8 scripts]$ ./dsl-320b.sh
     Statistics

   This information reflects the current status of your router.

   WAN Statistics
   Service VPI/VCI Protocol Received         Transmitted
                            Pkts  Errs Drops Pkts  Errs Drops
   -       0/38    RFC 1483 73228 0    0     55060 0    0

   LAN Statistics
   Interface

                                  Received

                                 Transmitted

     Bytes Pkts Errs Drops Bytes Pkts Errs Drops
   Ethernet 9480742 65749 0 0 95900079 85405 0 0

   ADSL Statistics
   Mode:                              G.DMT
   Type:                              ANNEX_A
   Status:                            Showtime

                            Downstream Upstream
   Rate (Kbps):             4224 kbps 448 kbps

   SNR Margin (dB):         6.0       17.0
   Attenuation (dB):        63.5      31.5
   Output Power (dBm):      19.0      12.5

   Super Frames:            681173    681173
   RS Correctable Errors:   58089     29
   RS Uncorrectable Errors: 543       42

   HEC Errors:              2796      41
   Total Cells:             406586    183053
   Data Cells:              1022660   112124
   Bit Errors:              0         0


I have a longish line >4300m with poor stability.

I will note here that ADSL option 'Bitswap' was not enabled by default.
When I checked the checkbox for 'Enable Bitswap' sync speed increased from 4032 -> 4224 kbps
 

This post is getting a bit long with pasted text.
I will start a new post for the telnet cli.

[Moderator edited to correct a minor typographical error.]
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 22, 2016, 03:50:57 PM
There is a cli available via telnet.


[root@k8 admin]# telnet -l admin 192.168.0.6 23
Trying 192.168.0.6...
Connected to 192.168.0.6.
Escape character is '^]'.

Password: *****


The inteface is pretty basic, and I don't see the usual unix/linux style commands one would expect with a proper command interpreter shell such as ash / dash / bash etc.

This is a bit more like the context aware interface you see if you are familiar with cisco IOS or junos.

except the prompt does not change when  the context does, so I am finding it a bit confusing.  ???

Anyway help shows there are a few commands available.

I shall record some of the basics here.
tc> ls
Valid commands are:
sys             exit            ether           wan               
etherdbg        tcephydbg       usb             ip               
bridge          dot1q           pktqos          show             
set             lan                                               
tc>


tc> sys
adjtime         countrycode     edit            feature           
hostname        log             resetlog        stdio             
time            syslog          version         view             
wdog            romreset        upnp            atsh             
diag            routeip         bridge          save             
display         password        default         adminname         
modelcheck      parentctrl      multiuser       defaultTCrestore 
pswauthen       hangdbg         ledtr68         pppnamelock       
defaultpwdcheck autocwmpoui     atshw           remotemgropen     
sptromsize      compileid       dhcpprobe       dhcpfor2ndusr     
cwmp            socket          filter          ddns             
cpu             snmp                                             

tc>

tc> wan
atm             node            hwsar           tdebug           
adsl            tsarm                                             

tc> show
wan             lan             cpe             community         
channel         all                                               

tc> show wan
help            node            status          adsl             
tsarm                                                             

tc>


In the GUI you can define up to eight Permanent Virtual Circuits
Each could be e.g. a diferent VLAN for your ISP.

tc> show wan status
PVC-0
        Status = Up
PVC-1
        Status = Down
PVC-2
        Status = Down
PVC-3
        Status = Down
PVC-4
        Status = Down
PVC-5
        Status = Down
PVC-6
        Status = Down
PVC-7
        Status = Down

tc>
Title: Re: DLink DSL-320B-Z1 some telnet commands
Post by: G.DMT on February 22, 2016, 03:52:28 PM
tc> wan adsl chandata
near-end interleaved channel bit rate: 4032 kbps
near-end fast channel bit rate: 0 kbps
far-end interleaved channel bit rate: 448 kbps
far-end fast channel bit rate: 0 kbps

tc> wan adsl linedata
far             near                                             

tc> wan adsl perfdata
near-end FEC error fast: 0
near-end FEC error interleaved: 52019
near-end CRC error fast: 0
near-end CRC error interleaved: 94
near-end HEC error fast: 0
near-end HEC error interleaved: 377
far-end FEC error fast: 0
far-end FEC error interleaved: 5
far-end CRC error fast: 0
far-end CRC error interleaved: 4
far-end HEC error fast: 0
far-end HEC error interleaved: 11
Error second in 15min           : 1
Error second in 24hr            : 7
Error second after power-up     : 7
ADSL uptime     1:36:39

tc> wan adsl status
current modem status: up

tc> wan adsl rateadap
on              off                                               

tc> wan adsl noisemargin
Usage: noisemargin_value

tc> wan adsl txgain
usage: gain value should be >= 0x0c or <= 0x00 (-12~0dB)
current value:80

tc> wan adsl txtones
usage: <start tone> <end tone> tone=0x6~0x1F
current value: start_tone=6 end_tone=1f

tc> wan adsl watchdog
adsl dsp watchdog: 1

tc> wan adsl annex
ADSL ANNEX[HW] : A

tc> wan adsl defbitmap
current near-end defects bitmaps:
    Los              :0
    Lof              :0
    Lop              :0
    LcdNonInterleaved:0
    LcdInterleaved   :0
    Lom              :0
current far-end defects bitmaps:
    Los              :0
    Lof              :0
    Lop              :0
    LcdNonInterleaved:0
    LcdInterleaved   :0
    Lom              :0
current near-end defects bitmaps changed:
    Los              :0
    Lof              :0
    Lop              :0
    LcdNonInterleaved:0
    LcdInterleaved   :0
    Lom              :0
current far-end defects bitmaps changed:
    Los              :0
    Lof              :0
    Lop              :0
    LcdNonInterleaved:0
    LcdInterleaved   :0
    Lom              :0

tc> wan adsl opmode
operational mode: ITU G.992.1(G.DMT)


tc> wan adsl version
near-end version: 1
far-end version: 0

tc> wan adsl farituid
far end itu identification: b5 0 54 53 54 43 5 10

tc> wan adsl dumpcondition
on              off                                               

tc> wan adsl persisttime
Usage: time_sec

tc> wan adsl targetnoise
usage: gain value should be snr margin(dB) * 512
current value:0

tc> wan adsl snroffset
usage: set snr offset (offset(db)*512)
current value:0

tc> wan adsl fwversion
DMT FwVer: 3.22.2.0_A60394 HwVer: T14F7_12.0

tc>

tc> wan adsl txgain
usage: gain value should be >= 0x0c or <= 0x00 (-12~0dB)
current value:80

tc> wan adsl status
current modem status: up

tc> wan adsl rateadap
on              off                                               

tc> wan adsl chandata
near-end interleaved channel bit rate: 4032 kbps
near-end fast channel bit rate: 0 kbps
far-end interleaved channel bit rate: 448 kbps
far-end fast channel bit rate: 0 kbps

tc> wan adsl linedata
far             near                                             

tc>
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 22, 2016, 03:58:07 PM
Fortunately there is a line diagnosis command implemented - broadly similar to the Broadcom equivalent.

It returned 994 lines of text, so I will refrain from pasting it here.
I will attach the file in case anyone is interested.  ;)

This is handy as it shows correct usage for many of the commands, and contains a load of tone data so looks like it could easily be parsed to generate graphs of line stats. :-)
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: aesmith on February 22, 2016, 04:03:00 PM
How does that attenuation figure compare with other routers/modems that you've tried?   

If it's truly 63.5dB then that's a pretty impressive synch data rate.  On the other hand compared to our own line (5.3km/54dB) the attenuation figure looks high for the length you mention.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 22, 2016, 04:11:56 PM
How does that attenuation figure compare with other routers/modems that you've tried?   

If it's truly 63.5dB then that's a pretty impressive synch data rate.  On the other hand compared to our own line (5.3km/54dB) the attenuation figure looks high for the length you mention.

Yeah I noticed that too.
IIRC 63.5dB is the max value supported by the ADSL1 standard

Previous modems have reported similar, and in the past I had assumed that this just may be a reporting
foible.
Now I am not so sure.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Chunkers on February 22, 2016, 04:14:18 PM
This is super handy as I have just bought one of these, also ..... wow your line is even worse than mine  :-X

All things considered it looks like it is doing a pretty good job

When I get mine up and running I will post a comparison between is and my other modems for info :)

Thanks!

Chunks
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 22, 2016, 04:39:18 PM
Some more telnet info

tc> show wan help
show wan help                     Display help information
show wan node <vc_index:0~7>     Display WAN PVC information
tc> show wan node 0
RemoteNode     = 0
Rem Node Name  = Node1(ISP)
Encapsulation  = RFC 1483
Multiplexing   = LLC-based
Channel active = Yes
VPI/VCI value  = 0/38
IP Routing mode= No
Bridge mode    = Yes
Remote IP Addr        = 0.0.0.0
Remote IP Subnet Mask = 0.0.0.0
IP address assignment type = Dynamic
SUA            = Yes
Multicast      = None
Default Route node            = Yes
tc>
 

so, don't type
tc> show wan adsl close
ok


as that will close your dsl connection!

As will:

tc> show wan adsl reset
ok
tc>

The first 'close' caused sync to come back up at an improved 4320 kbps
The second 'reset' came back up  2 speed bands slower at 4256 kbps

So be careful with this - you don't want to get clobbered by the dreaded Dynamic Line Management system.

tc> show wan adsl open
The line is already up
tc>


don't run
tc >  sys default

That resets the modem to default settings, including resetting VCI back to 33 which will disconnect you from your ISP and drop your PPP connection.

also resets 'Enable bitswap' to off.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 22, 2016, 09:39:47 PM
This is super handy as I have just bought one of these, also ..... wow your line is even worse than mine  :-X

All things considered it looks like it is doing a pretty good job

When I get mine up and running I will post a comparison between is and my other modems for info :)

Thanks!

Chunks

I was inspired by you Chunkers and Weaver in  the previous thread.  ;D

"New Broadcom based modem to bridge to my router"
http://forum.kitz.co.uk/index.php/topic,16973.msg312386.html#msg312386 (http://forum.kitz.co.uk/index.php/topic,16973.msg312386.html#msg312386)

;D I hope this thread may help you to get set up quickly and easily and provide you with all the stats you need to compare performance to the ZyXEL VMG8324-B10A

I wrote a little script to download relevant data from the modem using plink.

[edit: I updated the script it a little, so use the .zip attached to the subsequent post.]
;-)
Title: plink script to retreive lina statistics from DLink DSL-320B-Z1
Post by: G.DMT on February 22, 2016, 10:29:03 PM
I decide to move this into its own post, since I updated the script a little to make it a bit more maintainable, and readable.
 
The zip archive provides a .sh file to be executed from the shell command line.
plus some individual .telnet files which contain the commands which are to be executed on the modem.

This requires that plink is installed.

You can install plink on a Raspberry Pi using
'apt-cache show putty-tools'
'apt-get install putty-tools'

plink.exe is also available for windows,
so you could use the plink-stats.sh as a guide to make a windows batch file if that is what you need.

usage is simple:
Expand the zip archive into its own directory and cd into the directory.

You can either uncomment whichever line calls the function(s) you want
and then execute ./plink-stats.sh

OR (the more flexible way)

'source  ./plink-stats.sh'
then
call a script function directly by name
e.g. 'telnet_diagnostic'
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Chunkers on February 23, 2016, 04:36:20 AM
;D I hope this thread may help you to get set up quickly and easily and provide you with all the stats you need to compare performance to the ZyXEL VMG8324-B10A


Brilliant!  I am looking forward to trying this, it will be a while as I am currently working on rotation in Africa, I am due back in the UK next week so it'll a few weeks yet I imagine :)

Chunks
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Jaggies on February 23, 2016, 10:37:04 PM
Multiplexing   = LLC-based

This is normally "VC-MUX", or "VC Based" for G.DMT connections on BTwholesale lines.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Chunkers on February 26, 2016, 09:12:47 AM
Hi  ::)

I set up my D-Link by putting it into bridge mode, disabling DHCP and before doing this I set the IP to 192.168.1.2.  My router, an Asus AC68U, has the IP 192.168.1.1 and the DHCP server uses the range from 192.168.1.5 to 192.168.1.254.

At the moment it is connected fine and seems to be working well but I am struggling a bit to get stats from the modem as it only has the one network port and I am a bit unsure whether the AC68U has the ability to setup a subnet on the WAN side like G.DMT did above.  My knowledge of networking is pretty basic (read almost non-existant)

Can anyone give me a few hints on the easiest way to get the stats from my setup?

Thanks!

Chunks  :baby:
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 26, 2016, 10:21:22 AM
Hi Chunkers.

 So once I had telnet access, I spent some time examining how this modem works.

And I was not very encouraged with what I found.

There is a worrying history of remotely exploitable security holes, and there appears to be very little in the way of updates.  :(

I can see why AA advocate to only use it in bridge mode.

When you add an IP address, you are providing an endpoint to attack from the network.

Anyone who buys this modem needs to

1) Login to the web GUI, goto  Advanced / Remote Management and uncheck all of the remotely available services:
FTP   
HTTP    
ICMP (Ping)    
TELNET    
TFTP

2) Download and install the latest firmware image - (currently 1.06):

http://www.dlink.com/uk/en/support/product/dsl-320b-adsl-2-ethernet-modem?revision=deu_revz#downloads

This adds some authentication to attempted accesses to the device.

This was one of the many Zynos devices subject to the rom-0 attack where an unauthenticated request could download the section of the rom image that contained the admin password ! :-(

This was used for a mass DNS hijacking attack against these routers.  :(
 
I would strongly suggest you deal with this first before you leave the device 'in service'.

p.s. The new firmware prevents the simple curl script that I posted earlier from working, but I wrote a new version to get around that.

I will post that up here soon so others can use it.

As further sensible precautions, I would advise moving the device off of the default (local,private) IP address and changing the default password.

Cheers!
p.s. I will make another post addressing your actual question.  ;)
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 26, 2016, 11:01:00 AM
Hi  ::)

I set up my D-Link by putting it into bridge mode, disabling DHCP and before doing this I set the IP to 192.168.1.2.  My router, an Asus AC68U, has the IP 192.168.1.1 and the DHCP server uses the range from 192.168.1.5 to 192.168.1.254.

At the moment it is connected fine and seems to be working well but I am struggling a bit to get stats from the modem as it only has the one network port and I am a bit unsure whether the AC68U has the ability to setup a subnet on the WAN side like G.DMT did above.  My knowledge of networking is pretty basic (read almost non-existant)

Can anyone give me a few hints on the easiest way to get the stats from my setup?

Thanks!

Chunks  :baby:

Few points to note here.

In the general case there are two obvious solutions here.

The problem here is that you have only one physical network port on the modem, but desire to utilise it for 2 distinct use cases.

1) internet connection
2) connection for monitoring.

You could solve this by either
1) Multiplying the number of physical ports you have available i.e. plug it into a switch.
or
2) Ensure that the device it is connected to is sufficiently flexible to handle both Internet/Firewall/Router duties AND monitoring.

The _easiest_ solution is to just plug the modem port into a little dedicated switch, then use a low power device with 2 ethernet ports (like a raspberry Pi with a USB network dongle)  as a proxy for monitoring.

I have been happily using 1) to give me a single point of access to multiple devices for years now.  :)
But this does require that you have the additional kit running.

I do not have an Asus AC68U so I did a quick google for your router.

It seems you have a choice of options for solution 2.

http://www.asus.com/us/site/routers/DD-WRT/
http://www.dd-wrt.com/wiki/index.php/Asus_RT-AC68U

I did a quick check on one of my  DD-WRT devices-

If you have installed DD-WRT you can go to web GUI / Setup / Advanced Routing / Static routing
and add a new route (out the WAN interface) there.

I personally have stopped installing DD-WRT as I find OpenWRT preferable.

It would appear there has been an openWRT build available for the Asus AC68U for some time:
https://wiki.openwrt.org/toh/asus/rt-ac68u

Whichever route you choose to go- I would suggest that you put the modem on a subnet (i.e. IP address range) of its own.
I chose a /29 to suit my particular setup here- there is no actual _need_ for a full /24

I would advize _not_ to try to have it in the same IP range as the rest of your LAN.

i.e. in your case where the LAN had network address 192.168.1.0/24

I would prefer _not_  to try and subnet the 192.168.1.0 subnet as this provides scope for getting it wrong later if you are not fully comfortable with routing and subnetting.

Why not just put it on e.g. 192.168.2.0/30 or similar?

The packet routing algorithm picks the 'Longest Match First'- so avoid ambiguity by selecting the network prefix for your monitoring subnet ( the /30 ) that is a better (more specific) match than your LAN ( the /24 ) 

Apologies  if this is a granny / eggs situation!  ;D

Cheers.  ;D

Title: Re: DLink DSL-320B-Z1 updated scrape script for Newer Firmware Versions.
Post by: G.DMT on February 26, 2016, 12:04:19 PM
Here is an updated shell script which uses curl and MD5 to scrape ADSL Statistics from the web GUI

This is required for newer firmware versions.

[root@k8 scripts]$ ./login-dsl-320b.sh                                                                                                       
   ADSL Statistics                                                                                                                           
   Mode:                              G.DMT                                                                                                   
   Type:                              ANNEX_A                                                                                                 
   Status:                            Showtime                                                                                               
                                                                                                                                             
                            Downstream Upstream                                                                                             
   Rate (Kbps):             3776 kbps 448 kbps                                                                                               
                                                                                                                                             
   SNR Margin (dB):         9.0       17.0                                                                                                   
   Attenuation (dB):        63.5      31.5
   Output Power (dBm):      18.5      12.5

   Super Frames:            563509    563509
   RS Correctable Errors:   53456     195
   RS Uncorrectable Errors: 2398      180

   HEC Errors:              25175     121
   Total Cells:             442118    254083
   Data Cells:              2523309   141559
   Bit Errors:              0         0


[edit: removed attachment  login-dsl-320b.sh.txt after noticing a login bug]
[edit: improved version http://forum.kitz.co.uk/index.php/topic,17065.msg314608.html#msg314608 ]
Title: Re: DLink DSL-320B-Z1 updated Telnet Script.
Post by: G.DMT on February 26, 2016, 12:34:26 PM
Here are updated scripts that use plink and pcregrep to
collect modem data via telnet.

Expand the zip archive into its own folder.
cd into the folder containing the .sh files

For portability ( for anyone without a proper shell e.g. using plink.exe ) the telnet cli commands are
 stored in separate files in the directory  ./telnet-commands

ATM the password is sent from the first line of each *.telnet file
so ensure this will match with your admin password.

For flexibility each command is implemented as a separate .sh file.

usage: ./get-stats.sh

[root@k8 plink-stats]$ ./get-stats.sh
 system up time:    42:23:33 (e8dec6 ticks)
ADSL uptime     2:34:48
--- error-down ---
FEC error interleaved: 51806
CRC error interleaved: 2286
HEC error interleaved: 24044
--- error-up ---
FEC error interleaved: 188
CRC error interleaved: 170
HEC error interleaved: 114
--- error-second ---
Error second in 15min           : 21
Error second in 24hr            : 162
Error second after power-up     : 162
--- margin ---
noise margin downstream: 8.5 db
--- rate-down ---
 3776 kbps
--- rate-up ---
 448 kbps


[edit:]
Just in case it is not immediately obvious why I wrote this:
you need to know the  Errored Seconds count and the Uptime to calculate MTBE
http://www.kitz.co.uk/adsl/DLM.htm#MTBE

And none of that is available in the GUI.  :(

 [edit: More data collection added. updated scripts at:]
http://forum.kitz.co.uk/index.php/topic,17065.msg314808.html#msg314808
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Chunkers on February 26, 2016, 02:31:26 PM
Thanks for all the cool info, I have transferred my attentions to trying my new Zyxel VMG8324 for the time being whilst I make a few further checks on my D-Link and come back to it.  I already had the latest firmware but i want to double check on the vulnerabilities after you're rather worrying notes above.

On the plus side it was very easy to set up and seemed to be performing well on my line, shame about the security issues.

Thanks again!

Chunks

Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: aesmith on February 26, 2016, 07:50:57 PM
If the D-Link is acting as a modem, I don't see how a private IP address on it can be a security issue.  Doesn't the PPPoE traffic pass straight through, and only appear as IP once it hits the router.  Even if it could see the private address, that's not reachable over the Internet in any case.  Or am I missing something?
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 26, 2016, 08:27:57 PM
If the D-Link is acting as a modem, I don't see how a private IP address on it can be a security issue.  Doesn't the PPPoE traffic pass straight through, and only appear as IP once it hits the router.  Even if it could see the private address, that's not reachable over the Internet in any case.  Or am I missing something?

@aesmith.
Indeed so.
But it appears that You are assuming that your ISPs network is secure... that a malicious attacker cannot inject carefully crafted Packets (perhaps upstream of or on the PPP gateway) or carefully crafted ATM frames ( perhaps on the ISP network between the gateway and DSLAM)  that would be assembled at the PPP client to target a directly attached non routeable address.
As I understand it that is not impossible.
 
However if the (non routeable) 'Private IP' is visible on the LAN then the device is still open to attach from the LAN, and one of the successful exploits is a  browser x-site scripting attack.
i.e. from your LAN.

Hence the belt+braces advice to NOT use the default IP or password.
 ;D
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 26, 2016, 08:51:53 PM
Thanks for all the cool info, I have transferred my attentions to trying my new Zyxel VMG8324 for the time being whilst I make a few further checks on my D-Link and come back to it.  I already had the latest firmware but i want to double check on the vulnerabilities after you're rather worrying notes above.

On the plus side it was very easy to set up and seemed to be performing well on my line, shame about the security issues.

Thanks again!

Chunks

Similarly, I have transferred my attentions to the Billion 8800NL that arrived today.  ;D

I would be interested to hear how you fare with your Zyxel.  :)

I should have posted up more details on the dlink, but I've posted loads already!  :-[
I did take some notes so if I find the time I might get round to whipping them into some sort of shape fit enough to post.

Oh and whilst writing the web scraper script posted above, I discovered that the 'authentication' appears to not properly block bogus requests.

What seems to happen is that the first successful 'login' from an IP appears to put that IP onto some sort of a whitelist, because subsequent requests can be made from the same IP with bogus credentials, and they will succeed until some timeout has expired.  :(

Oh and because of that I didn't immediately notice that I borked a login parameter in the scraper script- because it always succeeds if you have 'logged in' from your browser.

[edit: attached an updated script version which now does  'login' then web scrape then 'logout']

Title: Re: DLink DSL-320B-Z1 changes in reported firmware version numbers
Post by: G.DMT on February 26, 2016, 10:00:52 PM
For the record, and in case anyone is interested.

Here is a record of the changes visible to binary blob versions
when I installed the latest update image from d-link.
 
[root@k8 plink-stats]# ./sys-version.sh
 RAS version: v1.03
 System   ID: $2.12.116.0(F04.ZZ.5)3.22.2.0 20130325_v006  [Mar 25 2013 13:59:45]
 romRasSize: 1296358
 system up time:    34:14:59 (bc23b9 ticks)
 bootbase version: VTC_SPI1.26 |  2012/12/26

[root@k8 plink-stats]# ./adsl-version.sh                                       
DMT FwVer: 3.22.2.0_A60394 HwVer: T14F7_12.0                                     


Installed updated firmware.

[root@k8 plink-stats]# ./adsl-version.sh
DMT FwVer: 3.22.7.0_A60394 HwVer: T14F7_12.0

[root@k8 plink-stats]# ./sys-uptime.sh
 system up time:     0:03:24 (4fd1 ticks)

[root@k8 plink-stats]# ./sys-version.sh
 RAS version: v1.06                                                           
 System   ID: $2.12.161.0(F04.ZZ.5)3.22.7.0 20140313_v004 [Mar 13 2014 10:50:19]
 romRasSize: 1353830
 system up time:     0:06:14 (9234 ticks)
 bootbase version: VTC_SPI1.26 |  2012/12/26
Title: Re: DLink DSL-320B-Z1 looking at the ROM image with binwalk.
Post by: G.DMT on February 26, 2016, 10:21:12 PM
So just to set the scene:

[root@k8 admin]# dnf info binwalk.x86_64
Installed Packages
Name        : binwalk
Arch        : x86_64
Epoch       : 0
Version     : 2.0.0
Release     : 6.fc23
Size        : 581 k
Repo        : @System
From repo   : fedora
Summary     : Firmware analysis tool
URL         : http://www.binwalk.org/
License     : MIT
Description : Binwalk is a tool for searching a given binary image for embedded files and
            : executable code. Specifically, it is designed for identifying files and code
            : embedded inside of firmware images. Binwalk uses the python-magic library, so
            : it is compatible with magic signatures created for the Unix file utility.

[root@k8 admin]#


So I used binwalk to search through the ROM image.

Unfortunately the output does not read well on a terminal <100 chars wide. 
so I captured the output oto a file with:
 

[root@k8 admin]# binwalk DSL-320B_Z1_FW_V1\ 06 > 'binwalk-DSL-320B_Z1_FW_V1 06.out'
                                          ^^   Note space in the name :-(  ^^                                                 


and will attach it here.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 26, 2016, 10:30:27 PM
And just for comparison and to maybe help give an idea of the layout

Here is the binwalk for the ROM image for the previous hardware version
which is the Broadcom Based ver D2
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on February 26, 2016, 10:37:06 PM
@g.dmt  - many, many thanks for the huge amount of work you have put in and for the extremely valuable info you have dug up. Much appreciated.
Title: Re: DLink DSL-320B-Z1 the infamous zynos RomPager
Post by: G.DMT on February 26, 2016, 10:48:54 PM
[root@k8 scripts]$ curl 192.168.0.6/Allegro
<html>
<head>
<title>Allegro Copyright</title></head><body>
RomPager Advanced Version 4.07<br>(C) 1995 - 2002 Allegro Software Development Corporation
</body></html>


you can read about a recent Zynos security problem here:

"Misfortune Cookie (CVE-2014-9222) Demystified"
http://cawanblog.blogspot.co.uk/2015/02/misfortune-cookie-cve-2014-9222.html

There are date strings sprinkled throughout the latest ROM image, including firmware version dates and software compile dates.
We can observe from  these that the Zynos ROM image has been composed from pieces of quite old software. :(

Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 26, 2016, 10:56:32 PM
@g.dmt  - many, many thanks for the huge amount of work you have put in and for the extremely valuable info you have dug up. Much appreciated.

Thanks Weaver!  :-[

I was doing my due diligence anyway.
I decided it would be better to share the knowledge this time.  ;D

Actually there _is_ maybe one thing that YOU could do.

I seem to vaguely recall you saying in a prevoius thread that you had bought quite a few of these devices?

Do you have one that you could take apart- just open the case?
A dead one maybe or an unused spare?

All that is needed is to open the case and take pictures of the PCB.

The hardware and the OS both support a serial port. (and possibly a USB header too).
So if you can see a serial port (or a USB header) on the board, then I might consider investigating using it to get at the boot prompt.

 ;D


 
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on February 26, 2016, 11:21:37 PM
@G.DmT - Will take one apart if I am able. I had seven devices, last count!
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on February 27, 2016, 12:09:42 AM
See http://forum.kitz.co.uk/index.php/topic,16693.msg307788.html#msg307788

I was hoping you could check a couple of things out for me:

* You said that the bitswap-enable UI control was effective, ticking it produced a worthwhile improvement. Can you tell me whether this was true when in modem-only mode?
 
* Similarly, is the ADSL2+ tickbox effective (assuming you have an ADSL2+ line to test) when in modem-only mode? That is ADSL2+ ticked vs unticked, with ADSL2 ticked in modem-only mode.

I should be able to check this out for myself, but my health difficulties are making it difficult for me.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on February 27, 2016, 12:55:58 AM
@G.DMT - (rather belated posting) I notice you posted a very impressive d/s sync rate of 4224 considering your high d/s attn (63.5 dB - which we take to be fake seeing as you are running on G.DMT), although your line is not incredibly long. (Mine is 4.55 mi, 7322 m, 21CN ADSL2+, d/s attn. of 65 - 67 dB, d/s sync ~2900 kbps.)

The line seems to be unstable at that high sync rate though, (perhaps needing a load of interleave?) - because of the very bad news >2000 d/s HEC errors. Is it locked into fastpath somehow? Is that the source of the corruption?  :no:

I realise there's no point me asking you in that earlier post to test out ADSL2+ vs ADSL2 comparison for me if you don't have ADSL2+. Doh.  :blush: Sorry.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on February 27, 2016, 01:22:53 AM
Volunteers wanted

(1) Perhaps some other kind kitizen would be good enough to do the ADSL2 vs ADSL2+ comparison test for me? See prev post. (Obviously must have ADSL2+ line, and must be really quite long, say < 4500 d/s sync, but as long as you can get some result.) Must be done in modem-only mode, or both, if you wish to check the behaviour out. UI weirdness possible,

Needs to be done carefully, so the result will be repeatable, so a time-consuming pain of a job. See http://forum.kitz.co.uk/index.php/topic,15905.msg307641.html#msg307641

(2) Similarly volunteers wanted to check the enable-bitswap thing, in modem-only mode.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 27, 2016, 11:38:45 AM
@G.DMT - (rather belated posting) I notice you posted a very impressive d/s sync rate of 4224 considering your high d/s attn (63.5 dB - which we take to be fake seeing as you are running on G.DMT), although your line is not incredibly long. (Mine is 4.55 mi, 7322 m, 21CN ADSL2+, d/s attn. of 65 - 67 dB, d/s sync ~2900 kbps.)

The line seems to be unstable at that high sync rate though, (perhaps needing a load of interleave?) - because of the very bad news >2000 d/s HEC errors. Is it locked into fastpath somehow? Is that the source of the corruption?  :no:

I realise there's no point me asking you in that earlier post to test out ADSL2+ vs ADSL2 comparison for me if you don't have ADSL2+. Doh.  :blush: Sorry.

@Weaver

sync can go higher than that!
e.g. Here is what I see this morning.

Found Form post target: /Forms/login_1
######################################################################## 100.0%
Login POST succeeded.
url_effective http://192.168.0.6/wan.html
num_redirects 1
http_code 200
------------------------------------------------------------------------
   ADSL Statistics
   Mode:                              G.DMT
   Type:                              ANNEX_A
   Status:                            Showtime

                            Downstream Upstream
   Rate (Kbps):             4416 kbps 448 kbps

   SNR Margin (dB):         5.0       17.0
   Attenuation (dB):        63.5      31.5
   Output Power (dBm):      19.5      12.5

   Super Frames:            330447    330446
   RS Correctable Errors:   50996     141
   RS Uncorrectable Errors: 1557      170

   HEC Errors:              5775      174
   Total Cells:             881781    395690
   Data Cells:              513151    29900
   Bit Errors:              0         0

[root@k8 scripts]# cd plink-stats/
[root@k8 plink-stats]# ./get-stats.sh
 system up time:    63:07:59 (15acd01 ticks)
ADSL uptime     1:35:36
--- error-down ---
FEC error interleaved: 51721
CRC error interleaved: 1557
HEC error interleaved: 5775
--- error-up ---
FEC error interleaved: 141
CRC error interleaved: 170
HEC error interleaved: 174
--- error-second ---
Error second in 15min           : 5
Error second in 24hr            : 73
Error second after power-up     : 73
--- margin ---
noise margin downstream: 5.0 db
--- rate-down ---
 4416 kbps
--- rate-up ---
 448 kbps


I had been trying to figure out more exactly what was going on with the sync speed fluctuations.   :-\
I am well accustomed to the more extensive (and to me more understandible) BCM style of data.

Unfortunately I am not finding the zynos cli data to be quite so immediately useful so far.

I do have some data from a previous telnet logs.

Are you using M$ windows?
If so you can log your telnet cli sessions if you use the -telnet -log options to putty.exe   :)

It would indeed be progress to be able to properly understand what is happening with interleave depth, trellis, data redundany ratio etc.
 
As far as I can tell from some obsolete documentation for zynos Mediatek based DSLAMs that Google found on the net,
this might be related to atuc and atur.
How exactly to find out I am not completely sure.  :(

Quote
ATUC/ATUR SES
The Number of Severely Errored Seconds transmitted (downstream) or
received (upstream) on this ADSL port. Severely errored seconds contained
30% or more errored blocks or at least one defect. This is a subset of the
Down/Up Stream ES



This might be useful.
 
tc> wan dmt msg1
max no of bits per tone 15
transmit PSD -40
atuc fm 3 atur fm 3
EES 1
trellis code 1
vendor rev. 0
T1.413 rev. 0
verdor id 0x0
min required SNR 6
crc2=c05b,crc2_cal=c05b
dn_snr_margin 2304,r_msgs1_trellis_opt 1
tc>

and this
tc> wan dmt msg_ra
max allowed margin 31
min required margin 0
new min required margin 6
c_msgsra_min_snr_margin=6
crc_ra2=755f,crc_ra2_cal=755f
r_msgra_r=0
r_msgra_k=146
r_msgra_ncloaded=161
r_msgra_lp_attenu=127
r_msgra_coding_gain=0
r_msgra_perf_margin=6
r_msgra_dmax=64
r_msgra_bmax=1168
dn_snr_margin 2304
tc>


tc> wan adsl linedata near
relative capacity occupation: 113%
noise margin downstream: 4.5 db
output power upstream: 12.5 dbm
attenuation downstream: 63.5 db
tc>

Also - an immediately useful BCM linestats figure was the Max Possible Data Rate.
So at a glance you could see how your instantaneous rate compared to the Max Possible Rate.

As far as I can tell, you _might_ me able to construct an equivalent by working backwards from the current sync rate and the 'relative capacity occupation', but I have already spent substantial time on this, .... and my new Broadcom based Billion 8800 arrived.

Would I be correct in assuming that you resolved you issues with your firebrick routing and that you are able to access the telnet and http ports on your modem?

Most of the Pieces are there.
It looks like I may have found K and R
in
r_msgra_r=0 and r_msgra_k=146

We should now have access to most of what is depicted here:
http://www.kitz.co.uk/adsl/linestats_errors.htm

 
Just to be clear here.

I have the impression that the modem chipset+adsl binary firmware does quite a good job of syncing and,
most importantly on a slow or unstable line, _re-syncying_.

The Primary Problem for me is that I am stuck on 20CN (i.e. ADSL1)
This means that I get needlessly hammered by IPProfile restriction for days, weeks and infact MONTHS !!!

At one point it took 34 DAYS for DLM to stop punishing me for a single slow resync. !!!   :'(

For my situation, I need a modem that minimises this issue.

I had been persevering with the TrendChip TC3162 / Zynos / D-Link  combo because experience has shown that you need to give DLM a MINIMUM of 10+ DAYS to settle down before you can know if the effects you are seeing might be transitory.

I don't know if I have the patience to endure even slower than usual internet for the full 35 days required to be sure.  :(
Especially when I cannot actually glean all the information that I would like from the chipset / OS / modem.

I am very heavily tending to the idea of reverting back to the 'known quantity' that is the  Broadcom / Linux / Billion
 combination.
 

Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on February 27, 2016, 12:04:50 PM
 
[
Unfortunately I am not finding the zynos cli data to be quite so immediately useful so far.

I do have some data from a previous telnet logs.

>Are you using M$ windows?

I have a Windows box, I mostly use my iPad these days since I became ill and have found it uncomfortable to sit upright at a desk. I have a telnet client for iOS, I'm sure. The Firebrick router blocks access to the modems (thank goodness) from the LAN side, but I could of course plug a monitoring device straight into a modem.

> Would I be correct in assuming that you resolved you issues with your firebrick routing and that you are able to access the telnet and http ports on your modem?

No I never solved that, I chose not to pursue it, partly due to fatigue and pain and partly because of other distractions. I'm very glad the modems are as isolated as possible, so no rogue device on the LAN can get at the admin http etc services. I haven't changed the default admin IP but I might change the default admin password and username if possible after reading your belt and braces post. I normally never ever leave any device on admin defaults, but they are physically secured and I keep having to swap them out with successive lightning strikes, so ease of swap out is a convenience thing. I'm pre-programming some now in addition to what AA do but it's difficult to find out what works in the web UI and what is a red herring dummy control.

> This means that I get needlessly hammered by IPProfile restriction for days, weeks and infact MONTHS !!!
I sympathise, having been on ADSL1 until Xmas.
> At one point it took 34 DAYS for DLM to stop punishing me for a single slow resync. !!!   :'(

>For my situation, I need a modem that minimises this issue.

>I had been persevering with the TrendChip TC3162 / Zynos / D-Link  combo because experience has shown that you need to give DLM a MINIMUM of 10+ DAYS to settle down before you can know if the effects you are seeing might be transitory.

Sorry, not following you. :-) Are you saying that DLM is punishing you for the modem's unstable behaviour or the experimental activity that you've had to do?

Do you need more interleave or some such? Are you able to get the HEC errors, a disaster, under control?

I try to stay on the right side of the evil DLM gods. I run my three modems on a UPS (with double output filtering as the output is not a clean sine wave I suspect, but a horrid staircase) and never usually turn it off without waiting the Kitz half hour.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 27, 2016, 03:27:12 PM

The Firebrick router blocks access to the modems (thank goodness) from the LAN side, but I could of course plug a monitoring device straight into a modem.

So, out of the 3 of us that have this modem, I am the only one who is actually trying to monitoring the performance of the line.


I'm pre-programming some now in addition to what AA do but it's difficult to find out what works in the web UI and what is a red herring dummy control.
Having spent some hours exploring the cli via telnet and more hours exploring the GUI via curl I can assure you that
every feature that I have examined in the web interface maps directly to a 'user space call' ( in the common vocabulary of Linux programmer/admin) available on the cli   ;) 
 
You can test the truthfulness of a GUI setting by exercising the associated command in a telnet session.

The Menu pane on the Left of the Web GUI layout is javascript driven and a bit of a dogs breakfast to work with -  yet another contributor of my lack of confidence in the 'security' provided.  :(
 
Anyone  can use the (curl) code that I posted to login and make calls directly to the service behind the features you see in the GUI.
I has been well over a decade since I was last paid to do web development, but it only took me 10 minutes to figure out how to hack around it, and 3 hours to implement it.
Not a good sign.  :(

This again worries me deeply, and contributes to me not wanting to have it accessible to the LAN- as it is at the moment.  :(

I need to be able to monitor the ADSL chipset performance, and to do that permanently I would only be comfortable plugging it into an isolated monitoring network (via either a dedicated or a programable switch) accessed solely via my RasPi proxy.

On balance, for me, it seem like a lot of effort powering yet another device (the switch) to work around the issue of only having 1 RJ45 connector, for a device whose apparent strengths will only be able to shine if my exchange ever gets upgraded to 21CN and ADSL2.

IIRC you mentioned that you prefer to keep all modems on the same IP, but maybe I picked that up wrong?
I was assuming you firebrick does not have 3 wan ports and that you are multiplexing via VLANS ?

If so a small configurable switch that understands VLANS (and trunking) like a NETGEAR GS108Tv2
would seem to be an ideal setup for you though!

Sorry, not following you. :-) Are you saying that DLM is punishing you
It is the low IPProfile that is punishing me, but yes.

Are you saying that DLM is punishing you for the modem's unstable behaviour
One of the many frustrations with 20CN DLM is that it is quite difficult to know what it is doing, or why it is doing it.
You have to be logging and watching pretty closely to work it out.
One of the possibilities that I allow for is that the speed drops and resyncs are being caused by a developing line fault, and not the modems fault at all.

If I could see the interleave depth changing when the modem resyncs, I could see if DLM was ramping up error correction ( probably line fault or bad modem) or easing off on the error correction redundancy- speeding up my connection.

Are you saying that DLM is punishing you for the modem's unstable behaviour or the experimental activity that you've had to do?
Ha! I have not even tried the 'adjust the SNR' feature yet.
First I have to wait for DLM to stabilise, and I have to have good monitoring to observe the results of any experimentation.
If the chipset/firmware/OS is already acheiving  the most that can be extracted, then my fiddling can only make it worse.  ::)

Do you need more interleave or some such? Are you able to get the HEC errors, a disaster, under control?
I wish I had that data. Even if I did, ajusting it is entirely in the Lap of the DLM gods.  :(

Anyhoo it's the weekend and the sun is shining. I'm off out to enjoy it!  :cool:
Title: Re: DLink DSL-320B-Z1 updated telnet scipts.
Post by: G.DMT on February 27, 2016, 10:57:12 PM
In the quest to discover _why_ the modem has been performing so many resynchs
i.e.  Try and understand did poor line conditions/fault/etc cause a resynch and DLM is ramping up error redundancy to compensate or did was the modem forced to resynch by a DLM interventions e.g. line good and DLM backing off on error overhead?

I added some more data collection to the telnet scripts.

Now also reports:
relative capacity occupation:

Scraped from:
tc> wan adsl linedata near

Added a new telnet function:
telnet_show_msgra which calls:

tc> wan dmt msg_ra

seeking to confirm the hunch that the values
r_msgra_k=129
r_msgra_r=0

Are equivalent to
K (Number of bytes in DMT frame)
R (Number of check bytes in RS Code word)

Much as described here:
http://www.kitz.co.uk/adsl/linestats_errors.htm

Now there are 36 lines of output.
The last 14 are exactly as collected,
as I did not want to throw anything away until I could be sure I understood what I was looking at.
 
[root@k8 plink-stats]# ./get-stats.sh   
 system up time:     0:38:52 (38f47 ticks)
ADSL uptime     0:38:22
--- error-down ---
FEC error interleaved: 22004
CRC error interleaved: 173
HEC error interleaved: 673
--- error-up ---
FEC error interleaved: 21
CRC error interleaved: 12
HEC error interleaved: 13
--- error-second ---
Error second in 15min           : 0
Error second in 24hr            : 8
Error second after power-up     : 8
--- margin ---
noise margin downstream: 6.5 db
--- rate-down ---
 3904 kbps
--- rate-up ---
 448 kbps
tc> relative capacity occupation: 115%
tc> max allowed margin 31
min required margin 0
new min required margin 6
c_msgsra_min_snr_margin=6
crc_ra2=755f,crc_ra2_cal=755f
r_msgra_r=0
r_msgra_k=129
r_msgra_ncloaded=145
r_msgra_lp_attenu=127
r_msgra_coding_gain=0
r_msgra_perf_margin=6
r_msgra_dmax=64
r_msgra_bmax=1032
dn_snr_margin 2304

Any hints, advices or even guesses how to proceed with extracting or understanding the Interleave Depth / trellis /  Reed Solomon / Error Correction information will be gratefully received.  :)
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: ejs on February 28, 2016, 08:21:18 AM
A lot of the things seen in the output here are more or less direct references to messages that are part of the ADSL1 protocol. You need to refer to the ITU G.992.1 PDF (http://www.itu.int/rec/T-REC-G.992.1-199907-I)

rates_ra corresponds to the C-RATES-RA and R-RATES-RA messages, which give
RSI number of parity bytes per symbol in the interleave buffer
S number of symbols per codeword
I interleave depth in codewords

Quote
wan dmt rates_ra =>
opt0 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|132   0   0   0   0   0   0| 14   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4

The rates_ra messages give 4 options which were considered, and the later rates2 messages indicate which option was chosen, although the RSI, S and I parameters were the same for all 4 rates_ra options in the wan_dsl_diag.txt data you posted.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 28, 2016, 11:19:17 AM
A lot of the things seen in the output here are more or less direct references to messages that are part of the ADSL1 protocol. You need to refer to the ITU G.992.1 PDF (http://www.itu.int/rec/T-REC-G.992.1-199907-I)

Thankyou ejs.    :thumbs:   

Kitz forums comes up trumps again.  :clap:

I have downloaded the English pdf from this link:
https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-G.992.1-199907-I!!PDF-E&type=items

256 pages may take me a little while to digest.   ;)

rates_ra corresponds to the C-RATES-RA and R-RATES-RA messages, which give
RSI number of parity bytes per symbol in the interleave buffer
S number of symbols per codeword
I interleave depth in codewords

Quote
wan dmt rates_ra =>
opt0 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|132   0   0   0   0   0   0| 14   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4

The rates_ra messages give 4 options which were considered, and the later rates2 messages indicate which option was chosen, although the RSI, S and I parameters were the same for all 4 rates_ra options in the wan_dsl_diag.txt data you posted.

That is great info for me.  So I scripted grabbing the relevant raw data.

[root@k8 plink-stats]# ./get-inter.sh
 system up time:    13:35:21 (4aa5f9 ticks)
ADSL uptime     3:32:55
--- msg_ra.sh ---
tc> max allowed margin 31
min required margin 0
new min required margin 6
c_msgsra_min_snr_margin=6
crc_ra2=755f,crc_ra2_cal=755f
r_msgra_r=0
r_msgra_k=144
r_msgra_ncloaded=158
r_msgra_lp_attenu=127
r_msgra_coding_gain=0
r_msgra_perf_margin=6
r_msgra_dmax=64
r_msgra_bmax=1152
dn_snr_margin 2304
--- rates1.sh ---
tc> opt0 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|238   0   0   0   0   0   0| 14   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  1,I= 16
opt1 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|161   0   0   0   0   0   0| 10   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  1,I= 16
opt2 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER| 84   0   0   0   0   0   0|  6   0   0
DS:RSf=  0,RSi= 10,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  1,I= 16
opt3 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|  5   0   0   0   0   0   0|  2   0   0
DS:RSf=  0,RSi=  6,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  1,I= 16
crc1=f5b4,crc1_cal=f5b4
--- rates_ra.sh ---
tc> opt0 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|139   0   0   0   0   0   0| 14   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
opt1 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|136   0   0   0   0   0   0| 13   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
opt2 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|133   0   0   0   0   0   0| 12   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
opt3 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|130   0   0   0   0   0   0| 11   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
r-rates-ra 0x1
crc_ra1=9e2a,crc_ra1_cal=9e2a
--- rates2.sh ---
tc> c-rates2 0x21,r-rates2 0x22
crc4=308b,crc4_cal=308b

But I still can't quite see how to make the connection from

--- rates2.sh ---
tc> c-rates2 0x21,r-rates2 0x22
crc4=308b,crc4_cal=308b


to selecting the correct option block.  :hmm:

In case it might be useful I dumped a 'wan adsl diag' to file and will attach that here.

[root@k8 plink-stats]# source plink-stats.sh
[root@k8 plink-stats]# telnet_diagnostic > wan_adsl_diag.out.txt

Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: ejs on February 28, 2016, 01:05:11 PM
The C-RATES2 message is described on page 108, section 10.8.11. I was going to say you have to convert the hex to binary, but looking at the bit patterns, you don't really have to do that. It's always going to be two hex digits, which will be 1,2,4 or 8 corresponding to option 1,2,3 and 4. The right hex digit must be for downstream and the left digit must be for upstream. It also says the C-RATES2 is the final one, and the ATU-C won't change the downstream option from the one in R-RATES2 it received.

So R-RATES2 0x22 indicates that the ATU-R (your modem) chose downstream option 2 and upstream option 2, and the C-RATES2 0x21 indicates the ATU-C (the DSLAM at the exchange) stayed with downstream option 2, which the PDF says it must, and decided on upstream option 1. I think that would indicate the 136 and 14 values from the rates_ra tables.

To confuse things further, I've written the above mostly based on the G.992.1 PDF, which calls them options 1,2,3 and 4, but I've just noticed they've been numbered 0-3 in the stats output.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on February 28, 2016, 10:18:50 PM
@ejs Thanks a million!  ;D

Thats really going the extra mile!  :thumbs:

I was able to whip up some regexes to strip out hex digits from c-rates2
and print out the (hopefully!) correct option table(s) to match.

[root@k8 plink-stats]# ./get-inter.sh
 system up time:    24:40:46 (8791b0 ticks)
ADSL uptime     1:48:09
--- msg_ra.sh ---
tc> max allowed margin 31
min required margin 0
new min required margin 6
c_msgsra_min_snr_margin=6
crc_ra2=755f,crc_ra2_cal=755f
r_msgra_r=0
r_msgra_k=132
r_msgra_ncloaded=147
r_msgra_lp_attenu=127
r_msgra_coding_gain=0
r_msgra_perf_margin=6
r_msgra_dmax=64
r_msgra_bmax=1056
dn_snr_margin 2304
--- rates1.sh ---
tc> opt0 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|238   0   0   0   0   0   0| 14   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  1,I= 16
opt1 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|161   0   0   0   0   0   0| 10   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  1,I= 16
opt2 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER| 84   0   0   0   0   0   0|  6   0   0
DS:RSf=  0,RSi= 10,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  1,I= 16
opt3 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|  5   0   0   0   0   0   0|  2   0   0
DS:RSf=  0,RSi=  6,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  1,I= 16
crc1=f5b4,crc1_cal=f5b4
--- rates_ra.sh ---
opt0 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|125   0   0   0   0   0   0| 14   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
opt1 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|123   0   0   0   0   0   0| 13   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
opt2 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|121   0   0   0   0   0   0| 12   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
opt3 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|119   0   0   0   0   0   0| 11   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
r-rates-ra 0x1
crc_ra1=5e70,crc_ra1_cal=5e70
--- rates2.sh ---
c-rates2 0x41
r-rates2 0x44
first_digit_r_rates2: 4
last_digit_r_rates2: 4
first_digit_c_rates2: 4
last_digit_c_rates2: 1
OptName_D: opt2
OptName_U: opt0
opt2 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|121   0   0   0   0   0   0| 12   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4
opt0 +AS0-AS1-AS2-AS3-LS0-LS1-LS2+LS0-LS1-LS2
FAST |  0   0   0   0   0   0   0|  0   0   0
INTER|125   0   0   0   0   0   0| 14   0   0
DS:RSf=  0,RSi= 16,S=  1,I= 32
US:RSf=  0,RSi=  2,S=  8,I=  4


Once again - BIG BIG thanks to ejs for spelling it out for me so clearly.  :)  :)  :)

I will test this for a few days to check it out, and if it seems reliable I will clean up the output and post the code.
 :cool:
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on February 29, 2016, 08:07:20 AM
@g.dmt - the firebrick has four Ethernet ports, I have configured three of them to be connected directly to the other three modems. If you wish to have more, the FB itself speaks VLAN tags, you just would have to tell it which VLAN tag value you are using for which modem.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Chunkers on March 02, 2016, 10:21:17 AM
I have been testing my four different devices on my line as previously suggested and thought I would share the results, <disclaimer> they are obviously totally non-scientific, probably not repeatable and largely only applicable to me :)

(https://forum.kitz.co.uk/proxy.php?request=http%3A%2F%2Fi43.photobucket.com%2Falbums%2Fe352%2FJolltax%2FCrap%2FADSL%2520Table_zpsfmyq4qwk.jpg&hash=d0815b1f77ba5258268f3b97ac36907b680609d8)

Sorry I haven't achieved the level of geekiness with the CLI stuff but I am not really that committed, hehe.  Some points of note :

Cool beans!

Chunks
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on March 02, 2016, 11:38:45 AM
Thank you very, very much Chunkers for that excellent study. Superb.

The earlier thread about DSL-320B-xx hardware variants mentions the specific chip used -
    http://forum.kitz.co.uk/index.php/topic,16583.msg306507.html#msg306507

[ It's very annoying when manufacturers reuse the same model names for completely new hardware. Car manufacturers do it I suppose. Does that legitimise this? ]
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: G.DMT on March 02, 2016, 07:00:34 PM
That is brilliant Chunkers!

Thanks so much for posting this useful comparison.

And here is a link that I had meant to post previously with some technical details of the chipset.

https://wikidevi.com/wiki/TrendChip

My first guess would be that the DLink DSL-320B-Z1 uses the TC3162LEM chipset combined with TC3086 Analog Front End.

A Launch date sometime back in June 2011 would make this silicon obsolete.

5 years is a very, very long time in the semiconductor industry.
Silicon years age even faster than dog years! 

So my best guess would be that it may well use the later  TC3182(P)    TC3086/7 combination.

It is not unheard of for low volume silicon  producers like this to just bake one wafer type, then hobble, not activate some functionality to enable them to sell it at a lower price while thus preventing devalueing the 'fully featured' version.

In fact IIRC the TP-Link TD-W8980 that you have uses the identical modem chipset to the
TP-Link TD-W8970 that I have, which has VDSL non-enabled.

https://wiki.openwrt.org/toh/tp-link/td-w8980
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on March 02, 2016, 07:58:19 PM
> A Launch date sometime back in June 2011 would make this silicon obsolete.

> 5 years is a very, very long time in the semiconductor industry.
> Silicon years age even faster than dog years! 

I had wondered if the age of the chipset is the reason why it works so well on my ultra-long line. It dates from an era when ADSL was the priority, and G.Dmt was still very much around, compared with a later era when ADSL performance might have become an ugly sister to the real priority which was VDSL2. This reasoning says also that kit from that earlier era would have got extensively testing on G.Dmt and on high attenuation lines.
Title: Re: DLink DSL-320B-Z1 first impressions.
Post by: Weaver on March 02, 2016, 09:02:33 PM
[Bump. Apologies for re-advertising this.]

Would anyone be kind enough to check the enable-bitswap UI thing (in modem mode) for me? See:
      http://forum.kitz.co.uk/index.php/topic,17065.msg314628.html#msg314628

I'm really out of it at the moment, been quite ill the past few days, from Sunday morning onwards. That's why I'm asking, and even though I'm now doing better, I still don't have the energy nor concentration to do it myself.

If you need a DSL-320B-Z1 modem, I can send you one, if that helps.