NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Retired_Member
Jan 01, 2021How to tell what the negotiated link speed of the LAN ports are (in cli)?
Hi, I have a R6220 router and a question. Is there a option to get statistic of ports in router command line? On web interface (ADVANCED > Internet Port > Show Statistics) i can see a nice summary (...
Retired_Member
Jan 01, 2021If you can find a way in, then it might be possible to puzzle out
where the "Show Statistics" page gets its values.
I tried to do this before asking the question here on the form. Unfortunately, the grep command goes on forever and doesn't return anything meaningful. I am looking for e.g.
grep 1000M / tmp / * -r grep 10000 / proc / * -r
I was hoping that someone here knows the location of the files where this data is entered. :)
antinode
Jan 02, 2021Guru
> [...] Unfortunately, the grep command goes on forever and doesn't
> return anything meaningful. [...]
_That_ (cheap and nasty) "grep" command might. There could be things
under "/dev" (and perhaps FIFOs elsewhere) which simply return no data,
causing such a command to hang. A more selective search might work
better. For example:
find / -xdev -type f -exec /sbin/grep 1000M {} \; -print
Around here, that found "ethctl" and "ethswctl". See "ethctl", below.
> I was hoping that someone here knows the location of the files where
> this data is entered.
Someone else might. I managed to stumble into the /sys interface:
ls -Ll /sys/class/net/eth*
For example:
# cat /sys/class/net/eth4/operstate
up
Sadly, all the interesting bits failed:
# cat /sys/class/net/eth4/duplex
cat: read error: Invalid argument
# cat /sys/class/net/eth4/speed
cat: read error: Invalid argument
Interestingly, "ifconfig" reports also lack these data. For example:
# ifconfig eth2
eth2 Link encap:Ethernet HWaddr 50:6A:03:E9:AE:86 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:7085 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:1751635 (1.6 MiB)
I assume that there's some subtlety (virtualness?) in these entities
which hides the physical detail. But I know nothing.
One interesting fact which I gleaned while wasting too much time on
this was that on my D7000, "eth1" = "LAN4, ... "eth4" = "LAN1".
I did also find ("find", that is) an "ethctl" command, and that seems
to provide the pay-off (at long last):
# ethctl eth1 media-type
Auto-negotiation enabled.
Link is down
# ethctl eth2 media-type
Auto-negotiation enabled.
The autonegotiated media type is 100baseTx-FD.
Link is up
# ethctl eth4 media-type
Auto-negotiation enabled.
The autonegotiated media type is 1000BT Full Duplex
Link is up
Who could ask for more (other than consistent abbreviations)?
That was educational. Might also answer an old question about how to
fix the characteristics of an interface (and prevent Auto-negotiation).
Until Netgear decides to disable all practical shell access, that is.
- antinodeJan 02, 2021Guru
Closer to a complete list:
# ethctl eth1 media-type # NC
Auto-negotiation enabled.
Link is down# ethctl eth2 media-type # 10BaseT
Auto-negotiation enabled.
Link is up# ethctl eth3 media-type # 100BaseT
Auto-negotiation enabled.
The autonegotiated media type is 100baseTx-FD.
Link is up# ethctl eth4 media-type # 1000BaseT
Auto-negotiation enabled.
The autonegotiated media type is 1000BT Full Duplex
Link is up- DragoDuIIJan 03, 2021Aspirant
I had to delete my old account and create a new one.
antinode thx for investigating, but unfortunately my router has worst OS.
My WAN port is eth3:# cat /sys/class/net/eth3/operstate unknown # cat /sys/class/net/eth3/speed cat: read error: Invalid argument
So its look like OS is not aware of "operstate" of interface. Maybe only Netgear app can read those values.
> nasty) "grep" command might.
Unfortunately, the corrected grep does not see anything that could lead me to the trail.
> Around here, that found "ethctl" and "ethswctl". See "ethctl", below.
I don't have "ethctl" nether "ethswctl" command.
> Interestingly, "ifconfig" reports also lack these data. For example:
Is far i know "ifconfig" get data from "/proc".
My setup is:# cat /tmp/etc/version V1.1.0.106_1.0.1 # uname -ar Linux R6220 2.6.36 #2 SMP Wed Dec 2 11:45:31 CST 2020 mips unknown # sh --help BusyBox v1.12.1 (2020-11-26 15:15:15 CST) multi-call binary
Any others ideas? :)- antinodeJan 07, 2021Guru
> So its look like OS is not aware of "operstate" of interface. Maybe
> only Netgear app can read those values.Any "Netgear app" must get its data from something in the OS.
I don't have an R6220, so I know nothing.
> Unfortunately, the corrected grep does not see anything that could
> lead me to the trail.Look for "1000" instead of 1000M"? Look at the HTML and/or
JavaScript for clues?