Can I ping the public IP of a 3G dongle?

I want to ping my mobile device. It's a Raspberry Pi which has a 3G dongle and a working 3G connection. I can ping from my device to the outside but not the other way around.

What I've researched so far

  1. I understand that my provider is giving my dongle an IPv4 address that is behind a many-to-one NAT gateway. Thus I cannot ping my dongle's public IP from the wild internet.

  2. To my knowledge my provider (Telekom Germany) still doesn't support IPv6 for mobile connections which may be a potential solution because every device should get its own IP.

  3. I know that you can buy SIM cards with static IPv4 addresses. But they are too expensive for my needs

Am I out of options?


If your dongle is behind a NAT, then it doesn't have a public IP address and your post title is misleading. Also keep in mind that an IP can be reachable, but not ping-able, if the network's gateway forbids ICMP packets.

First of all, I think you should do what @Tyler suggested in a comment: contact your provider and ask them about:

  • Can they enable public IPv4 access for your device
  • Can they enable public IPv6 access for your device. If not yet, then when will they?
  • Any other alternative they can offer for accessing your device via their network

If these options don't work out, then I'm afraid there won't be a very user-friendly way to access your device.

A not user-friendly, and perhaps not suitable way for you, is remote port forwarding. You can connect from your raspi to a publicly accessible server, and forward connections from a port on the server to a port on your raspi. This is of course far from having a direct connection, and you would have to repeat the setup for every port that you want to access on the raspi.

Although this is less than ideal, and might not even be suitable for you, but at least this is doable, and in any case I can't think of any other option.


If your RPi's 3G dongle is behind a NAT, even if you could ping its public IP, it would not do you any good, as that is not the true IP of your RPi.

You are at the mercy of the network operator's carrier-grade NAT equipment.

Your problem is solvable to some degree using VPNs.

On a system outside of the 3G network that you control, that is reachable by your 3G dongle, setup a VPN server (such as OpenVPN). Make sure it is externally reachable.

Then, setup a VPN client on the Raspberry Pi, and have it periodically attempt to connect to the server when there is no connection. I believe if you start OpenVPN, it will basically do this, though over a 3G connection you may want to rate-limit reconnection attempts so you don't use all your 3G data trying to connect to a nonexistent VPN server, if you don't intend to run the VPN server continually. Or run it on a schedule.

If OpenVPN is set up correctly, you will be able to ping it and otherwise act as though it is directly connected.

Also, look into seeing if your 3G dongle can receive any text messages sent to its mobile number. Linux support for such a feature may be a long shot, and you may be looking at a lot of research on getting this to work, but possibly you could have something polling the dongle for text messages, and then have that start/stop a VPN or similar.


I suspect some flavour of ipv6 tunneling might help here.

I've not tried this on a pi, and with raspian ipv6 is not enabled by default anyway, but it can be enabled if you want it.

I've had most luck with v6udpv4(which is designed to punch through NAT) and the gw6c client using gogo6/freenet6 - this protocol has been the most reliable for me through a NATted connection, but you're free to pick another provider/client. Its been a few years (I've had some flavour of ISP supplied ipv6 for years) so I had to compile my own client, and I don't remember the details, but this combination ought to work. I've not found anyone who's tried using gw6c on a raspi, so YMMV.

If that dosen't work, in your specific case, I'd also suggest looking at AYIYA clients and tunnel brokers who support that as an alternative if you have issues with freenet. AYIYA seems to be designed to fit your very specific use case but the tunnel broker I was using at the time didn't support it.

IIRC a registered freenet6 account has a static IP, (and your ip address is unlikely to change anyway), so I'd suggest an AAA record and/or a dynamic DNS provider so you don't need to remember the excessively long ip address.

I'd add you'd need ipv6 on the system that's pinging it as well.

If its just about checking connectivity there might be simpler options, but that's out of the scope of the question as is.