hack-gpon / hack-gpon.github.io

https://hack-gpon.org/
MIT License
152 stars 81 forks source link

Can't get telnet to D-LINK DPN-100 Rev C1 #299

Closed alexojegu closed 7 months ago

alexojegu commented 7 months ago

I have purchased D-LINK DPN-100 Rev C1 and I am trying to use it on a Turris Omnia with OpenWrt 23.05.2 but I cannot connect via telnet.

I have configured the eth2 interface in the range 192.168.100.0/24:

config interface 'ont'
    option device 'eth2'
    option proto 'static'
    option ipaddr '192.168.100.2'
    option netmask '255.255.255.0'

The interface is up and running:

# ifconfig eth2
eth2      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX 
          inet addr:192.168.100.2  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::da58:d7ff:fe00:60c1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:21 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1021 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1024 
          RX bytes:1374 (1.3 KiB)  TX bytes:276760 (270.2 KiB)
          Interrupt:48

Ping to 192.168.100.1 responds correctly:

# ping -c 3 192.168.100.1
PING 192.168.100.1 (192.168.100.1): 56 data bytes
64 bytes from 192.168.100.1: seq=0 ttl=64 time=0.586 ms
64 bytes from 192.168.100.1: seq=1 ttl=64 time=0.465 ms
64 bytes from 192.168.100.1: seq=2 ttl=64 time=0.448 ms

--- 192.168.100.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.448/0.499/0.586 ms

But I cannot connect via telnet:

# nc 192.168.100.1 23
nc: can't connect to remote host (192.168.100.1): Connection refused

Am I forgetting something?

Can you give me some help @stich86, @simonebortolin, @nanomad, @Andreag00

stich86 commented 7 months ago

If firmware is 039, Telnet was closed, only stick with old firmware 033e had Telnet enabled.

Only way to unlock is a firmware update over OMCI (you need an OLT)

alexojegu commented 7 months ago

Shit!

Thanks @stich86. Any recommendation for a sfp ONT with open access to be able to change the PLOAM (if possible in hexadecimal format)?

stich86 commented 7 months ago

You can buy ODI or LEOX stick, both can enter PLOAM on hex without problem on latest firmware :)

alexojegu commented 7 months ago

Oops, all ODI or LEOX with SFP format have SC/UPC optics, I would need SC/APC...

stich86 commented 7 months ago

Just get a converter or a cable that is UPC/APC :)

alexojegu commented 7 months ago

I like the ODI DFP-34X-2C2 but I can't find it at a decent price (more than 100€), it's only cheaper on Alibaba where I have never bought and may end up needing to pay import fees (I bought the D-LINK DPN-100 Rev C1 for 7€ used, from Italy).

Any opinions about the Technicolor AFM0003? I can buy it for 19.90€ used, from Italy. Do you know if it have telnet closed in any version of firmware? It seems that it is possible to connect to it using UART, I don't know if I can find more information on how to do it (The HSGMII doesn't seem to work, but I'm not sure if I need it. My Internet connection is 500Mb and I receive 3 VLANs).

Thanks again @stich86.

stich86 commented 7 months ago

yes AFM0003 from TIM or FWB has telnet\ssh enabled, do no get ILD version that has everything closed

alexojegu commented 7 months ago

I already have the Technicolor AFM0003 and I can connect via telnet (without username or password) perfectly.

Now the next step is to configure the hexadecimal PLOAM (O2 Spain), I have tried with: https://github.com/zry98/SFP-GPON-ONU (The device does not have vi but it have sed) but the filesystem is read-only:

# mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
ramfs on /var type ramfs (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
mdev on /dev type tmpfs (rw,relatime)
/dev/mtdblock3 on /var/config type yaffs2 (rw,relatime)
# df
Filesystem           1k-blocks      Used Available Use% Mounted on
rootfs                    2432      2432         0 100% /
/dev/root                 2432      2432         0 100% /
/dev/mtdblock3           24576      1216     23360   5% /var/config
# cd /etc/scripts/
# echo "pepe" > test.txt
sh: can't create test.txt: Read-only file system

I have also tried to create a copy of mtd7 to transfer it to my ArchLinux PC to edit runomci.sh but it got stuck:

# cd /tmp
# cat /dev/mtd7 > mtd7        # And frozen after a while
# ls -l /dev/
crw-rw----    1 admin    0          5,   1 Jan  1 00:00 console
crw-rw----    1 admin    0         10,  63 Jan  1 00:00 cpu_dma_latency
crw-rw----    1 admin    0          1,   7 Jan  1 00:00 full
crw-rw----    1 admin    0         10, 229 Jan  1 00:00 fuse
crw-rw----    1 admin    0          1,  11 Jan  1 00:00 kmsg
crw-rw----    1 admin    0          1,   1 Jan  1 00:00 mem
crw-rw----    1 admin    0         90,   0 Jan  1 00:00 mtd0
crw-rw----    1 admin    0         90,   1 Jan  1 00:00 mtd0ro
crw-rw----    1 admin    0         90,   2 Jan  1 00:00 mtd1
crw-rw----    1 admin    0         90,  20 Jan  1 00:00 mtd10
crw-rw----    1 admin    0         90,  21 Jan  1 00:00 mtd10ro
crw-rw----    1 admin    0         90,  22 Jan  1 00:00 mtd11
crw-rw----    1 admin    0         90,  23 Jan  1 00:00 mtd11ro
crw-rw----    1 admin    0         90,  24 Jan  1 00:00 mtd12
crw-rw----    1 admin    0         90,  25 Jan  1 00:00 mtd12ro
crw-rw----    1 admin    0         90,  26 Jan  1 00:00 mtd13
crw-rw----    1 admin    0         90,  27 Jan  1 00:00 mtd13ro
crw-rw----    1 admin    0         90,   3 Jan  1 00:00 mtd1ro
crw-rw----    1 admin    0         90,   4 Jan  1 00:00 mtd2
crw-rw----    1 admin    0         90,   5 Jan  1 00:00 mtd2ro
crw-rw----    1 admin    0         90,   6 Jan  1 00:00 mtd3
crw-rw----    1 admin    0         90,   7 Jan  1 00:00 mtd3ro
crw-rw----    1 admin    0         90,   8 Jan  1 00:00 mtd4
crw-rw----    1 admin    0         90,   9 Jan  1 00:00 mtd4ro
crw-rw----    1 admin    0         90,  10 Jan  1 00:00 mtd5
crw-rw----    1 admin    0         90,  11 Jan  1 00:00 mtd5ro
crw-rw----    1 admin    0         90,  12 Jan  1 00:00 mtd6
crw-rw----    1 admin    0         90,  13 Jan  1 00:00 mtd6ro
crw-rw----    1 admin    0         90,  14 Jan  1 00:00 mtd7
crw-rw----    1 admin    0         90,  15 Jan  1 00:00 mtd7ro
crw-rw----    1 admin    0         90,  16 Jan  1 00:00 mtd8
crw-rw----    1 admin    0         90,  17 Jan  1 00:00 mtd8ro
crw-rw----    1 admin    0         90,  18 Jan  1 00:00 mtd9
crw-rw----    1 admin    0         90,  19 Jan  1 00:00 mtd9ro
brw-rw----    1 admin    0         31,   0 Jan  1 00:00 mtdblock0
brw-rw----    1 admin    0         31,   1 Jan  1 00:00 mtdblock1
brw-rw----    1 admin    0         31,  10 Jan  1 00:00 mtdblock10
brw-rw----    1 admin    0         31,  11 Jan  1 00:00 mtdblock11
brw-rw----    1 admin    0         31,  12 Jan  1 00:00 mtdblock12
brw-rw----    1 admin    0         31,  13 Jan  1 00:00 mtdblock13
brw-rw----    1 admin    0         31,   2 Jan  1 00:00 mtdblock2
brw-rw----    1 admin    0         31,   3 Jan  1 00:00 mtdblock3
brw-rw----    1 admin    0         31,   4 Jan  1 00:00 mtdblock4
brw-rw----    1 admin    0         31,   5 Jan  1 00:00 mtdblock5
brw-rw----    1 admin    0         31,   6 Jan  1 00:00 mtdblock6
brw-rw----    1 admin    0         31,   7 Jan  1 00:00 mtdblock7
brw-rw----    1 admin    0         31,   8 Jan  1 00:00 mtdblock8
brw-rw----    1 admin    0         31,   9 Jan  1 00:00 mtdblock9
crw-rw----    1 admin    0         10,  62 Jan  1 00:00 network_latency
crw-rw----    1 admin    0         10,  61 Jan  1 00:00 network_throughput
crw-rw----    1 admin    0          1,   3 Jan  1 00:00 null
crw-rw----    1 admin    0         10,  60 Jan  1 00:00 omcidrv
crw-rw-rw-    1 admin    0          2,   0 Jan  1 00:25 ptyp0
crw-rw----    1 admin    0          2,   1 Jan  1 00:00 ptyp1
crw-rw----    1 admin    0          1,   8 Jan  1 00:00 random
lrwxrwxrwx    1 admin    0               9 Jan  1 00:00 root -> mtdblock5
crw-rw----    1 admin    0          5,   0 Jan  1 00:00 tty
crw-rw----    1 admin    0          4,  64 Jan  1 00:00 ttyS0
crw-------    1 admin    0          3,   0 Jan  1 00:25 ttyp0
crw-rw----    1 admin    0          3,   1 Jan  1 00:00 ttyp1
crw-rw----    1 admin    0          1,   9 Jan  1 00:00 urandom
crw-rw----    1 admin    0          1,   5 Jan  1 00:00 zero

Any suggestions?

simonebortolin commented 7 months ago

RTFM https://hack-gpon.org/ont-technicolor-afm0003/ for the ploam.

If you are in O2 the problem is NOT the ploam.

alexojegu commented 7 months ago

I have read the manual and it tells me how to configure a PLOAM of 10 ASCII characters but I need to configure a PLOAM of 20 hexadecimal characters (some of them non-printable).

That's why I'm asking for any suggestions to be able to edit /etc/runomci.sh or if anyone knows a compatible firmware that allows configuring a PLOAM of 20 non-printable hexadecimal characters.

I have tried the following:

# cd /tmp
# cp -a /etc/runomci.sh .
# sed -i 's/gpon_ploam_pwd=.*/gpon_ploam_pwd=$(echo -ne "\\xf0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00")/g' runomci.sh
# kill 383    # pid omci_app
# ./runomci.sh

And, I will have to do more tests, but it seems to work (I think the correct operation state is O5):

# diag gpon get onu-state
gpon get onu-state 
ONU state: Operation State(O5)

But I want something more definitive, that works automatically after a power loss.

simonebortolin commented 7 months ago

Ummmh ok. This is a good problem.

alexojegu commented 7 months ago

The echo -ne "" trick doesn't work with all hexadecimal PLOAMs, fails with those with \x00 (NULL) in the middle like mine.

For example using this PLOAM f1230000045678900000 when checked with diag gpon get password-hex has been transformed into f1230456789000000000.

I will close this issue, but if anyone has any ideas or knows of any firmware for Realtek RTL9601CI that accepts PLOAM in hexadecimal format, let me know (I can try to replace omci_app in rootfs).

simonebortolin commented 7 months ago

No sorry, only odi...