robinpaulson / SimpleRT

Simple Reverse Tethering utility for Android
GNU General Public License v3.0
899 stars 101 forks source link

Routing not working, unusual IP addresses #49

Closed softwarecreations closed 2 years ago

softwarecreations commented 6 years ago

Hi, Thanks for sharing this project.

I installed SimpleRT 1.0 (2016/09/19) on the Android 4.4.4 with 3.0 Kernel, via F-Droid and compiled and ran the cli as root on the PC. When i plug the phone in, simpleRT asks if it can start the VPN, I say yes.

Afterwards I only have one item in my routing table. ip route show shows 10.10.10.0/30 dev tun0 src 10.10.10.2 ip addr show shows tun0 is up with ip 10.10.10.2/30

The problem with that is the cli gets IP 10.1.1.1 which is not reachable by the phone's routing table. I tried adding a route on the phone: ip route add 10.1.1.1 via 10.10.10.2 dev tun0 And on the PC ip route add 10.10.10.2 via 10.1.1.1 dev tun0 But they still can't ping each other, and of course the phone doesn't have a default route, so can't connect to the internet either.

I changed iface_up.sh as follows

#TUNNEL_NET=$4
TUNNEL_NET="10.10.10.0"
#HOST_ADDR=$5
HOST_ADDR="10.10.10.1"

Now theoretically they're both on the same subnet etc, but still can't ping each other and the phone still can't connect to the internet.

I've confirmed iptables-save on the PC and on the phone both show input and output have accept as the default action and there's nothing there that would block any traffic.

vvviperrr commented 5 years ago

hi. i suppose, f-droid still distribute old apk version. please, try apk from this link: https://github.com/vvviperrr/SimpleRT/releases/download/1.1/simple-rt-1.1.apk.zip

thanks for response

softwarecreations commented 5 years ago

Also having this problem. Would love to have the new version on f-droid

fschlich commented 4 years ago

to use SimpleRT with the app currently (Feb 2020) on f-droid, make the following two changes before compiling the cli:

--- a/simple-rt-cli/iface_up.sh
+++ b/simple-rt-cli/iface_up.sh
@@ -42,7 +42,7 @@ function linux_stop {
 }

 function osx_start {
-    ifconfig $TUN_DEV $HOST_ADDR 10.1.1.2 netmask 255.255.255.0 up
+    ifconfig $TUN_DEV $HOST_ADDR 10.10.10.2 netmask 255.255.255.0 up
     route add -net $TUNNEL_NET $HOST_ADDR
     sysctl -w net.inet.ip.forwarding=1
     echo "nat on $LOCAL_INTERFACE from $TUNNEL_NET/$TUNNEL_CIDR to any -> ($LOCAL_INTERFACE)" > /tmp/nat_rules_rt
diff --git a/simple-rt-cli/src/network.c b/simple-rt-cli/src/network.c
index 92ac222..02dcd0a 100644
--- a/simple-rt-cli/src/network.c
+++ b/simple-rt-cli/src/network.c
@@ -40,7 +40,7 @@
 )

 #define SIMPLERT_NETWORK_ADDRESS \
-    SIMPLERT_NETWORK_ADDRESS_BUILDER(10,1,1,0)
+    SIMPLERT_NETWORK_ADDRESS_BUILDER(10,10,10,0)

 #define NETWORK_ADDRESS(addr) \
     ((addr) & 0xffffff00)

very useful software, thanks a ton!

robinpaulson commented 2 years ago

Hi @fschlich Thanks for this patch. Would you mind opening a PR, it'd be good to cleanly attach author attribution to the repository. Cheers!

Oh... or is this fixed in the later not-yet-in-f-droid version of the Android app? If so, never mind.

softwarecreations commented 2 years ago

@robinpaulson @fschlich 's comment was not about the APK, it was about the linux/mac script. The unusual 10.1.1... ip's are still in there. https://github.com/robinpaulson/SimpleRT/blob/master/simple-rt-cli/iface_up.sh#L45 I don't use Apple, so can't comment on Apple stuff.

robinpaulson commented 2 years ago

Yeah, I just discovered that, thanks.

The obvious shell scriptiness of the patch should have alerted me. Read first, type second!

fschlich commented 2 years ago

this was indeed fixed in 00258f8

thanks!

robinpaulson commented 2 years ago

Closing, please reopen if there are still problems