Getting newer 2g/3g/4g dongles to work in debian.

Okay, this is just a small tip. All newer dongles, instead of having you to undergo some nasty sex with pppd over serial to make them work, have an ethernet interface, like cdc-ncm, sierra_net and etc. So, once you plug those, you usually see an extra interface when doing ifconfig -a.
So, how should we bring up the interface?
It is done via sending


command via the serial interface (it shouldn’t be locked via any pin number whatsoever, if it is – we need to issue AT+CPIN before that).
Newer network-manager takes care of them, but on a headless box or some singleboard embedded device this is a no-go. In my case I use debian on my embedded box, so I threw up this very snipplet to /etc/network/interfaces:

iface wwan0 inet dhcp
        pre-up echo -ne '\r\nAT^NDISDUP=1,1,"internet"\r\n' > /dev/ttyUSB0 && sleep 15

It gives a 15 second delay, so that the modem can bring up the interface, and adds as a nameserver, since I’m using dnsmasq for local dns stuff. Replace /dev/ttyUSB0 with whatever port you need. Once done – use

ifup wwan0


ifdown wwan0

To get this interface up and down.
It’s also a good idea to ping google or something once every 5 to 10 seconds, because after a few hours of inactivity the modem drops the connection, and while now there is no mechanism in cdc_ncm except for a note in dmesg that the connection has been dropped.

Print Friendly

Leave a Reply