I've been struggling at connecting my 3G/4G modem with a private APN. I saw many threads about it (like this one [Solved]UQMI won't connect with Private APN), but since I need something more automated, the solution presented on the aforementioned post wasn't likely to work in my case.
Based on @cezary comment, I saw that there's no need to change /etc/config/network proto to 3g and turn back to qmi. The thing is many modems keep the last valid APN configuration by saving it in its context.
If you send this command AT to your modem:
You'll see all context saved. If you are struggling at connecting to a private APN, check if the first context is right. In my case, it was using the public apn, so my device was getting a public ip address from my ISP.
AT+CGDCONT? +CGDCONT: 1,"IP","zap.vivo.com.br","",0,0,0,0 +CGDCONT: 2,"IPV4V6","ims","",0,0,0,0 +CGDCONT: 3,"IPV4V6","sos","",0,0,0,1
In this case, zap.vivo.com.br is the public apn. To change to a private one, just use the command:
Then, just connect as usual.
I hope it helps.
This is the first time I post here and I would like to contribute more to this project. I would appreciate getting any feedback about how I wrote this post, things that I did right or wrong, etc. OpenWRT is a wonderful project and it would be an honor to contribute to this community.