Need Suggestions on Configuring OpenWRT Router for Dual SIM with IPv4/IPv6 PDP Contexts

Hi guys,

I'm working with an OpenWRT-based 4G router that has one EC200A modem and two SIM cards. The SIM cards can be selected using GPIO. Until now, I've been using a simple DHCP client with some mbwan script provided by the router vendor for SIM connectivity, but the connection has been unstable.

I decided to switch to using the 3G protocol, which works well except when using a Jio SIM (an Indian service provider that only supports IPv6 and 464xlat). With Jio, the 3G protocol using an IPv4 PDP context doesn't work, but it does with an IPv6 PDP context, and I can get IPv4 connectivity with 464xlat.

The problem is that I have an active-passive SIM setup. One slot has a Jio SIM, and the other has a non-Jio SIM, or both might have Jio SIMs. I need to determine which configuration to use (IPv4 PDP context or IPv6 PDP context with 464xlat) based on the SIM in use. I thought I could use the IMSI number to determine if the SIM is Jio or non-Jio and make the decision based on that, but Jio complicates things. For postpaid users, there's no support for 464xlat as they get direct IPv4, whereas prepaid users only support 464xlat.

Can you help me figure out what to check and what logic to use for this?

Please post output of:

ubus call system board

Our router is not available on Openwrt TOH,
we compile against PBR-M1 target.
Following is output for mentioned ubus call

	"kernel": "5.4.230",
	"hostname": "NE-25",
	"system": "MediaTek MT7621 ver:1 eco:3",
	"model": "PBR-M1",
	"board_name": "d-team,pbr-m1",
	"release": {
		"distribution": "NE-25",
		"version": "2.2.0",
		"revision": "r0-f7c460685b",
		"target": "ramips/mt7621",
		"description": "NE-25v2.2.0"

It appears you are using firmware that is not from the official OpenWrt project.

When using forks/offshoots/vendor-specific builds that are "based on OpenWrt", there may be many differences compared to the official versions (hosted by Some of these customizations may fundamentally change the way that OpenWrt works. You might need help from people with specific/specialized knowledge about the firmware you are using, so it is possible that advice you get here may not be useful.

You may find that the best options are:

  1. Install an official version of OpenWrt, if your device is supported (see
  2. Ask for help from the maintainer(s) or user community of the specific firmware that you are using.
  3. Provide the source code for the firmware so that users on this forum can understand how your firmware works (OpenWrt forum users are volunteers, so somebody might look at the code if they have time and are interested in your issue).

If you believe that this specific issue is common to generic/official OpenWrt and/or the maintainers of your build have indicated as such, please feel free to clarify.

I'm the one who is maintaining this version of openwrt.
It's generic version.
I'm having issue with the logic where I need to switch from ipv4 PDP context to ipv6 PDP context with 464xlat.
For now I have added an option to define which context to use but i don't want to do this manually.
If I'm sending a device on site, I don't want to log into the router and define which context I want to use.
It need to be automated.

You are asking about your code, not openwrt, you need at least config parser and maybe luci module to change that GPIO at boot.