3

I have 2 devices:

  1. Android phone which runs VPNService and also has 3G connection. I use this device as a mobile hot spot.
  2. Android phone which connects to the 1st device as a client.

Both devices run Android 4.4.4

This is how I setup the VPNService:

mInterface = builder.setSession("MyVPNService")
    .addAddress("1.0.0.1", 24)
    .addRoute("0.0.0.0", 0)
    .establish();

FileInputStream in = new FileInputStream(
        mInterface.getFileDescriptor());
FileOutputStream out = new FileOutputStream(
        mInterface.getFileDescriptor());

I assume that the 2nd device uses the 1st device as a default gateway.

When the 2nd device tries to browse the web, and I print out the captured packets from the in file descriptor in the 1st device, I don't see any traffic which should have come from the 2nd device.

Any idea why?

noti
  • 887
  • 7
  • 25
  • Do you see traffic from the 1st device itself? And in the device settings on that device, the vpn is active? – zapl Nov 14 '15 at 10:28
  • Yes, If the 1st device tries to go to the web I can capture the packets. – noti Nov 14 '15 at 10:32
  • 1
    I fear you'll have to dig in the internals of how your device does the routing & how it sets up the hotspot. `adb shell` into the device and see via the `ip` command (should be present on devices, if you're lucky you got more) along the lines of `ip route` & `ip rule`. I guess it's setup so that the hotspot, which should be a NAT rule isn't using your vpn interface http://linux-ip.net/html/tools-ip-route.html / http://linux-ip.net/html/tools-ip-rule.html has some examples that may or may not apply to your device – zapl Nov 14 '15 at 11:01

0 Answers0