Serial modem AT commands get IP

I got 4G dongle set as a serial modem dial via ppp protocol (luci-proto-3g).

The issue I am facing, that I cannot get IP address assigned (in my case its external IP from provider).

The only option to get IP assigned is when reboot router and interface will start with the router, than I got IPv4 address (external).

Quite strange. ifdown and ifup not showing anything.

logread before reboot

Fri Jun 11 10:16:15 2021 daemon.notice netifd: Interface '4Gppp' is setting up now
Fri Jun 11 10:16:17 2021 daemon.notice pppd[14871]: pppd 2.4.7 started by root, uid 0
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: abort on (BUSY)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: abort on (NO CARRIER)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: abort on (ERROR)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: report (CONNECT)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: timeout set to 10 seconds
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: send (AT&F^M)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: expect (OK)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: AT&F^M^M
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: OK
Fri Jun 11 10:16:18 2021 local2.info chat[14916]:  -- got it
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: send (ATE1^M)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: expect (OK)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: ^M
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: ATE1^M^M
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: OK
Fri Jun 11 10:16:18 2021 local2.info chat[14916]:  -- got it
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: send (AT+CGDCONT=1,"IP","3internet"^M)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: timeout set to 30 seconds
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: expect (OK)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: ^M
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: AT+CGDCONT=1,"IP","3internet"^M^M
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: OK
Fri Jun 11 10:16:18 2021 local2.info chat[14916]:  -- got it
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: send (ATD*99#^M)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: expect (CONNECT)
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: ^M
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: ATD*99#^M^M
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: CONNECT
Fri Jun 11 10:16:18 2021 local2.info chat[14916]:  -- got it
Fri Jun 11 10:16:18 2021 local2.info chat[14916]: send ( ^M)
Fri Jun 11 10:16:18 2021 daemon.info pppd[14871]: Serial connection established.
Fri Jun 11 10:16:18 2021 kern.info kernel: [47768.437391] 3g-4Gppp: renamed from ppp0
Fri Jun 11 10:16:18 2021 daemon.info pppd[14871]: Renamed interface ppp0 to 3g-4Gppp
Fri Jun 11 10:16:18 2021 daemon.info pppd[14871]: Using interface 3g-4Gppp
Fri Jun 11 10:16:18 2021 daemon.notice pppd[14871]: Connect: 3g-4Gppp <--> /dev/ttyUSB2

I will try to catch logread after reboot when IP will be assigned to see difference and will paste later.

Any AT command to get IP after DIAL?

Dial command:

ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 10
""      "AT&F"
OK      "ATE1"
OK      'AT+CGDCONT=1,"IP","$USE_APN"'
SAY     "Calling UMTS/GPRS"
TIMEOUT 30
OK      "ATD$DIALNUMBER"
CONNECT ' '

if you're using a 3G/4G modem you're probably CGNATed.

anyway, you can try to get your public IP by running curl ip.sb

ifconfig might.

try

AT+CGPADDR
AT+CGCONTRDP

@frollic
No, I am not CGNATed as provided giving me access to external IP via specific APN. This is also why I am using this and not other connetion.

ifconfig not showing IP as is not assigned. If I reboot, than I get an IP (for example 92.12.24.33).

3g-4Gppp  Link encap:Point-to-Point Protocol
          POINTOPOINT NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:336 (336.0 B)  TX bytes:430 (430.0 B)

@AndrewZ
Thanks, not getting answer on these commands, which is strange, but will investigate it based on that

Fri Jun 11 10:45:27 2021 local2.info chat[13765]: abort on (BUSY)
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: abort on (NO CARRIER)
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: abort on (ERROR)
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: report (CONNECT)
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: timeout set to 10 seconds
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: send (AT&F^M)
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: expect (OK)
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: AT&F^M^M
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: OK
Fri Jun 11 10:45:27 2021 local2.info chat[13765]:  -- got it
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: send (ATE1^M)
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: expect (OK)
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: ^M
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: ATE1^M^M
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: OK
Fri Jun 11 10:45:27 2021 local2.info chat[13765]:  -- got it
Fri Jun 11 10:45:27 2021 local2.info chat[13765]: send (AT+CGDCONT=1,"IP","3internet"^M)
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: timeout set to 30 seconds
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: expect (OK)
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: ^M
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: AT+CGDCONT=1,"IP","3internet"^M^M
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: OK
Fri Jun 11 10:45:28 2021 local2.info chat[13765]:  -- got it
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: send (ATD*99#^M)
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: expect (CONNECT)
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: ^M
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: ATD*99#^M^M
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: CONNECT
Fri Jun 11 10:45:28 2021 local2.info chat[13765]:  -- got it
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: send ( ^M)
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: send (AT+CGPADDR^M)
Fri Jun 11 10:45:28 2021 local2.info chat[13765]: send (AT+CGCONTRDP^M)

Have you tried the modemmanager proto?

It should get you this info if the modem is supported and expose them through the network status.

I suppose you should send the commands after the connection is established over a different port

@laingo thanks, will have a try modemmanager in next week if I not sort this out.

@AndrewZ
tried socat - /dev/ttyUSB1 USB2 or USB0 and not getting any response.

Something interesting happening if I got this working after reboot but not on ifdown/ifup.

Ok, Modified 3g.chat as follow

ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 10
""      "AT&F"
OK      "ATE1"
OK      'AT+CGDCONT=1,"IP","$USE_APN"'
OK      'AT+CGPADDR'
OK      'AT+CGCONTRDP'
SAY     "Calling UMTS/GPRS"
TIMEOUT 30
OK      "ATD$DIALNUMBER"
CONNECT ' '

and logread is

Fri Jun 11 11:08:20 2021 daemon.notice netifd: Interface '4Gppp' is setting up now
Fri Jun 11 11:08:22 2021 daemon.notice pppd[2246]: pppd 2.4.7 started by root, uid 0
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: abort on (BUSY)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: abort on (NO CARRIER)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: abort on (ERROR)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: report (CONNECT)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: timeout set to 10 seconds
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: send (AT&F^M)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: expect (OK)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: AT&F^M^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: OK
Fri Jun 11 11:08:23 2021 local2.info chat[2285]:  -- got it
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: send (ATE1^M)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: expect (OK)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ATE1^M^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: OK
Fri Jun 11 11:08:23 2021 local2.info chat[2285]:  -- got it
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: send (AT+CGDCONT=1,"IP","3internet"^M)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: expect (OK)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: AT+CGDCONT=1,"IP","3internet"^M^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: OK
Fri Jun 11 11:08:23 2021 local2.info chat[2285]:  -- got it
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: send (AT+CGPADDR^M)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: expect (OK)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: AT+CGPADDR^M^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: +CGPADDR: 1,92.40.28.117^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: +CGPADDR: 2,0.0.0.0^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: +CGPADDR: 3,0.0.0.0^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: OK
Fri Jun 11 11:08:23 2021 local2.info chat[2285]:  -- got it
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: send (AT+CGCONTRDP^M)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: timeout set to 30 seconds
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: expect (OK)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: AT+CGCONTRDP^M^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: +CGCONTRDP: 1,5,3internet,92.40.28.117,,217.171.132.0,217.171.135.0,^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: OK
Fri Jun 11 11:08:23 2021 local2.info chat[2285]:  -- got it
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: send (ATD*99#^M)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: expect (CONNECT)
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: ATD*99#^M^M
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: CONNECT
Fri Jun 11 11:08:23 2021 local2.info chat[2285]:  -- got it
Fri Jun 11 11:08:23 2021 local2.info chat[2285]: send ( ^M)
Fri Jun 11 11:08:23 2021 daemon.info pppd[2246]: Serial connection established.
Fri Jun 11 11:08:23 2021 kern.info kernel: [50894.501100] 3g-4Gppp: renamed from ppp0
Fri Jun 11 11:08:23 2021 daemon.info pppd[2246]: Renamed interface ppp0 to 3g-4Gppp
Fri Jun 11 11:08:23 2021 daemon.info pppd[2246]: Using interface 3g-4Gppp
Fri Jun 11 11:08:23 2021 daemon.notice pppd[2246]: Connect: 3g-4Gppp <--> /dev/ttyUSB2

So, you can see an IP provided 92.40.28.117 (Thanks @AndrewZ)

however ifconfig don't get it:

root@WRT3200ACM:~# ifconfig 3g-4Gppp
3g-4Gppp  Link encap:Point-to-Point Protocol
          POINTOPOINT NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:106 errors:0 dropped:0 overruns:0 frame:0
          TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:2968 (2.8 KiB)  TX bytes:3578 (3.4 KiB)

You can also look at the proto find out why the IP would not be set up on the interface after connection.

/lib/netifd/proto/3g.sh

Modem manager is pretty good at switching to a better driver than ppp as well depending on the modem (qmi and the like) - you could also do the switching yourself and skip modem manager altogether.

https://openwrt.org/docs/guide-user/network/wan/wwan/ltedongle

Additionally I add

OK      'AT+CGDCONT?'

and got response

Fri Jun 11 11:36:01 2021 local2.info chat[1250]: AT+CGDCONT?^M^M
Fri Jun 11 11:36:01 2021 local2.info chat[1250]: +CGDCONT: 1,"IP","3internet","0.0.0.0",0,0^M

and that where I think problem stand.

Tried modemanager on test router



config interface 'broadband'
    option device   '/sys/devices/platform/1e1c0000.xhci/usb1/1-2'
    option proto    'modemmanager'
    option apn      '3internet'
    option lowpower '1' 

but same issue that IP is not assigned

ppp0      Link encap:Point-to-Point Protocol
          POINTOPOINT NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:79 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:2212 (2.1 KiB)  TX bytes:2708 (2.6 KiB)

That looks like it's using the option driver (ppp) - if this is a new modem you could definitely customize how it's managed by modem manager (including how the assigned addresses may be read off the serial)

Are you able to get an address when using modem manager on a Linux PC?

Sorry, don't have ability to do that now.

After reboot, when modem is connected and IP assigned it looked as follow:

Fri Jun 11 14:45:13 2021 daemon.notice pppd[1440]: pppd 2.4.7 started by root, uid 0
Fri Jun 11 14:45:14 2021 local2.info chat[1477]: abort on (BUSY)
Fri Jun 11 14:45:14 2021 local2.info chat[1477]: abort on (NO CARRIER)
Fri Jun 11 14:45:14 2021 local2.info chat[1477]: abort on (ERROR)
Fri Jun 11 14:45:14 2021 local2.info chat[1477]: report (CONNECT)
Fri Jun 11 14:45:14 2021 local2.info chat[1477]: timeout set to 10 seconds
Fri Jun 11 14:45:14 2021 local2.info chat[1477]: send (AT&F^M)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: expect (OK)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: AT&F^M^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: OK
Fri Jun 11 14:45:15 2021 local2.info chat[1477]:  -- got it
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: send (ATE1^M)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: expect (OK)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ATE1^M^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: OK
Fri Jun 11 14:45:15 2021 local2.info chat[1477]:  -- got it
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: send (AT+CGDCONT=1,"IP","3internet"^M)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: expect (OK)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: AT+CGDCONT=1,"IP","3internet"^M^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: OK
Fri Jun 11 14:45:15 2021 local2.info chat[1477]:  -- got it
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: send (AT+CGPADDR=1^M)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: expect (OK)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: AT+CGPADDR=1^M^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: +CGPADDR: 1,92.41.44.242^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: OK
Fri Jun 11 14:45:15 2021 local2.info chat[1477]:  -- got it
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: send (AT+CGCONTRDP^M)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: expect (OK)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: AT+CGCONTRDP^M^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: +CGCONTRDP: 1,5,3internet,92.41.44.242,,217.171.132.0,217.171.135.0,^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: OK
Fri Jun 11 14:45:15 2021 local2.info chat[1477]:  -- got it
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: send (AT+CGDCONT?^M)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: timeout set to 30 seconds
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: expect (OK)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: AT+CGDCONT?^M^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: +CGDCONT: 1,"IP","3internet","0.0.0.0",0,0^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: +CGDCONT: 2,"IPV6","","0.0.0.0",0,0^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: +CGDCONT: 3,"IPV4V6","3internet","0.0.0.0",0,0^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: OK
Fri Jun 11 14:45:15 2021 local2.info chat[1477]:  -- got it
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: send (ATD*99#^M)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: expect (CONNECT)
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: ATD*99#^M^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: CONNECT
Fri Jun 11 14:45:15 2021 local2.info chat[1477]:  -- got it
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: send ( ^M)
Fri Jun 11 14:45:15 2021 daemon.info pppd[1440]: Serial connection established.
Fri Jun 11 14:45:15 2021 kern.info kernel: [63910.937215] 3g-4Gppp: renamed from ppp0
Fri Jun 11 14:45:15 2021 daemon.info pppd[1440]: Renamed interface ppp0 to 3g-4Gppp
Fri Jun 11 14:45:15 2021 daemon.info pppd[1440]: Using interface 3g-4Gppp
Fri Jun 11 14:45:15 2021 daemon.notice pppd[1440]: Connect: 3g-4Gppp <--> /dev/ttyUSB2
Fri Jun 11 14:45:16 2021 daemon.warn pppd[1440]: Could not determine remote IP address: defaulting to 10.64.64.64
Fri Jun 11 14:45:16 2021 daemon.notice pppd[1440]: local  IP address 92.41.44.242
Fri Jun 11 14:45:16 2021 daemon.notice pppd[1440]: remote IP address 10.64.64.64
Fri Jun 11 14:45:16 2021 daemon.notice pppd[1440]: primary   DNS address 217.171.132.0
Fri Jun 11 14:45:16 2021 daemon.notice pppd[1440]: secondary DNS address 217.171.135.0
Fri Jun 11 14:45:16 2021 daemon.notice netifd: Network device '3g-4Gppp' link is up
Fri Jun 11 14:45:16 2021 daemon.notice netifd: Interface '4Gppp' is now up

ps. WRT3200ACM on reboot power-down USB port, and that's the difference and why IP is attached, as on first power up and first call is working. When modem is powered up, you cannot disconnect and connect back as IP is not attached.

See difference

Fri Jun 11 14:45:15 2021 local2.info chat[1477]: AT+CGCONTRDP^M^M
Fri Jun 11 14:45:15 2021 local2.info chat[1477]: +CGCONTRDP: 1,5,3internet,92.41.44.242,,217.171.132.0,217.171.135.0,^M

to

Fri Jun 11 11:36:01 2021 local2.info chat[1250]: AT+CGDCONT?^M^M
Fri Jun 11 11:36:01 2021 local2.info chat[1250]: +CGDCONT: 1,"IP","3internet","0.0.0.0",0,0^M

I will need to have a look with AT commands to disconnect from network and connect back and see if that make difference as that's similar to power down and up.

Next time when I will loss IP I will have a try with AT+CFUN=0 than 1 as per
AT+CFUN – Set phone functionality | M2MSupport.net

Traditionally the IP address comes through the ppp tunnel after dialing and authenticating. The modem wouldn't know the IP address.

4G modems usually additionally support a better / newer protocol than ppp.