Can not connect via USB

No, my email was in reference for usb0/usb1/SoftAp0 as
dnsmasq/hostapd/etc are involved..

Regards,

I have installed the latest debian image on my BBB. And I don’t know how to proceed with getting the internet to work via USB .

Does making the following changes in /etc/default/bb-boot get you a internet connection ? (I mean via Wifi as a gateway BBB via USB<–>UBUNTU<-> Wifi )

Best
Rajesh

Just use iptables on your Ubuntu host:

https://github.com/RobertCNelson/boot-scripts/blob/master/network/doc-debian-setup.md

And run this script on the beagle

sudo /opt/scripts/network/usb_linux_usb0_ics.sh

Regards,

Hi Robert,
I tried the script on my PC Ubunutu host .
All commands went through except for the last two, for which the error message was something like :

update-alternatives: error: alternative /usr/sbin/arptables-legacy for arptables not registered; not setting

update-alternatives: error: alternative /usr/sbin/ebtables-legacy for ebtables not registered; not setting

And after that when I ran the script on my BBB all I got was :

debian@beaglebone:~$ sudo /opt/scripts/network/usb_linux_usb0_ics.sh
SIOCADDRT: File exists
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.7.1 icmp_seq=1 Destination Host Unreachable

And the IP was unreachable. Is it something which is trivial and I am doing wrong ?.

One more question in the following command :

sudo iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
sudo iptables --append FORWARD --in-interface eth1 -j ACCEPT
I would want to use my wifi id instead of eth0 if I want the internet to go through PC Host wifi , right ?And my eth0 is 192.168.7.1 & eth1 is 192.168.6.1. Is it encouraged to use eth1 for BBB on Linux instead of 192.168.7.1 ?

You may need to install the missing arptables and ebtables if they are not already installed:

sudo apt-get install -y iptables arptables ebtables

Cheers,

Jon

Side note, now that Debian 10.x Buster and Ubuntu 20.04 are shipping
nftables by default

anyone want to dive and try getting nftables to do the same thing as:

sudo iptables --table nat --append POSTROUTING --out-interface eth0 -j
MASQUERADE
sudo iptables --append FORWARD --in-interface eth1 -j ACCEPT

Regards,

I reinstalled the latest debian on BBB.
I was able to install **arptables ebtables on my host side.**Everything went well .
But still I am not able to ping 8.8.8.8 or any DNS name for that matter.

And still get the same output :

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 192.168.7.1 icmp_seq=1 Destination Host Unreachable

  1. Is it because of connmanctl(on the host or BBB) by any chance ?

  2. My “netstat -rn” of BBB looks fine

Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.7.1 0.0.0.0 UG 0 0 0 usb0
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 usb1
192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0

  1. The BBB website https://beagleboard.org/upgrade has these instructions which did work, but after restart didn’t last
    In your host operating system, you’ll need to share your Internet connection back to the board. With an Ubuntu host, use the utility “nm-connection-editor”.
sudo ip addr flush dev usb0
sudo dhclient usb0

I am really confused .

Looks to me that all you need is;

sudo route add default gw 192.168.7.1

I reinstalled the latest debian on BBB.
I was able to install *arptables ebtables on my host side.*Everything went
well .
But still I am not able to ping 8.8.8.8 or any DNS name for that matter.

*And still get the same output :*
*PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
      *
*From 192.168.7.1 icmp_seq=1 Destination Host Unreachable *

1. Is it because of connmanctl(on the host or BBB) by any chance ?

2. My "*netstat -rn*" of BBB looks fine
Destination Gateway Genmask Flags MSS Window irtt
Iface
0.0.0.0 192.168.7.1 0.0.0.0 UG 0 0
0 usb0
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0
usb1
192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0
usb0

3. The BBB website https://beagleboard.org/upgrade has these instructions
which did work, but after restart didn't last
    In your host operating system, you'll need to share your Internet
connection back to the board. With an Ubuntu host, use the utility
"nm-connection-editor".

sudo ip addr flush dev usb0
sudo dhclient usb0

I am really confused .

One thing that is needed is that the upstream host (your PC?) needs to be
doing IP forwarding. I don't know what that is for either Mess-Windows or
MacOSX, but for Linux, you need something like:

sysctl -w net.ipv4.ip_forward=1

somewhere in the host's startup. Where and how depends on the distro, kernel
version, distro vintage, type of init (sysV, upstart, systemd, etc.).

@Ken Yep, I already did add the default gateway and the response I get is “already exists” .

@Robert, yep I un-commented that part.

<b>root@sp3:~# grep forward /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6 </b>

net.ipv6.conf.all.forwarding=1

followed by this command "sysctl -a |fgrep .forwarding |grep ^net |grep ipv4"

But nothing seems to be helping,
Also should I try using usb1 i.e. 192.68.6.2 ?? As of now the way I am trying is to get my 192.168.7.2 requests to forward to my PC wifi connection.

sudo iptables --table nat --append POSTROUTING --out-interface wlp8s0 -j MASQUERADE (wlp8s0 is my PC Wifi )
sudo iptables --append FORWARD --in-interface eth0 -j ACCEPT (eth0 is 192.168.7.2)

I don’t know what you are doing with

<b>root@sp3:~# grep forward /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6 </b>

net.ipv6.conf.all.forwarding=1

followed by this command "sysctl -a |fgrep .forwarding |grep ^net |grep ipv4"

Can you upload a copy of the script?

All I can say about the route add default is your route printout shows a default route on the BBB
but it’s 0.0.0.0 in the left column. Try sudo route delete default gw 192.168.7.1 then re-enter it as
sudo route add default gw 192.168.7.1 then do the route list again and see if the 0.0.0.0 in
the first column is replaced by the word default. And if it is try ping 8.8.8.8 again.

Let me know.

Hi Ken,
I used the grep forward /etc/sysctl.conf after following drew’s post about setting up a USB connection.
https://docs.google.com/viewer?a=v&pid=forums&srcid=MTczNzY5MjQ0Njg2MjQ5NDgzODcBMDAwNDQ0MDU5Mzk5ODM4OTQwMTcBSkFWYVlKS3BBZ0FKATAuMQEBdjI

I did delete the default gw and set i back to 192.168.7.2 But it doesn’t help. I still see 0.0.0.0 on the left column. All I get is :
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. From 192.168.7.1 icmp_seq=1 Destination Host Unreachable From 192.168.7.1 icmp_seq=2 Destination Host Unreachable From 192.168.7.1 icmp_seq=3 Destination Host Unreachable From 192.168.7.1 icmp_seq=4 Destination Host Unreachable From 192.168.7.1 icmp_seq=5 Destination Host Unreachable

Also my /etc/network/interfaces contains following lines :

#auto lo
#iface lo inet loopback

Should I uncomment these lines and save ?Will it make a difference ?

The following is my netstat -rn for my Ubuntu Linux host PC:

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp8s0
10.42.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.42.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp8s0 (wlp8s0 is my wifi)

And my BBB routing table looks like

Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.7.1 0.0.0.0 UG 0 0 0 usb0
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 usb1
192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0

So I used

sudo iptables --table nat --append POSTROUTING --out-interface wlp8s0 -j MASQUERADE (wlp8s0 is my PC Wifi )
sudo iptables --append FORWARD --in-interface eth0 -j ACCEPT (eth0 is 192.168.7.2)

Any help is appreciated !

Best Raj
root@rajeshpc:/home/rajesh# ifconfig

I too am having problems today. In your regard

The following is my netstat -rn for my Ubuntu Linux host PC:

Kernel IP routing table


Destination Gateway Genmask Flags MSS Window irtt Iface

0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlp8s0
10.42.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.42.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp8s0 (wlp8s0 is my wifi)

And my BBB routing table looks like


Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.7.1 0.0.0.0 UG 0 0 0 usb0
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 usb1
192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0

The gateway address on BOTH sides of the connection should match
with one side being …1 and the other side being …2 If they do not
line up each side will not see the other side.

I’m seeing a similar issue with a BBAI.
However, on my host Ubuntu 18 system, I am seeing the network ports from the BB in the routing table.

$ sudo netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0
192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1

On the BB:
# netstat -rn

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.7.1 0.0.0.0 UG 0 0 0 usb0
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 usb1
192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0
192.168.8.0 0.0.0.0 255.255.255.0 U 0 0 0 SoftAp0

Running tcpdump on my Ubuntu system, I can see where the incoming traffic from the BB is reaching the correct IP on the host but does not seem to be getting routed out.

On BB:

# ping -I usb0 8.8.8.8

On Host:

$ sudo tcpdump -nvvi wlan0 ‘icmp[icmptype] == icmp-echo or icmp[icmptype] == icmp-echoreply’
tcpdump: listening on wlan0, link-type EN10MB (Ethernet), capture size 262144 bytes
08:55:34.027628 IP (tos 0x0, ttl 115, id 44071, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.2.216 > 8.8.8.8: ICMP echo request, id 1402, seq 1, length 64
08:55:34.049037 IP (tos 0x20, ttl 52, id 0, offset 0, flags [none], proto ICMP (1), length 84)
8.8.8.8 > 192.168.2.216: ICMP echo reply, id 1402, seq 1, length 64
08:55:35.049654 IP (tos 0x0, ttl 115, id 44297, offset 0, flags [DF], proto ICMP (1), length 84)
192.168.2.216 > 8.8.8.8: ICMP echo request, id 1402, seq 2, length 64
08:55:35.067301 IP (tos 0x20, ttl 52, id 0, offset 0, flags [none], proto ICMP (1), length 84)

It seems that something either on the Ubuntu side or in the network is blocking the traffic.

Cheers,

Jon

On the Beaglebone can you ping 192.168.7.1 ?

On my Beaglebone here is what I get

debian@beaglebone:~$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.7.1 0.0.0.0 UG 0 0 0 usb0
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 usb1
192.168.147.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0

Looking at your setup I would say the ping will fail

$ sudo netstat -rn
Kernel IP routing table

Destination Gateway Genmask Flags MSS Window irtt Iface

0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.6.0 0.0.0.0 255.255.255.0 U 0 0 0 usb0
192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1

Unfortunately my only Linux hosts are on VM’s.

I can ssh between the PC and the BB via 192.168.7.x and back without issue.
However, no traffic is sent out passed the wireless connection.

Jon

Jon,

So you can ssh from the PC to the BB and ssh to the PC from the BB…

So the two are talking. Hum.

Have you checked the firewall on the PC side to make sure it is allowing traffic from 192.168.7 out?

Jon,

So you can ssh from the PC to the BB and ssh to the PC from the BB...

So the two are talking. Hum.

Have you checked the firewall on the PC side to make sure it is allowing
traffic from 192.168.7 out?

And is it set to forward IP packets? You might need to have the PC implement
NAT and/or Masquading. And yes, check the firewall.

Okay, I solved my issue by adding an iptable entry for the return from wlan0 to eth1 (BB).

sudo iptables -A FORWARD -i wlan0 -o eth1 -j ACCEPT

Now pinging ‘8.8.8.8’ from the BB works as expected.

root@beaglebone:~# ping -I usb0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 192.168.7.2 usb0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=103 time=17.9 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=103 time=15.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=103 time=15.3 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=103 time=15.7 m

Cheers,

Jon

I was finally able to connect to the internet via USB(still dont know what the problem was, I just reinstalled my Host Ubuntu)

I followed the instructions given by Robert and ran the script on my Host PC https://github.com/RobertCNelson/boot-scripts/blob/master/network/doc-debian-setup.md.
And this on the BBB " sudo /opt/scripts/network/usb_linux_usb0_ics.sh "

But ,the above instructions apparently doesn’t save the configuration , and the default gateway disappears after the BBB is rebooted.
So I have to execute this command sudo /opt/scripts/network/usb_linux_usb0_ics.sh every reboot.

Do I still need to save the config in /etc/network/interfaces something like :
iface usb0 inet static
address 192.168.7.2
netmask 255.255.0.0
network 192.168.7.0
gateway 192.168.7.1

OR
does it have to be through a bash script which runs has to be set to autorun mode after boot ?

Thanks
Rajesh