Monday, 9 March 2015

4G dongles

Dongles are a pain in the arse!

The problem is that they do not really follow much of a standard.

The 3G dongles we support in the FireBrick all appear as a "file system" initially so that one can install windows drivers, and then magically change to some sort of serial interface.

The way the change varies - some "eject CD" on the file system, and some do something else. At least one does a USB profile setting (the right way to do it, arguably) and one is just strange.

For almost all you then end up with what looks at a USB level like a serial port. What you do then is talk old fashioned Hayes modem dialling and set up commands, and then serial PPP coding. It really is that daft.

The dongle is faking all of this, it actually talks a "PDP context" on the air, having pretended to talk LCP and PAP/CHAP auth and even IPCP on the serial interface. Eventually it connects and passes IP packets over PPP over serial (with escaping characters).

The new 4G dongles appear to be different - they seem to appear as an Ethernet NIC.

But we have yet to get to the bottom of it - do they talk faked PPPoE or what. That is the next challenge. We'll see.

11 comments:

  1. Once you get as far as talking Ethernet to it, you'll find it simulates a sound card feeding an acoustic coupler. You dial by playing DTMF tones to it, then simulate multiple 56k modems doing MLPPP.

    (Intended as a joke, but you never know ... sooner or later, somebody will probably try it for real anyway...)

    ReplyDelete
  2. Presumably this is due to the increase in throughput and the serial interface can't manage it?

    ReplyDelete
    Replies
    1. Except it is not a real serial interface. I guess it is to simplify code on the host.

      Delete
  3. I'd hope that you can just set the Ethernet interface to "automatically acquire an IP address (DHCP)", then send TCP/IP packets over the "Ethernet" interface and those packets appear on the Internet, with all the intermediate tech being hidden. That way you can have a PC with a standard Ethernet driver, plug in the dongle and it "just works".

    No idea if that's actually what happens :-)

    ReplyDelete
    Replies
    1. This is how the ones I've used recently worked. It is like having a NAT/router embedded in a USB stick.
      The host machine sees an Ethernet interface with a "router" attached that does DHCP. The "router" also has an embedded web interface for managing it, accessing SMSs, etc.
      This is good for normal use attached to a laptop, since you don't need any special drivers. (Actually the ones I've used do also appear as a CD drive, with some management software I've never used).
      However, for RevK's Firebrick scenario these are potentially less good than the old ones that appeared as a serial device, since there isn't a standard protocol to bring the interface up/down, specify the APN, etc. You'd probably have to do this by scrapping the embedded web interface.

      Delete
  4. I remember back when I started at T-Mobile tech support before dongles were dongles being very suprised that I was typing dial-up hayes commands into that thing...

    ReplyDelete
  5. I was going to say "wouldn't it make more sense for these things to pretend to be an ethernet NIC" in relation to the 3G dongles, then you beat me to it with the 4G ones. What a bizarre scheme the 3G dongles use. On the face of it the change 4G dongles have made is a step forwards.

    ReplyDelete
    Replies
    1. Someone may correct me here if I'm wrong, but I *think* that 3G itself works in a very dial-up way, in that you have to choose which APN to connect to (i.e. you "dial" the APN), so to some extent it probably does make sense to model it as a dialup modem.

      Maybe a better model is an ethernet interface connected to an 802.1q tagged VLAN trunk, with each VLAN ending up at an appropriate APN?

      Also, I suspect that a lot of this stuff stems from trying to be compatible with all OSes without needing to install extra drivers - I certainly spent a long time trying to get Android tethering to work with a Mac a few years ago before giving up because there were basically no RNDIS drivers for Macs (whilst this Just Works™ under both Windows and Linux). Not sure if that's improved, but I can certainly see some motivation in picking a standard that's so old that every OS already has mature support.

      Delete
    2. >i.e. you "dial" the APN

      That sounds about right to me. From memory, for Vodafone, it used to be:

      Z+AT+CGDCONT=1,"IP","internet"

      And, when working with the development team for getting the early USB modems running with the EEEPC and other netbooks, I recall playing with usb-modeswitch a lot...

      Delete
  6. Oh yes, I remember being tasked to integrate (at the software level) a 3G module into a netbook, back in the days when netbooks were cool in Marketing's eyes. Luckily, I'd recently gone through the process of tethering my Nokia phone to my Linux firewall, so I knew where to find the relevant data.

    I think the 3G situation stemmed from 3G being an extension of EDGE, which was an extension of GPRS, which was very much a dial-up paradigm, originally charged by the minute. Per-minute charges instinctively suggest analogue-modem methods, and PPP and Hayes commands fitted neatly into existing deployed software...

    ReplyDelete
  7. A word of warning with dongles which appear as an NIC: I bought a Huawei 3G dongle intending to attach it to a Raspberry Pi. My idea was to provide a remote monitoring system with an always-on interface to which I could connect at any time. To achieve this, I purchased an AAISP 3 data SIM which provides a static IP address on the Internet (fantastic product!).

    Sadly, the virtual network associated with the dongle (192.168.1) does not provide a facility for port address translation which meant it was impossible to make incoming connections from the Internet. I was obliged to fall back to using another dongle with an AT-style interface which worked for me using PPP. My RPi then had an always-on Internet-facing IP address.

    I'd be interested to hear if more recent 4G dongles offer port address translation in their menu pages. Hopefully this will eventually become standard.

    ReplyDelete