2

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.

4
  • It is probably quite a bit easier to check your router for DHCP options, and setting it up to provide "Internet" to the phones via wlan.
    – Hannu
    Aug 10, 2020 at 16:32
  • as i mentioned before, i want to share internet via USB, not wireless. I know how to share internet wireless, but not via USB.
    – UMR
    Aug 21, 2020 at 20:13
  • Right, now the big question is; is there a driver that works for Ubuntu or any other linux? Please be more specific.
    – Hannu
    Sep 26, 2020 at 7:41
  • 1
    Does this answer your question? How to share a wired Internet connection with an Android phone (reverse-tethering)?
    – user68186
    Aug 13, 2021 at 14:25

2 Answers 2

2

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

1
0

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

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.