Connecting to IPv6 using the uqmi

I want to establish IPv6 connection using EC25 LTE modem. It works with PPP, but for some reason, I want to test it with QMI. I use this script to connect, but I keep getting IPv4 addres from the ISP.

My OpenWRT is 18.06.4. The reason why I use this script is that I can't afford LuCI.

#!/bin/sh

cd
./modem_off.sh
sleep 5
./modem_on.sh

sleep 5

ifconfig wwan0 down
echo "Y" >/sys/class/net/wwan0/qmi/raw_ip
ifconfig wwan0 up

ifup wwan
ifup wwan6

uqmi -d /dev/cdc-wdm0 --wda-set-data-format raw-ip
uqmi --network-register -d /dev/cdc-wdm0

sleep 10

uqmi  -d /dev/cdc-wdm0 --set-ip-family ipv6
uqmi --get-serving-system -d /dev/cdc-wdm0
uqmi --get-signal-info -d /dev/cdc-wdm0

sleep 5

uqmi --start-network internet --autoconnect --ip-family ipv6 -d /dev/cdc-wdm0

sleep 6

uqmi --get-data-status -d /dev/cdc-wdm0
uqmi -d /dev/cdc-wdm0 --get-current-settings

And the output shows IPv4 address:

{
	"registration": "registered",
	"plmn_mcc": 216,
	"plmn_mnc": 30,
	"plmn_description": "Telekom HU",
	"roaming": false
}
{
	"type": "wcdma",
	"rssi": -87,
	"ecio": 17
}
21081216
"connected"
{
	"pdp-type": "ipv4",
	"ip-family": "ipv4",
	"mtu": 1500,
	"ipv4": {
		"ip": "100.81.103.112",
		"dns1": "84.2.46.1",
		"dns2": "84.2.44.1",
		"gateway": "100.81.103.113",
		"subnet": "255.255.255.252"
	},
	"ipv6": {
		
	},
	"domain-names": {
		
	}
}

I have a simple DHCP and DHCPv6 interface configured. Please note that also the IPv4 address doesn't appear on the network interface.

Thanks for your help!

For this you could use the uqmi protohandler of the netifd.

Thank you, this script works for IPv4, but unfortunatelly, I have bad luck for IPv6. I get this in the log:

Thu Oct  3 08:56:37 2019 daemon.notice netifd: LTE (23726): Waiting for SIM initialization
Thu Oct  3 08:56:37 2019 daemon.notice netifd: LTE (23726): PIN verification is disabled
Thu Oct  3 08:56:37 2019 daemon.notice netifd: LTE (23726): Waiting for network registration
Thu Oct  3 08:56:37 2019 daemon.notice netifd: LTE (23726): Starting network LTE
Thu Oct  3 08:56:37 2019 daemon.notice netifd: LTE (23726): Unable to connect IPv6
Thu Oct  3 08:56:37 2019 daemon.notice netifd: LTE (23758): Stopping network LTE
Thu Oct  3 08:56:38 2019 daemon.notice netifd: LTE (23758): Command failed: Permission denied

Any help welcome.

Does this SIM works on Android with IPv6 support?
Do you have an IPv6 option order by your provider?
In germany not every contract has IPv6 support.

Please show the relevant portion of your /etc/config/network
As previously mentioned, the system script works just fine.

Thanks. It seems that the uqmi is buggy. I've got a connect manager from Quectel, and it works with that. Also, I had to disable IPv6 forwarding in the kernel as the program suggested. I haven't tried it with uqmi, and the forwarding disabled.

Anyways... thanks for your help!

uqmi works just fine for me

Some firmwares require --set-ip-family. You have to do something like this (untested and probably incomplete) example for a dual-stack connection:

uqmi -d /dev/cdc-wdm0 --get-client-id wds
uqmi -d /dev/cdc-wdm0 --set-client-id wds,$CID1 --set-ip-family ipv6
uqmi -d /dev/cdc-wdm0 --set-client-id wds,$CID1 --start-network --apn $APN
uqmi -d /dev/cdc-wdm0 --get-client-id wds
uqmi -d /dev/cdc-wdm0 --set-client-id wds,$CID2--set-ip-family ipv4
uqmi -d /dev/cdc-wdm0 --set-client-id wds,$CID2 --start-network --apn $APN

I've tested that earlier. The only difference that I use '--start-network' together with '--set-ip-family'.
Additionally in some cases one more command could be necessary to bring ipv6 up, discovered it somewhere and found it helpful:

uqmi -s -d /dev/cdc-wdm0 --set-client-id wds,$CIDv6 --stop-network 0xffffffff
uqmi -s -d /dev/cdc-wdm0 --set-client-id wds,$CIDv6 --start-network --apn $APN --ip-family ipv6

In my manual check procedure I have IPv6 after IPv4, not sure that is important.

I've also seen recommendation somewhere to start from the following lines:

uqmi -s -d /dev/cdc-wdm0 --stop-network 0xffffffff --autoconnect
uqmi -s -d /dev/cdc-wdm0 --sync

Using --set-ip-family is a separate QMI request. Using --ip-family with --start-network sets the ip-family TLV in the start-network QMI request. This is not the same. Some firmwares require the first method. At least I know the Huawei E392 (Qualcomm MDM9200 based) did. Both methods are worth trying, and there should be no harm combining both.

Yes, disabling --autoconnect is a good idea. Using --autoconnect is IMHO a bad idea in the first place. And if your autoconnect config happend to connect using an IP (i.e. IPv4) context, then there is no way you're going to get ab IPV6 or IPV4V6 context running.

1 Like

I do understand they are separate and I'm using them both.
I read your explanations about --autoconnect somewhere earlier, that's why I'm not using this option with --start-network. Adding -autoconnect to --stop-network was suggested by someone as a cleanup measure as I understood. Since you're saying it is a bad idea I tend to believe you :wink: Thank you for the explanations, Bjørn.

Edit:
That combination should not harm as I see from uqmi output:

--stop-network <pdh>:             Stop network connection (use with option below)
    --autoconnect:                  Disable automatic connect/reconnect

That's right: Using --autoconnect with --stop-network is good, because it disables the feature. Using it with --start-network is bad because it enables the feature.

1 Like

Hi,

I have a similar problem also on Quectel modems (EC25 and EG06).
The SIM card gets both v4 and v6 address on and Android phone.
On the Quectel modems I only get v4 the address.
I haven't configured DHCP or firewall for IPv6, however I would expect it should be possible to get and IPv6 address on the WAN. I haven't yet tried to have it working on PPP.
It's a 2 year old OpenWrt version I'm using.
Any ideas?

etc/config/network:

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option ifname 'eth1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'

config interface 'wan'
        option auto 'false'
        option ifname 'wwan0'
        option defaultroute 'true'
        option proto 'qmi'
        option device '/dev/cdc-wdm0'
        option modes 'lte,umts,cdma'
        option apn 'internet'
        option ipv6 'true'

Upgrade to the current version of OpenWrt and use the following config:

config interface 'WAN'
  option proto 'qmi'
  option device '/dev/cdc-wdm0'
  option ipv6 '1'
  option apn 'internet'
  option auth 'none'
  option pdptype 'ipv4v6'
2 Likes

Having some dual stack issues here on a Sierra EM7565, but with a workaround. Regardless of whether I set --set-ip-family ipv6/4 in the same command as --start-network, the v6 connection always fails. v4 comes up successfully. Interestingly, the pdp type is always set to ipv4, regardless.

I'm unclear, looking at the uqmi source, as to exactly how/where the pdp type is set.

As an experiment, I tried creating a profile on the modem itself with the pdp type manually set to ipv4v6
AT+CGDCONT=1,"IPV4V6","telstra.internet"

I can then connect a v4 and a v6 session with:

uqmi -d /dev/cdc-wdm0 --get-client-id wds
uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid1> --set-ip-family ipv6
uqmi -d /dev/cdc-wdm0 --get-client-id wds
uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid2> --set-ip-family ipv4
uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid1> --start-network --profile 1
uqmi -d /dev/cdc-wdm0 --set-client-id wds,<cid2> --start-network --profile 1


uqmi -d /dev/cdc-wdm0  --set-client-id wds,18  --get-current-settings
{
  "pdp-type": "ipv4-or-ipv6",
  "ip-family": "ipv6",
  "mtu": 1500,
  "ipv4": {

  },
  "ipv6": {
    "ip": "2001:8004:1500:274c:5866:1801:4907:8bc1",
    "ip-prefix-length": 64,
    "gateway": "2001:8004:1500:274c:95b2:8140:73e7:d7b",
    "gw-prefix-length": 64,
    "dns1": "2001:8004::a1a0:7:e1c0:0:10",
    "dns2": "2001:8004::a080:7:e1c0:0:10"
  },
  "domain-names": {

  }
}

uqmi -d /dev/cdc-wdm0  --set-client-id wds,19 --get-current-settings
{
  "pdp-type": "ipv4-or-ipv6",
  "ip-family": "ipv4",
  "mtu": 1500,
  "ipv4": {
    "ip": "10.98.25.136",
    "dns1": "10.4.130.164",
    "dns2": "10.5.136.242",
    "gateway": "10.98.25.137",
    "subnet": "255.255.255.240"
  },
  "ipv6": {

  },
  "domain-names": {

  }
}

I can then get OpenWRT to bring up both v4 and v6 sessions by specifying the ipv4v6 profile rather than the APN:

#  uci show network.WWANQMI
network.WWANQMI=interface
network.WWANQMI.proto='qmi'
network.WWANQMI.device='/dev/cdc-wdm0'
network.WWANQMI.ipv6='1'
network.WWANQMI.profile='1'
network.WWANQMI.pdptype='ipv4v6'

This does rely on that profile manually having manually defined in the modem.

The only issue outstanding then is why it's apparently not possible (or I'm missing something) to force a specific pdp type as well as an APN when starting a session in uqmi.

1 Like

I believe that is correct. The workaround you used, using AT commands to create an "IPV4V6" profile, is the only way.

It is theoretically possible to create the context using a QMI WDS "Create Profile" request (0x0027) instead, but it isn't implemented in uqmi (yet). I'm sure patches are welcome :slight_smile:

The same problem is with me...I'am able to connect to ipv4 and umts but i'm not able to connect to ipv6 and lte.i'm using uqmi and quectol dricver to connect to ipv6 network but still its showing disconnected please provide me more information to connect to ipv6 network.

@rob2081
Can you perhaps elaborate on how to create such profile?
I also try to get dual stack v4/v6 up for mobile.
Maybe some developer can shed a light?
Also, does anyone have mobile dual stack v4/v6 up ?
Is AT command still only possible way?

1 Like

Hi,

To create a profile on your QMI modem, you can also use qmicli.
For exemple, on my Sierra EM7455, I'm using the following to configure an Orange France profile:

APN: orange
AUTH: CHAP
USERNAME: orange
PASSWORD: orange

qmicli -d /dev/cdc-wdm0 --wds-create-profile=3gpp,apn=orange,pdp-type=IPV4V6,auth=CHAP,username=orange,password=orange

However, I did not try rob2081 tricks to get dual stack IP.

1 Like

@kozlek thanks for reply! I have meanwhile succeeded via AT commands as well