Unable to ping www.google.com: Temporary failure in name resolution issue

Hello, I am encountering an issue with enabling internet connectivity over USB on my BeagleBone Black hardware. Despite following various steps, I receive the error message “Temporary failure in name resolution” when attempting to ping www.google.com. Below are the detailed steps I have undertaken:

Booted with SD Card:

Booted my BeagleBone Black using an SD card with the Debian image https://www.beagleboard.org/distros/am3358-debian-10-0-2019-07-07-4gb-sd-iot flashed on it.
Kernel Compilation:

Compiled the Linux kernel 5.10-rt using the toolchain [gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.](https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz)

Updated the kernel to version 5.10.162 in the /lib/modules/ directory of the SD card and successfully booted the BeagleBone Black.
Configured DNS:

Manually edited the /etc/resolv.conf file to include the following nameservers:

Updated Network Interfaces:

Modified the /etc/network/interfaces file as follows:
## connman: WiFi
# connmanctl
# connmanctl> tether wifi off
# connmanctl> enable wifi
# connmanctl> scan wifi
# connmanctl> services
# connmanctl> agent on
# connmanctl> connect wifi__managed_psk*
# connmanctl> quit

# Ethernet/RNDIS gadget (g_ether)
# Used by: /opt/scripts/boot/autoconfigure_usb0.sh
iface usb0 inet static

  • address*
  • netmask*
  • network*
  • gateway*
  • dns-nameserver*
  • dns-nameserver*
    Executed Routing Commands:

Ran the following command:

sudo route add default gw usb0
sudo route add default gw usb1

Configured Host Terminal:
On the host terminal, executed these commands:
echo 1 > /proc/sys/net/ipv4/ip_forward
sudo iptables --table nat --append POSTROUTING --out-interface wlp2s0 -j MASQUERADE
sudo iptables --append FORWARD --in-interface enx247625ec9b0d -j ACCEPT

When attempting to ping www.google.com from the target terminal, I receive the error “Temporary failure in name resolution.”
**root@beaglebone:~# ping www.google.com **
ping: www.google.com: Temporary failure in name resolution
I have tried various solutions discussed in forums without success. Additionally, I have booted from the eMMC with the image Buster bone-eMMC-flasher-debian-10.3-iot-armhf-2020-04-06-4gb.img flashed on it and followed the same steps, but the issue persists.

Your assistance in resolving this issue would be greatly appreciated.

Thank you in advance for your support.

Ok a couple of points.

On the BBB don’t add the second GW route via USB1. At least on my setup BBB connected to Linux host, only the 192.168.7.x subnet is valid on my PC.

Otherwise what you have works for me.

You can also check

sudo sysctl -a | grep "net.ipv4.ip_forward "

Make sure it is enabled. Edit /etc/sysctl.conf to make it stick across boots.
Double check interface names are correct in the iptables commands.

Just try to ping in case for some reason it is a DNS issue rather than a routing issue.

Thank you for your response. I followed your suggestion and uncommented the line net.ipv4.ip_forward on both the host PC and the target. It is now working correctly.