7

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?

5
  • i've not used such a thing but something to consider, does nmap -P0 dongleip tell you anything about whether the device is up/down? (-P0 is when a device doesn't accept ping). If that tells you whether it's up or down then it may be an alternative option. – barlop Dec 23 '14 at 21:25
  • 2
    You are not out of options if you have not tried contacting Support for your 3G dongle yet. Most of the manufacturers for these devices have support articles about enabling a public IP address. My TP-Link 3G router has these instructions: tp-link.us/article/?faqid=300 – user387876 Dec 23 '14 at 21:57
  • What exactly You are trying to accomplish (XY problem suspected - xyproblem.info)? I think making pings to systems behind NAT (not controlled by yourself) is not worth the effort. If for example You need some heartbeat from this RPi, other options may be more viable. It also depends on other resources You control (do You control any machine with public IP?). – kestasx Dec 26 '14 at 15:24
  • 1) I will contact my provider as soon as the holidays are over. 2) No heartbeat, no other resources – nixda Dec 26 '14 at 15:28
  • This worked for me. Even from school, I could check if our dongle is being used. – Tomáš Zato - Reinstate Monica Dec 27 '14 at 0:49
5
+100

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.

3

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.

2
  • 1
    heh. I was trying to post openvpn as an alternative to ipv6, and I noticed your answer went into much more detail than I did. Awesome. – Journeyman Geek Dec 27 '14 at 1:49
  • 1
    I ended up using OpenVPN. Not so comfortable as I had to set up a second device – nixda Sep 13 '15 at 10:23
1

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.

0

If your provider is giving you an IPv4 address, then it is very likely that you are behind a many-to-one NAT gateway and you won't be able to reach inside the NAT from the outside.

A possible solution might be to connect to an external VPN service to get a public IP address.

Another possible solution is to contact the Support of your 3G provider and ask for a static IP address. Even if this is possible, it might still require extra payment.

2
  • An external VPN is unlikely to give you a external IP address, and the OP has ruled out paying for a static iv4 address in the question itself. – Journeyman Geek Dec 27 '14 at 1:42
  • @JourneymanGeek: A VPN service that does port forwarding is a solution. There exist today ultra-cheap offers of even 19$ for 3 years. – harrymc Dec 27 '14 at 9:32
0

You could configure your 3G dongle with a different APN. internet.t-d1.de gives you a public IP (they say this APN should be used for testing purposes only, so be aware that you're likely on your own if you encounter problems). I accessed my notebook via ssh over the IP that i was assigned with those settings. Also see here for more info regarding available Telekom APNs (german only).

-2

I would get ipv6 for my local network if something like this was important. Apart from the ridiculous addresses which cannot be easily remembered it's pretty cool. And you can get a free chunk of addresses.

1
  • 1
    That assumes that he's on a local network, clearly he's not – Journeyman Geek Dec 27 '14 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.