genesite
Posts: 2
Joined: Mon May 13, 2019 8:48 am

Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Mon May 13, 2019 10:21 am

Hello Guys!!

I'm Jack from South Korea. English is not my first language. Please Don't be mad what I say here.

Question is, Is it possible to share the internet connection from my RPi3 B+ via ethernet to a second device via USB connection ?
The project is like follow,

(Internet) <--- connect via ethernet ---> My RPi3 B+ <--- connect via USB ---> a second device

What I am going to do,

1. It communicates USB CDC ACM between my RPi3 B+ and the second device( few commands and response )
2. One or Two Web application are going to run on the second device. The OS of second device is Linux
3. The second device has no the internet connection.
4. So, Trying to get the internet connection from RPi3 B+ through USB on the second device.

I have been googling lots of things such as USB tethering, USB reverse tethering, how to set USB reverse tethering on Linux, etc...
And get many different answers.

That's why I'm here and writing.

Any ideas for this ? I will really appreciate if you guys give me an advise.

Thank you.

User avatar
topguy
Posts: 5466
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Mon May 13, 2019 12:17 pm

1. It communicates USB CDC ACM between my RPi3 B+ and the second device( few commands and response )
The USB of the RPi3 can only be in "host" mode (as far as I know). So what exactly is your "second device" ?
The RPi3 can not "be" or "emulate" a CDC-ACM device.

If both devices are USB hosts then you can try special cable and the usbnet module.
http://www.linux-usb.org/usbnet/

The special cable is basically two usb2serial cables spliced together. Both devices see a ttyUSB or ttyACM device to send data over.

fruitoftheloom
Posts: 19483
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Mon May 13, 2019 12:40 pm

topguy wrote:
Mon May 13, 2019 12:17 pm
1. It communicates USB CDC ACM between my RPi3 B+ and the second device( few commands and response )
The USB of the RPi3 can only be in "host" mode (as far as I know). So what exactly is your "second device" ?
The RPi3 can not "be" or "emulate" a CDC-ACM device.

If both devices are USB hosts then you can try special cable and the usbnet module.
http://www.linux-usb.org/usbnet/

The special cable is basically two usb2serial cables spliced together. Both devices see a ttyUSB or ttyACM device to send data over.

USBNet

https://www.raspberrypi.org/forums/view ... 6&t=131042
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Stretch.

User avatar
thagrol
Posts: 1461
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Mon May 13, 2019 7:00 pm

A lot depends on what the second device is, what ports are available on it, and what transfer speeds you require.

What you're wanting has two parts:
  1. The physical connection between the two devices
  2. Network bridging or routing on the Pi3
Options for the physical connection depends on what ports and OS features are available on the second device but could include:
  • Two USB to ethernet dongles and a network cable
  • As already suggested a USB net cable
  • Two USB to serial dongles and a null modem cable
  • If the second device supports it, running it as a CDC ACM or RNDIS slave device (e.g. running the g_ether module on a a Pi zero, zeroW, A, or A+). Your second device must be able to run as a USB slave and a non-standard cable may be required (it is for the A/A+ Pi)
As for the second part, bridging is easier to setup but won't work if the Pi3's internet connection is over wifi. Bridging also exposes everything on the second device to your lan.

Routing/NAT is more complex to set up but does keep the second device much more isolated from the rest of your network. Outgoing connections are fine but new incoming ones will be blocked unless explictly configured otherwise.

There are plenty of tutorials on setting up the network side of things so hit your favourite search engine.
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

genesite
Posts: 2
Joined: Mon May 13, 2019 8:48 am

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 1:58 am

Thank you for your replies.
The USB of the RPi3 can only be in "host" mode (as far as I know). So what exactly is your "second device" ?
What I said "second device" is, Actually the second device is the main device of the project. There is a SoC on the second device and working with Linux. The real purpose of RPi3 is to connect the second device(a.k.a Main device) with LCD JIG board for development. Like follow,

[ Touch-LCD JIG board ] <---- connect via USB ---> RPi3 <---- connect via USB ----> [ Second device(Main device) ]
[ Touch-LCD JIG board ] <---- USB to UART(FT232R )---> RPi3 <---- USB to UART(FT232R)---> [ Second device(Main device) ]
[ Touch-LCD JIG board ] <---- /dev/ttyUSB1 ----> RPi3 <---- /dev/ttyACM0 ----> [ Second device(Main device) ]

At this moment, LCD JIG board and second device have no internet connection. So RPi3 only has ethernet connection for Internet(not use WiFi so Only ethernet for RPI) and I'm trying to share the Internet connection from RPi3 to second device through USB physical connection to run a Web application at the second device for test.

I'm not a good at USB communication and Network. My co-league ask me to find out that Shareing internet connection of RPi3 to second device through USB connection is possible or NOT( my co-league tell me USB CDC NCM... I don't really get it. I never deal with USB communication)

Now we can not fix the second device board. So I have to get thought this issue only with physical USB connection between RPi3 and the second device. I can not use any kinds of USB dongle, extra things.

Is is enough details for an answer?
I really appreciate for you guys replies. But I still need you guys hands.

Thank you

User avatar
thagrol
Posts: 1461
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 9:53 am

genesite wrote:
Tue May 14, 2019 1:58 am
Is is enough details for an answer?
Not really.

USB is a one master, many slaves bus. Some devices are able to perform both roles though not simultaneously.

Because of the onboard USB hub (which provides ethernet too), the 3B+ cannot act as a USB slave.

If the SoC on the main (second) device can work as a USB slave and you can run one of g_ether, g_serial, etc on it you may be able to connect the two devices with the Pi as the master. IN this case the OS will take care of the low level USB stuff so all you'd need to do is treat the link as you would any other network or serial link.

If it can't you're out of luck. Wel,l unless you can find a way of adding another USB controller that can do slave mode to the Pi.

Is this for a comercial project or for use in a comercial environment? If so, I suspect further and more detailed help won't be forthcoming as nobody likes to work for free.
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

fruitoftheloom
Posts: 19483
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 10:03 am

thagrol wrote:
Tue May 14, 2019 9:53 am

If it can't you're out of luck. Wel,l unless you can find a way of adding another USB controller that can do slave mode to the Pi.

As I linked above a USBNET Cable will connect 2 USB Hosts, though works best under Linux which most Operating Systems have built in support...

...so yes it is "feasible"
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Stretch.

User avatar
thagrol
Posts: 1461
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 12:51 pm

fruitoftheloom wrote:
Tue May 14, 2019 10:03 am
thagrol wrote:
Tue May 14, 2019 9:53 am

If it can't you're out of luck. Wel,l unless you can find a way of adding another USB controller that can do slave mode to the Pi.

As I linked above a USBNET Cable will connect 2 USB Hosts, though works best under Linux which most Operating Systems have built in support...

...so yes it is "feasible"
Sure, but that doesn't fit the OP's requirement that: "I have to get thought this issue only with physical USB connection between RPi3 and the second device. I can not use any kinds of USB dongle, extra things."

...so no, it isn't.
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

fruitoftheloom
Posts: 19483
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 1:50 pm

thagrol wrote:
Tue May 14, 2019 12:51 pm
fruitoftheloom wrote:
Tue May 14, 2019 10:03 am
thagrol wrote:
Tue May 14, 2019 9:53 am

If it can't you're out of luck. Wel,l unless you can find a way of adding another USB controller that can do slave mode to the Pi.

As I linked above a USBNET Cable will connect 2 USB Hosts, though works best under Linux which most Operating Systems have built in support...

...so yes it is "feasible"
Sure, but that doesn't fit the OP's requirement that: "I have to get thought this issue only with physical USB connection between RPi3 and the second device. I can not use any kinds of USB dongle, extra things."

...so no, it isn't.

OP

(Internet) <--- connect via ethernet ---> My RPi3 B+ <--- connect via USB ---> a second device


I have used a USBNET Cable to connect a Xubuntu x86 PC with internet access and used connection sharing to give a Raspberry Pi SBC internet access.

The OP wanted to share via USB so must have envisaged using a cable ?
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Stretch.

User avatar
topguy
Posts: 5466
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 2:15 pm

So I have to get thought this issue only with physical USB connection between RPi3 and the second device. I can not use any kinds of USB dongle, extra things.
Why is the "no dongles" so important, any physical USB connection between two devices is going to occupy ONE usb port on each device regardless. Why does it matter what you insert in those ports if it provides the network link you want ?

fruitoftheloom
Posts: 19483
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 2:22 pm

topguy wrote:
Tue May 14, 2019 2:15 pm
So I have to get thought this issue only with physical USB connection between RPi3 and the second device. I can not use any kinds of USB dongle, extra things.
Why is the "no dongles" so important, any physical USB connection between two devices is going to occupy ONE usb port on each device regardless. Why does it matter what you insert in those ports if it provides the network link you want ?

Yes 2 X USB Ethernet Dongles and an Ethernet Cable would also suffice....... ;)
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Stretch.

User avatar
thagrol
Posts: 1461
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 3:46 pm

fruitoftheloom wrote:
Tue May 14, 2019 2:22 pm
topguy wrote:
Tue May 14, 2019 2:15 pm
So I have to get thought this issue only with physical USB connection between RPi3 and the second device. I can not use any kinds of USB dongle, extra things.
Why is the "no dongles" so important, any physical USB connection between two devices is going to occupy ONE usb port on each device regardless. Why does it matter what you insert in those ports if it provides the network link you want ?

Yes 2 X USB Ethernet Dongles and an Ethernet Cable would also suffice....... ;)
As would a couple of USB to serial adaptors adn a null moidem cable.

Didn't someone suggest both of those already? Oh wait...
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

fruitoftheloom
Posts: 19483
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Is it possible to share the internet connection from my RPI3B+ to a second device through USB?

Tue May 14, 2019 3:55 pm

thagrol wrote:
Tue May 14, 2019 3:46 pm
fruitoftheloom wrote:
Tue May 14, 2019 2:22 pm
topguy wrote:
Tue May 14, 2019 2:15 pm


Why is the "no dongles" so important, any physical USB connection between two devices is going to occupy ONE usb port on each device regardless. Why does it matter what you insert in those ports if it provides the network link you want ?

Yes 2 X USB Ethernet Dongles and an Ethernet Cable would also suffice....... ;)
As would a couple of USB to serial adaptors adn a null moidem cable.

Didn't someone suggest both of those already? Oh wait...

Yes it is difficult when the OP is not the person who is using the "devices" and has no concept of the conception, so another merry-go-round post !!!!
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Stretch.

Return to “Networking and servers”