D-Link DWR-921 C3: 3g/4g connection

I've lost 2 days to configure DWR-921 C3 to use SIM connection (WWAN), so I want share with you my steps to work it.

With Iliad SIM card follow this guide

uci set network.wwan=interface
uci set network.wwan.proto='wwan'
uci set network.wwan.apn='iliad'
uci set network.wwan.pincode='<your sim pin code>' #if pincode doesn't exist delete this line
uci set network.wwan.auto='0'
uci commit network

uci set firewall.@zone[1].network='wan wwan wan6'
uci commit firewall

Reboot openwrt. Now if you start wwan with ifup wwan you will be able to navigate.

With Tim SIM card I've used modemmanager. Before use it I've installed this packages:

opkg update
opkg install usb-modeswitch kmod-mii kmod-usb-net kmod-usb-wdm kmod-usb-net-qmi-wwan uqmi
opkg install modemmanager luci-proto-modemmanager luci-proto-3g luci-proto-ipv6 luci-proto-ncm luci-proto-ppp luci-proto-qmi

Following this guide, I've added this lines to /etc/config/network:

config interface 'TIM'
        option proto 'modemmanager'
        option device '/sys/devices/platform/101c0000.ehci/usb1/1-1'
        option iptype 'ipv4'
        option apn 'ibox.tim.it'
        option auth 'none'

and I've add TIM to WAN firewall:

uci set firewall.@zone[1].network='wan wan6 TIM'
Reboot. Wait 1-2 minute and it should connect. (doesn't always it works -> reboot again)

I hope it works

2 Likes

I recently managed a configuration like your with a 3g dongle and Iliad, I noticed too that the connection sometimes doesn't start correctly on boot, but it doesn't fail if the router is rebooted by command. In case of a power failure or hardware switch off, at the next boot, 3g connection fail. My workaround is a little script in rd.local testing the connection and rebooting by shell.

1 Like

It's true.

I also created a boot script (stupid script :stuck_out_tongue:) to check if connection works. I've enabled cron to check the connection every 10 minutes because sometimes it falls and doesn't restart.
MY STUPID BOOT SCRIPT (/etc/init.d/check_SIM_connection)

#!/bin/sh /etc/rc.common

START=98
USE_PROCD=1

start_service(){
        logger -t 'check_SIM_connection' 'Check states of SIM connection'
        if [ -z /root/sim_log.log ] || [ wc -l < /root/sim_log.log == "100" ]; then echo "" > /root/sim_log.log; fi

        sleep 60
        if ping -q -c 1 -W 2 8.8.8.8 > /dev/null; then
                exit 0
        else
                sleep 60
                if ping -q -c 1 -W 2 8.8.8.8 > /dev/null; then
                        exit 0
                else
                        echo "$(date): Connection lost -> Reboot" >> /root/sim_log.log
                        reboot
                fi
        fi

        procd_open_instance check_vpn_connections
        procd_close_instance
}

I've enabled my script:

/etc/init.d/check_SIM_connection enable

MY CRONTAB:

*/10 * * * * /etc/init.d/check_SIM_connection stop && /etc/init.d/check_SIM_connection start
1 Like

Which hardware are you using to connect?
I explain, mine system is up 24/24 7/7 days, to give a gateway to some ip cams. It Is up flawlessly from several months, but recently, sometimes it goes offine and despite the test&reboot script and the cron scheduled test, it does not reconnect.... I suspect the internet key Huawei have reached his life limit.

I don't know... I use D-link router dwr-921 model. It has embedded Sim module.

On rc.local it's enough to test if block device is present in my case is /dev/ttyUSB0 so:
[ ! -e /dev/ttyUSB0 ] && reboot
:upside_down_face: