Can not connect via USB

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

So I added in my /etc/network/interfaces

iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
nameservers 8.8.8.8
gateway 192.168.7.1

This takes care of ping 8.8.8.8. after a reboot

But
still unable to ping www.google.com : Temporary failure in name resolution

Rajesh Kulkarni

Send another message tomorrow. I have a fix for that and it uses crontab as sudo. I
will send you examples of it all and it works. I use it.

What version of Debian are you running? cat /etc/dogtag

Hi Kenneth,
I am using Debian Buster IoT Image 2020-04-06 .

Regards,
Rajesh

Rajesh Kulkarni

A lot has changed with the 4-6 release. Don’t fool around with /etc/network/interfaces or /etc/resolv.conf.

As debian user in the home directory. cd ~/

mkdir cronjobs

copy the attached file into cronjobs

cd cronjobs

Read the top of the file postboot.sh

The following must be done as sudo because the user level will not have permission.
.

sudo crontab -e

Make entry as explained in postboot.sh

This entry will execute at boot time and sleep 20 seconds to allow the system to be up.

This may seem complicated. The reason for this setup is you can later if needed make other cronjobs
as you or as sudo. Remember full pathnames and any executed commands requiring sudo access
will need to be added as sudo crontab -e. If you want a user level cronjob just do crontab -e

When this script runs at boot time it will create a file called log. You can cat log to see the results of
the current boot. postboot.sh also updates the system date/time. Please nano or vi postboot.sh and
verify your Country / Time Zone.

So, backup original cp /etc/network/interfaces ~/. Then clean up using sudo nano /etc/network/interfaces
The only two active entries should be:

auto lo
iface lo inet loopback

Reboot sudo reboot then cat log in cronjobs

Let me know how it works out.

Ken

postboot.sh (1.29 KB)

Ken
Thank you so much ! It looks it helped.I was able to successfully ping dns server names with no issues !

  • So I copied the postboot.sh as you suggested.

  • did “sudo crontab -e”

  • Added the following in the file" @reboot sh /home/debian/cronjobs/postboot.sh 1>/home/debian/cronjobs/log 2>/home/debian/cronjobs/log "

  • Did a reboot.

  • The following is the log file :

=== Boot ===
Set Nameserver and Gateway
Nameserver 8.8.8.8, GW 192.168.7.1
Set route with gw 192.168.7.1
Display route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 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
Set timezone
Local time: Mon 2020-05-18 18:44:27 PDT
Universal time: Tue 2020-05-19 01:44:27 UTC
RTC time: Tue 2020-05-19 01:44:27
Time zone: America/Los_Angeles (PDT, -0700)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
Finished at Mon 18 May 2020 06:44:27 PM PDT

Rajesh Kulkarni,

Glad its finally fixed. Save that file postboot.sh. It may be needed in later releases.

Ken

Again , Thank you so much Kenneth !

I was wondering were you able to see all the boxes set to green when you visit the webserver of the beaglebone i.e. the getting started guide .?

Attached is a screenshot which shows only my Power and Boot to be successful, but requirements for other steps seemed not to be met yet.

Did any one else experience this ?(and yes I am connected to the internet)
Screenshot from 2020-05-18 22-04-07.png

Rajesh,

Yes, in my case from a P.C running Windows file:///F:/START.htm I can see and click on all the options.

What do you get if using your browser enter 192.168.7.2 ?

Screenshot from 2020-05-18 22-04-07.png

When I open the 192.168.7.2 page in my browser(chrome and Firefox ) It takes me to a cloud9 IDE ,inside which a introduction.md file is shown which tells me to update my OS on my BBB(although it has the latest Debian) .

And if I do go on to the “getting started” page via the cloud9 IDE NONE of the steps are highlighted in green.

Again I am able to successfully ping my PC host and BBB successfully. As a matter of fact I was able to run the program to blink LED which worked . But just the fact that I don’t see the same stuff that people do makes me think of there’s something wrong

Rajesh

Screenshot from 2020-05-18 22-04-07.png

Rajesh,I am sorry I can not duplicate this problem. I do know changes were made to default port numbers I.E. 80,8080,3000,etc.and one package was retired. Um, You mention Firefox which is what I use . Do you have ‘No Script’ loaded? If so make sure Beaglebone (192.168.7.2) is set to trusted.

Beyond this I would suggest opening a new report and stop adding to USB problem.

Ken

Screenshot from 2020-05-18 22-04-07.png

Hi Ken,
Thank you for taking the pain to help.

I have the exact same setup: Windows 10 PC as host connecting to a headless BBB via USB. And experiencing the same issue for the past 1 week with no resolution yet.
After changing the crontab and rebooting my log file is as follows:

debian@beaglebone:~/cronjobs$ uname -r
4.19.94-ti-r42
debian@beaglebone:~/cronjobs$ cat log
=== Boot ===
Set Nameserver and Gateway
Nameserver 8.8.8.8, GW 192.168.7.1
Set route with gw 192.168.7.1
Display route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 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
Set timezone
Local time: Mon 2020-04-06 16:43:42 EDT
Universal time: Mon 2020-04-06 20:43:42 UTC
RTC time: Sat 2000-01-01 05:00:57
Time zone: America/New_York (EDT, -0400)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
Finished at Mon 06 Apr 2020 04:43:42 PM EDT
debian@beaglebone:~/cronjobs$

Still I could not ping dns server. “ping 8.8.8.8” is timing out.

Any clues?
Venkat.

Venkat,

I have been off Windows for 2 years now…

Try my GitHub site:
https://github.com/kenmartin-unix/Beaglebone/blob/master/BBB-PC-Internet.txt

and:

https://github.com/kenmartin-unix/Beaglebone/blob/master/postboot.sh

Hi Ken,
Thank you.
After following your github links, It is not working for me.

On BBB when I tried to set gw to 192.168.147.1 I am getting “network is unreachable.” It is accepting only 192.168.7.1.