5

Internet connection on Ubuntu is by Ethernet cable.
I want to connect two devices and share internet from Ubuntu to Samsung Galaxy Note Edge [SM-N915FY; android: 6.0.1] and Samsung Galaxy Note 9 [SM-N960F; android 10] by USB cable. I have read all previous topics about sharing internet, tired all but I have failed to share data.

In Connections - System Settings Module -> tab IPv4 changed method to Shared to other computers, but still not working.

Of course I've accepted permission to access by PC on phone.
There is no reverse tethering option on both Samsung Notes. Also tired to enable USB debugging.

UMR
  • 163

2 Answers2

5

Pretty old question but there is a simple way, thanks to an amazing tool

  1. obtain Gnirehtet
  2. install adb and allow USB debugging
  3. run ./gnirehtet run

See https://www.ubuntubuzz.com/2019/09/android-reverse-tethering-with-ubuntu-1804.html

Déjà vu
  • 969
2

I have a way but a little bit tricky. You are going to need:

  • Android with the "USB-PC internet share" option (not the classic USB tethering)
  • iptables or nftables (for masquerade/SNAT)
  • tcpdump
  • iproute2
  • a dns server on your linux (dnsmasq is quick to set up)

1/ On you android device: got to Settings >> Network connection >> Tethering and portable hotspot >> USB-PC internet share . Say ok or choose any OS suggested (usually different Windows versions), it does not matter as long as the functionnality is enabled. => now your smartphone is going to immediately try to connect to internet, but your Linux system is not yet ready. You will need to retrieve the folling information: the subnet and the default gateway you smartphone is going to use. This can be done with tcpdump

2/ On your Linux: use tcpdump to capture traffic from the USB network interface (enabled when USB PC internet share is activated from android). You are going to see a lot of whohas XXXX. This ip address is the default gateway you android is trying to reach. add this ip address and the correct subnetmask to the tethering interface (sudo ip address add XXXXX dev XXXX) or use network manager

3/ enable masquerading with iptables:

sudo iptables -A POSTROUTING -o usb_thethering_interface -j MASQUERADE

4/ make sure you dns server is working on the Linux.

Should work fine

FatRabbit
  • 148