Disabling IPv4 on interface (4g mobile)

gl.inet x750 router with 4G modem. Intended to be used as emergency "dial-in" router for a remote location. Using google FI SIM, aka: t-mobile network, meaning:

a) I do not get a global IPv4 address and/or have no other way to connect via IPv4 from the Internet into the router via the 4G interface (CGNAT crap).

b) paying 10 USD/Gigabyte, so i want to keep volume use to a minimum.

I got IPv6 with dynamic DNS nicely running, and it seems i'd roughly use up maybe 5 MByte/month just for the IPv6 aliveness traffic.

BUT: i fail so far to set up the wwan0 interface so that IPv4 is disabled.

config interface 'wwan'
        option proto 'qmi'
        option device '/dev/cdc-wdm0'
        option apn 'h2g2'
        option pdptype 'ipv6'
        option dhcp '0'

config interface 'wwan6'
        option ifname '@wwan'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'
        list dns '2001:4860:4860::8888'
        list dns '2001:4860:4860::8844'
        option peerdns '0'

Still, the wwan0 interface gets an IPv4 address (rfc1918) and IPv4 is running on wwan0, there is also in luci an interface "WWAN_4" (grey) "Virtual dynamic interface (DHCP client)"

  • "option pdptype ipv6" seems to do nothing
  • "option dhcp 0" seems to do nothing

Any ideas what i could do to disable IPv4 on the interface best ?

Who creates that virtual dynamic interface anyhow ? Some shell scripts or binary driver code ?


You can check the APN profiles stored in the modem with at-command:
Normally profile 1 is the default one. You can change with AT+CGDCONT=1,"IPV6","h2g2"

This is my output of AT+CGDCONT?

+CGDCONT: 1,"IP","internet","",0,0,0,0
+CGDCONT: 2,"IPV6","","",0,0,0,0


Unfortunately, then the interface does not come up at all, so no IPv4 nor IPv6.
Is there any documentation about these AT commands so i understand what all those numbers mean ? Maybe i can figure out something if i understand this better.

What type of modem do you have, AT+CGMI, and which model, AT+CGMM?
Then google at command <manufacturer> <model>. :wink:

What did get from AT+CGDCONT? before you change anything?

I just did a quick test and I can setup IPv6 only without any at commands. But I use my customized uqmi version, https://github.com/mrhaav/openwrt.

I wonder how much of what is see is specific to change (hacks :wink: by gl.inet against the underlying 19.07.8. Alas, i don't have an unmodified OpenWrt running with a 4G interface card. Maybe i should buy the same mobile card and put it into an x86 openwrt box to compare.

I traced, how uqmi is started from /lib/netifd/proto/qmi.sh, its basically a "--start-network" for IPv4 wds, and another one for IPv6. I then tried to manually only start IPv6 and that fails. When i change the profile to IPv6 (not IPv4v6), then uqmi can not bring up either IPv4 or IPv6. There is even a /usr/bin/fix_tmobile which tries to figure out if you're running on t-mobile and then forces IPv4v6 (i disabled that for testing).

I now believe that i must bring up IPv4 on tmobile in the qmi driver if i want to have IPv6. Weird.

Interestingly, the qmi interface seems to get from the operator all the link/service paramers like IP/IPv6 addresses without DHCP. If i configure

option dhcpv6 '0'

then this "provisioned" IPv6 configuration will be used. The benefit is that it seems i can then have IPv6 running forever without even recurring DAAD packets, aka: minimal traffic cost.

Unfortunately, t-mobile sends non-working IPv6 dns server in the parameters, but the code that takes these dns server parameters in /lib/netifd/proto/qmi.sh does not work:

                            proto_add_dns_server "$dns1_6"
                            proto_add_dns_server "$dns2_6"

I replaced this with the IPv6 DNS server addresses from google, which do work, but DNS resolution was still not working. I finally got DNS to work (without enabling DHCPv6 code) by putting it into /etc/config/network

config interface 'wwan'
option proto 'qmi'
option device '/dev/cdc-wdm0'
option apn 'fast.t-mobile.com'
option pdptype 'ipv4v6'
list dns '2001:4860:4860::8888'
list dns '2001:4860:4860::8844'

Finally, i managed to disable IPv4, by fixing up the code in /lib/netifd/proto/qmi.sh that creates the wwan_4 virtual interface. When i disable creation of that virtual interface, then no IPv4 address is configured on the wwan interface. That is actually a bug, because /lib/netifd/proto/qmi.sh that does create/add IPv4 address/route in the same way it does for IPv6 - when DHCP is disabled.

Aka: I got what i want (IPv6 only running with DNS so i can have dynamic DNS updates to register my IPv6 address), but there is some amount of t-mobile mess, and some amount of OpenWrt mess which may or may not be related to gl.inet..