- Beaglebone board can communicate to the internet over USB cable by sharing your PC’s internet connection
- You need not use a separate Ethernet cable to connect your board to internet
- The required drivers are enabled by default in the kernel and loaded when Linux boots on the BBB.
- But you must enable internet sharing on your HOST
Target Settings
- Add name server address in: /etc/resolv.conf
- nameserver 8.8.8.8
- nameserver 8.8.4.4
- Add name server address in: /etc/network/interfaces
- iface usb0 inet static
- address 192.168.7.2
- netmask 255.255.255.252
- network 192.168.7.0
- gateway 192.178.7.1
- dns-nameservers 8.8.8.8
- dns-nameservers 8.8.4.4
- Add default gateway address by running the below command
- sudo route add default gw 192.168.7.1 (Using PC as default gateway)
- Run the above command every time you reboot your BBB
HOST machine
- create usb.sh script file and add the following lines and save it
- iptables –table nat –append POSTROUTING –out-interface wlp3s0 -j MASQUERADE
- iptables –append FORWARD –in-interface wlp3s0 -j ACCEPT
- echo 1 > /proc/sys/net/ipv4/ip_forward
Run this script file every time you reboot/start your Host
jshankar@emsys:~$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether ec:f4:bb:1c:f7:4f brd ff:ff:ff:ff:ff:ff
3: wlp3s0:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether c4:d9:87:68:33:46 brd ff:ff:ff:ff:ff:ff inet 192.168.43.184/24 brd 192.168.43.255 scope global dynamic noprefixroute wlp3s0 valid_lft 3054sec preferred_lft 3054sec inet6 2401:4900:3303:630a:d0e:30fc:ef4:b3bc/64 scope global temporary dynamic valid_lft 2308sec preferred_lft 2308sec inet6 2401:4900:3303:630a:6f56:1355:46c3:e232/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 2308sec preferred_lft 2308sec inet6 fe80::e5b7:87ab:1b90:b333/64 scope link noprefixroute valid_lft forever preferred_lft forever
Recent Comments