How to get a static IP with 4G USB modem module?


I have a few Quectel modules (EC25, EP06, etc), currently, when using the module, I am getting an internal IP provided by the ISP.

I am trying to get them to give me a static internal IP, so I can set up my proxy servers, and such to use this IP, I am able to get the static IP when putting the modem on ECM mode (running AT+QCFG=“usbnet”,1).

However, ECM mode seems to be using PPP, which is much slower than QMI and MBIM.

What would be my best way to get a static IP from the module without sacrificing speed?


If you're talking about a static IP with respect to the internet (i.e. a static public IP), that is between you and your ISP. There is nothing that can be done on OpenWrt (or any device) to obtain an IP that is not issued to you by your ISP.

Hey, thanks for the reply, I am not talking about the public IP, I am talking about the private IP (the one you see when typing ip a or ifconfig)

So this would be static IPs for the hosts behind your OpenWrt router?

No, I have one server with 16 of these modules connected to it for some special use-case, I would like to set up some software to use the modules networking for outgoing traffic, for example, Squid proxy.

I have to configure Squid with the internal IP of the interface, (for example: outgoing_interface, but in the case of the modules I am getting a dynamic internal IP address from the ISP, so I am trying to get around that.

Edit: just to clarify, the server itself is running OpenWrT

So it sounds like these modules are connected to OpenWrt with the OpenWrt interface set to DHCP client?

If the above is correct, you could do one of two things for this:

  1. find out what the DHCP pool is for the modules and assign an address to the OpenWrt interface with protocol static IP -- give it a static IP in the same subnet but outside the DHCP range of the module's DHCP server.

  2. see if the module has an administrative interface that will allow you to set a DHCP reservation for the OpenWrt system.

Keep in mind that if you have a bunch of these modules and they all use the 192.168.8./0/24 subnet, you will likely have issues with routing across multiple modules. Presumably what you'll need to do is set them to have a different subnet, or at least a different host IP such that your routing table can understand which gateway to use for any given purpose.

Thanks, yes the modems are indeed connected to OpenWrt, however, the interface is not set to DHCP, it is set to ModemManager. The modem does not have a web interface, it is dialed up to the ISP via QMI or MIBM.

As far as I understand, the internal IP is fetched directly from the ISP, so I think the steps you suggested will not work, but I am not sure. With this new info in mind, do you still think this approach will work?

In this case, I'm out of my element, so I don't have any other suggestions.

Does the modem have any documentation about an administrative interface and/or the ability for it to provide DHCP services and/or allow the downstream device to use a static IP?

Otherwise, you'll probably need to ask this question on a forum that specializes in these types of devices and/or ask the ISP.

It does seem to have a mode called ECM that makes the modem has a web interface and a static IP, however, when set to this mode it seems to dial-up via PPP, which is significantly slower than QMI.

Thanks for trying to help, I will also try the manufactorer.