5

I would like to share my 4GLTE within my home network by tethering from my phone through USB. The reason is because I have other devices that need to communicate with each other without the need for Internet.

The following setup works without a problem: Android USB Tethering >Windows PC>Router WAN port

Now, I would like to do the same thing on the raspberry pi so it's as follows:

Android USB Tethering>Raspberry pi USB port---Raspverry pi eth0>Router WAN

The problem seems I don't know how I can share or simply allow traffic from USB to eth0 to pass through.

I followed a lot of tutorials and none of them worked.

The best I found that I understood involved installing bridging utils and setting up the br0 interface but that doesn't work either. I'm thinking the RPI3 has to dish out IPs.

Also, the router [Linksys 4200] does have a USB port and is running DD-WRT but I hear the USB support is for USB modems only. It doesn't work.

chx101
  • 171
  • 1
  • 7

1 Answers1

2

Ok. I was able to get it to work.

Things to note:

  • With current version of Raspbian (JESSE/LITE), the use of /etc/network/interfaces is obsolete. But keep it as it is used by if-up and if-down scripts.

My Setup

  • Gave Raspberry Pi's eth0 a static IP address, connected to router's WAN port.
  • Gave router a static IP address on the same network with the Raspberry Pi as the gateway.
  • Installed dnsmasq [sudo apt-get install dnsmasq] on the Raspberry Pi.
  • Configured packet forwarding [net.ipv4.ip_forward = 1] in /etc/sysctl.conf
  • Configured routing using iptables
    • sudo iptables -t nat -A POSTROUTING -o usb0 -s 192.168.2.0/24 -j MASQUERADE. usb0 is the source interface. One can add a post-up script in /etc/network/interfaces to automate this.

Configuring the static IP address static in /etc/dhcpcd.conf

interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
chx101
  • 171
  • 1
  • 7