Using EM7455 with static IP and gateway IP

Hi, we are using EM7455 in our embedded Linux project. We are using AT commands to control and query the module.

  1. Can we configure the module to use a static IP address instead of using DHCP? If so, what AT command to use to configure the static IP and mask, and the gateway IP?
  2. Can we configure static ipv6 address, mask and gateway IP as well? If so, what AT command to use?
  3. How to query the module for the gateway IP address when using DHCP mode?

Thanks a lot! :slight_smile:

  1. this depends on your SIM card which has to give out static IP.
  2. did you try AT+CGDCONT to set IPV6
  3. have you tried AT+CGPADDR=1

Thanks for your reply.

Sorry I don’t get what you mean by ‘this depends on your SIM card which has to give out static IP’. Do you mean it is the SIM card that has the static IP address stored in it, and that it is assigning the static IP address to the module when the PDP connection is established?
Or is the static IP address something that my Linux OS can program to the module? If so, how?

AT+CGPADDR=1 only returns the module IP address, not the gateway address.

Here is what I see after my cell interface is up. My EM7455 is eth3.

ifconfig

eth0 Link encap:Ethernet HWaddr 00:80:A3:96:8D:06
inet addr:172.19.100.85 Bcast:172.19.255.255 Mask:255.255.0.0
inet6 addr: fe80::280:a3ff:fe96:8d06/64 Scope:Link
inet6 addr: 2001:db80:ac13:d91e:280:a3ff:fe96:8d06/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1343735 errors:0 dropped:160580 overruns:0 frame:0
TX packets:11483 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:187143787 (178.4 MiB) TX bytes:885591 (864.8 KiB)
Interrupt:179 Base address:0x4000

eth1 Link encap:Ethernet HWaddr 00:80:A3:96:8D:07
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:180 Base address:0x5000

eth3 Link encap:Ethernet HWaddr 52:30:F0:47:6C:08
inet addr:10.36.121.179 Bcast:10.36.121.183 Mask:255.255.255.248
inet6 addr: fe80::5030:f0ff:fe47:6c08/64 Scope:Link
UP BROADCAST RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1224 (1.1 KiB) TX bytes:1430 (1.3 KiB)

route -n

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.19.0.1 0.0.0.0 UG 0 0 0 eth0
10.36.121.176 0.0.0.0 255.255.255.248 U 0 0 0 eth3
172.19.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

ip route show

default via 172.19.0.1 dev eth0
10.36.121.176/29 dev eth3 src 10.36.121.179
172.19.0.0/16 dev eth0 src 172.19.100.85

Yes, i think so with the following:
it is the SIM card that has the static IP address stored in it, and that it is assigning the static IP address to the module when the PDP connection is established?

How do I read out the static IP address that is configured on the card?

If the SIM is configured to have static IP address, then the network will assign static IP address to the SIM. It is an account setting. The modem will just use the IP that is assigned to the SIM (static or dynamic). You can use AT!SCACT=1 to start a data connection, and use AT+CGCONTRDP to read the assigned IP details and assign them to you host interface or simply run dhclient for that network interface (eth3, I think, from your comment above).

Hi Ajoseph, thanks for your reply.

I tried the at+cgcontrdp command on my module that is running DHCP, and this is what I got:
+CGCONTRDP: 1,5,m2m.com.attz,10.51.10.189,8.8.8.8,8.8.4.4

So it is not returning the subnet mask and the gateway fields.

How can I get these values?

Thanks

And how can I tell if the assigned IP address is static or dynamic?

Thanks a lot

You can calculate the subnet mask. This probably is a static IP sim for which the service provided would have assigned a gateway. Please check with the service provider. From the modem side, we cannot say if IP is dynamic or static.

Actually I do notice the assigned IP address changes each time I connect. So it is not a static IP SIM I think.

How do you calculate the mask?

There is no need for them.

So what we do populate into the OS routing table? I do see an IP address close to the module IP. Wondering what it is. That address is not responding to ping.

you route 0.0.0.0 via wwan0 (or whatever you named your interface)

So if I am using the Linux ip command to add a default route to go through my cellular modem, I would do:

ip route add default via [EM7455 module IP] dev eth3