# How to set custom APN?

**URL:** <https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324>\
**Category:** RC76\
**Created:** [June 27, 2022, 11:44am UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324 "2022-06-27T11:44:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![saim](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@saim](https://forum.sierrawireless.com/u/saim)\
**Post date:** [June 27, 2022, 11:44am UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324/1 "2022-06-27T11:44:13Z")

</div>

Hi, I am working with RC7620. I am trying to set APN using at+cgdcont. The command seems to work as such, in terms of allowing me to set APN of choice, but when I set a wrong APN also, I seem to get a valid IP and data connection, which seems strange. I tried at!reset afterwards, but it still works. Am I missing something for APN setting? I have a ‘tre’ SIM whose APN is data.tre.se.

> at+cgdcont?
> 
> +CGDCONT: 1,“IP”,“WRONGAPN”,“0.0.0.0”,0,0,0,0
> 
> +CGDCONT: 2,“IPV4V6”,“ims”,“0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0
> 
> +CGDCONT: 3,“IPV4V6”,“sos”,“0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,1
> 
> OK
> 
> ati
> 
> Manufacturer: Sierra Wireless, Incorporated
> 
> Model: RC7620
> 
> Revision: SWI9X07H\_00.08.19.00 725c0e jenkins 2021/09/08 14:36:45
> 
> IMEI: 353634110232963
> 
> IMEI SV: 18
> 
> FSN: 7Q1376000302B0
> 
> +GCAP: +CGSM
> 
> OK
> 
> echo at+cops? | socat - /dev/ttyUSB2,raw,echo=0,crnl,b115200
> 
> at+cops?
> 
> +cops: 0,0,“3”,7
> 
> OK

**/ # ip a show wwan0**  
4: wwan0: \<POINTOPOINT,MULTICAST,NOARP,UP,LOWER\_UP\> mtu 1500 qdisc fq state UNKNOWN group default qlen 1000  
link/none  
inet 79.138.249.44/29 brd 79.138.249.47 scope global wwan0  
valid\_lft forever preferred\_lft forever  
**/ # ping -c 4 [www.google.com](http://www.google.com)**  
PING [www.google.com](http://www.google.com) (142.250.74.132): 56 data bytes  
64 bytes from 142.250.74.132: seq=0 ttl=57 time=38.938 ms  
64 bytes from 142.250.74.132: seq=1 ttl=57 time=38.603 ms  
64 bytes from 142.250.74.132: seq=2 ttl=57 time=31.227 ms  
64 bytes from 142.250.74.132: seq=3 ttl=57 time=38.115 ms  
— [www.google.com](http://www.google.com) ping statistics —  
4 packets transmitted, 4 packets received, 0% packet loss  
round-trip min/avg/max = 31.227/36.720/38.938 ms

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [June 27, 2022, 11:48am UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324/2 "2022-06-27T11:48:08Z")

</div>

this may depend on the network operator whether wrong APN can establish data connection

---

<div class="post-metadata">

**Author:** ![saim](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@saim](https://forum.sierrawireless.com/u/saim)\
**Post date:** [June 27, 2022, 12:07pm UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324/3 "2022-06-27T12:07:10Z")

</div>

Ok, but is this the right way to set APN in RC76xx ?

at+cgdcont=1,“IPV4V6”,“data.tre.se”

And does it require a modem reboot after setting APN?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [June 27, 2022, 12:40pm UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324/4 "2022-06-27T12:40:13Z")

</div>

yes.  
Normally I will do a reboot after setting APN.

---

<div class="post-metadata">

**Author:** ![saim](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@saim](https://forum.sierrawireless.com/u/saim)\
**Post date:** [June 28, 2022, 6:55am UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324/5 "2022-06-28T06:55:27Z")

</div>

OK. When we don’t set any APN (leave it empty), how to know which APN is being used by the modem? Is there a way to query what APN is configured? If nothing is set using at+cgdcont, it shows empty when queried also. So it is not clear where the configuration is stored in the modem and how to retrieve that information.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [June 28, 2022, 7:00am UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324/6 "2022-06-28T07:00:49Z")

</div>

I think it would use empty APN to communicate with network

---

<div class="post-metadata">

**Author:** ![rspmn](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rspmn](https://forum.sierrawireless.com/u/rspmn)\
**Post date:** [June 28, 2022, 7:27am UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324/7 "2022-06-28T07:27:30Z")

</div>

Hi @saim,  
in that particular context you can query the APN with `AT+CGCONTRDP=1`.

Regards,  
Reinhard

---

<div class="post-metadata">

**Author:** ![saim](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@saim](https://forum.sierrawireless.com/u/saim)\
**Post date:** [June 28, 2022, 7:50am UTC](https://forum.sierrawireless.com/t/how-to-set-custom-apn/27324/8 "2022-06-28T07:50:49Z")

</div>

Thank you for your quick response. What I set with at+cgdcont is being read by at+cgcontrdp. When I set it to empty with at+cgdcont, I can now read the actual APN being configured. But when I set it to anything else, a different valid IP is assigned and the data connection still works, though the APN is wrong. This is a bit confusing.

/ # echo at+cgdcont=1,"IP","WRONGAPN" | socat - /dev/ttyUSB2,raw,echo=0,crnl,b115200  
at+cgdcont=1,“IP”,“WRONGAPN”  
OK  
/ # echo at+cgdcont? | socat - /dev/ttyUSB2,raw,echo=0,crnl,b115200  
at+cgdcont?  
+CGDCONT: 2,“IPV4V6”,“ims”,“0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,0  
+CGDCONT: 3,“IPV4V6”,“sos”,“0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0”,0,0,0,1  
+CGDCONT: 1,“IP”,“WRONGAPN”,“0.0.0.0”,0,0,0,0  
OK  
/ # echo AT+CGCONTRDP=1 | socat - /dev/ttyUSB2,raw,echo=0,crnl,b115200  
AT+CGCONTRDP=1  
+CGCONTRDP: 1,5,WRONGAPN,2.71.21.117,80.251.201.177,80.251.201.178  
OK  
/ # ip a show wwan0  
4: wwan0: \<POINTOPOINT,MULTICAST,NOARP,UP,LOWER\_UP\> mtu 1500 qdisc fq state UNKNOWN group default qlen 1000  
link/none  
inet 2.71.21.117/30 brd 2.71.21.119 scope global wwan0  
/ # ping -c 4 [www.google.com](http://www.google.com)  
PING [www.google.com](http://www.google.com) (216.58.211.4): 56 data bytes  
64 bytes from 216.58.211.4: seq=0 ttl=60 time=40.920 ms  
64 bytes from 216.58.211.4: seq=1 ttl=60 time=38.455 ms  
64 bytes from 216.58.211.4: seq=2 ttl=60 time=38.206 ms  
64 bytes from 216.58.211.4: seq=3 ttl=60 time=37.820 ms  
— [www.google.com](http://www.google.com) ping statistics —  
4 packets transmitted, 4 packets received, 0% packet loss  
round-trip min/avg/max = 37.820/38.850/40.920 ms
