T-mobile fiber optic direct to Edgerouter

Posted on Feb 12, 2023 Network

Would it be possible to connect the T-mobile fiber directly into my Edge Router 4? Here I describe the steps I took.

Background

Since Januari 2022 T-mobile allows customers to use their own router. The most simple way to do this is to connect the Huawei media converter via an ethernet cable to your modem. The main purpose of the media converter is to convert the fiber optic signal to an electric signal, which means it is a network component that needs its own power supply. It is also considered part of the T-mobile infrastructure and managed by T-mobile.

Challenge

Ever since I've had an unused SFP port on my Edgerouter I wanted to do something useful with it. Taking the media converter out of the loop seemed a good reason to do so.  After some searching I learned that you can register the MAC address of your own media converter with T-mobile, but anytime there is an issue with the Internet connection you would first have to restore the MAC address of the T-mobile managed media converter. All could potentially lead to several days of delay.

The best way forward is to use an SFP module that allows configuration of the MAC address. The GPON SFP ONU Stick with Mac does exactly that.  Here a picture of the stick inserted into the Edge Router 4. 

Fiber optic connection to SFP module

Configuration

The GPON SFP ONU Stick has been successfully configured by others for a Mikrotik router. For another provider (freedom.nl) others have reported successful configuration. It took some trial and error to be able to login to the ONU stick from the Edge Router. Eventually the following steps worked:

Have the following settings in your router config:


ethernet eth3 {                                  
        address 192.168.1.15/24      
        duplex full   
        speed 1000    
} 

Insert the fiber (with care!) and wait about 90 seconds. This is how much time the stick takes to boot and be ready for SSH access. From the command prompt of the router you can SSH into the stick using the following command:


ssh -oHostKeyAlgorithms=+ssh-dss -oKexAlgorithms=diffie-hellman-group14-sha1 192.168.1.10 -l ONTUSER

Password: 7sp!lwUBz1

This will give you a prompt:

root@SFP:/home/ONTUSER#

Then you clone the MAC address and serial number of your Huawai media convert. In the example below I'm assuming that the MAC address of the T-mobile converter is aa:aa:aa:aa:aa:aa and that the last 8 digits of the serial number are 12341234. With those bits of information the stick can be configured using the following commands:


# set_serial_number HWTC12341234
# uci set network.host.macaddr=aa:aa:aa:aa:aa:aa
# uci commit network.host.macaddr=aa:aa:aa:aa:aa:aa
# sfp_i2c -i 0 -s "HUWAWEI"
# sfp_i2c -i 1 -s "HG8010Hv6"
# sfp_i2c -i 2 -s "0001"
# sfp_i2c -i 3 -s "4857544312341234"
# sfp_i2c -i 7 -s "HWTC"
# fw_setenv sgmii_mode
# uci commit
# reboot; exit

Wait another 60-90 seconds and the GPON SFP stick will boot and be visible in the console of the router. After that you can configure vlan 300 for eth3 using this snippet:


  ethernet eth3 {
        address 192.168.1.15/24
        description "WAN - Fiber"
        duplex full
        speed 1000
        vif 300 {
            address dhcp
            description "T-mobile Internet (via SFP)"
        }        
  }

Conclusion

The Huawei media converter is now unplugged. One less power adapter that is constantly using power. Since the GPON stick uses the same serial number and MAC address as the T-mobile media converter it is also easy to switch back should this be needed. So far, that has not been necessary.