3

This is pertaining to a smart phone with data.

My phone is connected to my WIFI which lacks internet currently. It is also connected to the cell network and using it for data. When I ifconfig it tells me I am connected on wlan with 192.168.1.4 and rmnet at 10.124.121.12. I am trying to ping a device on 192.168.1.55 for purposes.

If I turn off my cell network I can ping it fine. With my cell network on its unreachable.

How do I get my android to allow me to ping 192.168.1.55 while being on the cell network? I have only noticed this since the internet went out on my WIFI so its a strange and new problem.

3
  • That's expected. You won't be able to ping 55 from 4, but can do opposite. The reason is that Android can connect either to Wi-Fi or mobile data, which one has internet connectivity, if given option. If both are online, WiFi is preferred. It's because default route is set to mobile data (rmnet_data) interface. You can modify routing table manually if you have root access. Commented Jul 1, 2019 at 7:50
  • android.stackexchange.com/q/191343/311449 is an older duplicate of this with potentially more actionable answers, like android.stackexchange.com/a/258786/311449. Commented Nov 6 at 9:21
  • 1
    This question is similar to: How to connect to WiFi router without internet?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Nov 7 at 4:30

2 Answers 2

1

I have the same setup. I have a local WiFi network that is not connected to the internet. I found that if you go to settings on your phone, then select “Developer options” and tick “Cellular data always active” that you will have access to the WiFi network and the cell network simultaneously.

On my LG, I can be on the web with cell data and print to the printer on the local WiFi network. I just now tested a ping just to make sure and it works just as you would expect.

2
  • I am fully rooted so I will try this out when the internet dies again, its about time for it. I have seen the option but did not try it. I'll let you know how it works.
    – Adtopkek
    Commented Jul 1, 2019 at 22:06
  • This seemed to work fine for the rare instance that my internet goes out. Upvoted both of you but not enough Reputation for it to apply yet it seems.
    – Adtopkek
    Commented Jul 6, 2019 at 2:37
0

you cannot ping that device via Mobile Data. You have Device 1 (yours) and Device 2 (device to be pinged). Telling from the IPs given, both devices are on the same WiFi network. Device 1 can connect to Device 2 by requesting a ping to Device 2 on your router (Device 3).

Your router is most likely having the IP 192.168.1.1

As your router knows that you are connected to it, it will forward your ping request to Device 2 and back again.

When connected to your mobile carrier, you have a different IP. But, your router uses IPs to determine whether it knows a device or not. As you have a different IP and your ping request comes from the outside now, it does it's job: Not forwarding your ping requests. That's what the router is there for (besides establishing connections). It is a firewall and it's trying to prevent people from outside harming your devices.

When you are connected to WiFi When connected to WiFi

When you are connected to Mobile Service Data Provider When connected over cellular data

This means, that you are not actually having an Android Problem. What you need to do is to tell your router to forward PING packets. That's difficult. For that, you should head over to the Servers Fault community and ask them how you can do exactly that.

https://serverfault.com/

4
  • 1
    I've always just assumed it was connected to both networks at once and it chose a preferred path but I could force it to a certain network by using that network's IP. That does make a few ideas I had more difficult.
    – Adtopkek
    Commented Jul 1, 2019 at 22:10
  • 1
    Yes, it kind of is connected to both. You can still receive phone calls when you are connected to WiFi, right? ;) So, you have two options: Tell your phone to send ping requests to your router while using mobile data for everything else, or enable forwarding for ping packets.
    – user298936
    Commented Jul 2, 2019 at 6:16
  • But your question asked for "how can I ping device 2 whilst connected to mobile data?", that's what I answered :)
    – user298936
    Commented Jul 2, 2019 at 6:18
  • @Adtopkek, did you ever ask at ServerFault? serverfault.com/q/1035072/524922 seems similar. Commented Nov 6 at 9:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .