USB tethering (from Android) to GhostBSD?

Help with setting up network cards, including WiFi cards.
Post Reply
numericalanalysis
Posts: 6
Joined: Fri Jul 10, 2015 8:30 am
Has thanked: 0
Been thanked: 0

USB tethering (from Android) to GhostBSD?

Post by numericalanalysis »

Hello,
Has someone managed to connect an Android phone as a modem USB? ("tethering")

(Because some issues with GhostBSD I am meanwhile on PC-BSD, where I tried many options (kldload if_cdce or if_rndis) but with no results. I would reinstall GhostBSD in place of an old Windows, but I am now wondering if it will not be too difficult to manage internet connection, because I often use the 3G connection from my mobile phone.)

All idea would be welcome. Thank you.

User avatar
bsdkeith
Posts: 129
Joined: Wed Jun 12, 2013 3:36 pm
Location: Surrey/Hants Border, England
Has thanked: 0
Been thanked: 0

Re: USB tethering (from Android) to GhostBSD?

Post by bsdkeith »

Maybe these threads on the FreeBSD Forum can help.
https://forums.freebsd.org/search/50059 ... ing&o=date
Linux user since 1999; & now a BSD user.

tankist02
Posts: 15
Joined: Wed Sep 04, 2013 5:46 pm
Has thanked: 0
Been thanked: 0

Re: USB tethering (from Android) to GhostBSD?

Post by tankist02 »

Last time I tried to connect my Nexus 7 to FreeBSD 10 STABLE it didn't work - device was not recognized. BTW modern Android uses MTP protocol to connect via USB cable.

numericalanalysis
Posts: 6
Joined: Fri Jul 10, 2015 8:30 am
Has thanked: 0
Been thanked: 0

Re: USB tethering (from Android) to GhostBSD?

Post by numericalanalysis »

Thank you for replies ;)

@bsdkeith: Yes I have read these threads but I have not found something that works (I am a novice, too)... :roll:
@tankist02: Maybe, but my Android is old (Gingerbread) and I read on Wikipedia that only since version 3.1 it uses MTP.

seancox
Posts: 1
Joined: Wed Dec 06, 2017 4:53 am
Has thanked: 0
Been thanked: 0

Re: USB tethering (from Android) to GhostBSD?

Post by seancox »

still have not found something that works
_____________
192.168.0.1

wb7odyfred
Posts: 40
Joined: Sat Nov 12, 2016 5:44 pm
Has thanked: 0
Been thanked: 1 time

Re: USB tethering (from Android) to GhostBSD?

Post by wb7odyfred »

USB Tethering with Android, Here is a good article with explicit instructions:
https://www.adminbyaccident.com/freebsd ... -usb-port/

urndis -- USB Remote NDIS Ethernet device

Short Steps:

Code: Select all

ifconfig
kldstat
kldload if_urndis            # load kernel module  if_urndis
kldstat | grep if_urndis   # check if it loaded 
ifconfig ue0 up
dhclient ue0
ping -c 3 8.8.4.4
ping -c 3 ghostbsd.org
ping -c 3 he.net
netstat -r
sockstat -4
kldstat check what kernel modules are already loaded
kldload kernel module if_urndis.ko
Grep for "if_urndis" in kernel modules list to see if it loaded
## Do we need to create to execute or is automatic "ifconfig wlan0 create wlandev ue0"
turn on network device ue0 if ue0 up
fill IP values with dhclient ue0
See if we connected to Internet and can ping other IP values

Ping a DNS number 192.168.1.1 or google 8.8.4.4 or ghostbsd.org or he.net Hurricane Electric dot NET
Network Statistics routing
Socket Statistics IP4

Other helpful commands:

Code: Select all

killall dhclient
killall dhcpcd
service netif restart
service network restart
ifconfig ue0 up
dhcpcd ue0
I think dhclient is better suited than dhcpcd for networking. YMMV
I don't believe the ifconfig ue0 create wlandev urndis0 is needed at all. Should delete.





More networking examples to bring up a device and test network:
https://forums.ghostbsd.org/viewtopic.php?f=64&t=526 Edimax EW-7811un USB nano dongle wifi setup
https://forums.ghostbsd.org/viewtopic.php?f=64&t=570 RTL8188CE pci wifi card
https://cyber.dabamos.de/unix/tethering/ USB Tethering example for FreeBSD with Android
Add the kernel module to /etc/rc.conf in order to load the driver while booting:

kld_list+="if_urndis"

Connect the Android phone to the Laptop using a USB cable. Make sure that WiFi and USB tethering are enabled on the phone. A new network interface ue0 will be created once the device is connected:
FreeBSD manuals:
https://www.freebsd.org/doc/en_US.ISO88 ... ering.html USB Tethering
https://www.freebsd.org/cgi/man.cgi?que ... ease-ports URNDIS

http://netbsd.2816.n7.nabble.com/USB-te ... ml#a402727
tl;dr - just enable dhcpcd in rc.conf without any specific interface

You can treat it as a normal non wired network interface and either
run 'dhcpcd urndis0' or just have dhcpcd running and let it pick it up
automatically.
If you have wifi and urndis0 both active dhcpcd will prefer the
"wired" one (urndis0), which is typically the behaviour you want.

I've been tethering NetBSD from android phones seemingly ~forever and
its been a life saver. Sometimes I find a public wifi that my NetBSD
laptop does not like, and I can just connect to it on my phone, then
USB tether to the laptop (which also charges :)

David

wb7odyfred
Posts: 40
Joined: Sat Nov 12, 2016 5:44 pm
Has thanked: 0
Been thanked: 1 time

Re: USB tethering (from Android) to GhostBSD?

Post by wb7odyfred »

wb7odyfred wrote:
Sat Apr 04, 2020 5:21 pm
USB Tethering with Android, Here is a good article with explicit instructions:
https://www.adminbyaccident.com/freebsd ... -usb-port/

urndis -- USB Remote NDIS Ethernet device
First turn on phone, connect to computer, enable Hotspot and Tethering, enable Data on phone :D
  1. connect the mobile phone to your computer
  2. activate USB tethering in settings -> Wireless and network -> More Settings -> portable hotspot and tethering -> USB tethering
  3. With the NetworkManager identified the mobile phone as network connection and you are ready to go
Short Steps:

Code: Select all

ifconfig
kldstat
kldload if_urndis            # load kernel module  if_urndis
kldstat | grep if_urndis   # check if it loaded 
ifconfig ue0 up
dhclient ue0
ping -c 3 8.8.4.4
ping -c 3 ghostbsd.org
ping -c 3 he.net
netstat -r
sockstat -4
kldstat check what kernel modules are already loaded
kldload kernel module if_urndis.ko
Grep for "if_urndis" in kernel modules list to see if it loaded
## Do we need to create to execute or is automatic "ifconfig wlan0 create wlandev ue0"
turn on network device ue0 if ue0 up
fill IP values with dhclient ue0
See if we connected to Internet and can ping other IP values

Ping a DNS number 192.168.1.1 or google 8.8.4.4 or ghostbsd.org or he.net Hurricane Electric dot NET
Network Statistics routing
Socket Statistics IP4

Other helpful commands:

Code: Select all

killall dhclient
killall dhcpcd
service netif restart
service network restart
ifconfig ue0 up
dhcpcd ue0
I think dhclient is better suited than dhcpcd for networking. YMMV
I don't believe the ifconfig ue0 create wlandev urndis0 is needed at all. Should delete.





More networking examples to bring up a device and test network:
https://forums.ghostbsd.org/viewtopic.php?f=64&t=526 Edimax EW-7811un USB nano dongle wifi setup
https://forums.ghostbsd.org/viewtopic.php?f=64&t=570 RTL8188CE pci wifi card
https://cyber.dabamos.de/unix/tethering/ USB Tethering example for FreeBSD with Android
Add the kernel module to /etc/rc.conf in order to load the driver while booting:

kld_list+="if_urndis"

Connect the Android phone to the Laptop using a USB cable. Make sure that WiFi and USB tethering are enabled on the phone. A new network interface ue0 will be created once the device is connected:
FreeBSD manuals:
https://www.freebsd.org/doc/en_US.ISO88 ... ering.html USB Tethering
https://www.freebsd.org/cgi/man.cgi?que ... ease-ports URNDIS

http://netbsd.2816.n7.nabble.com/USB-te ... ml#a402727
tl;dr - just enable dhcpcd in rc.conf without any specific interface

You can treat it as a normal non wired network interface and either
run 'dhcpcd urndis0' or just have dhcpcd running and let it pick it up
automatically.
If you have wifi and urndis0 both active dhcpcd will prefer the
"wired" one (urndis0), which is typically the behaviour you want.

I've been tethering NetBSD from android phones seemingly ~forever and
its been a life saver. Sometimes I find a public wifi that my NetBSD
laptop does not like, and I can just connect to it on my phone, then
USB tether to the laptop (which also charges :)

David

iPhone Tethering requires use of ipheth from FreeBSD Handbook settings

Apple® devices use the ipheth(4) driver.

Post Reply