Beaglebone Black 接上網路
這是之前幫學長測試 Beaglebone Black 的過程,當時為了可以順利用 USB 與其他電腦進行連線,並且可以利用電腦網路分享給 BBB,但當時沒把那些網站記下來就是了XD
If you power down the Beaglebone Black by unplugging its USB cable,
plug it back in (hence rebooting it) and connect via PuTTY and try the ping command again …
ping 8.8.8.8
Network is unreachable
… you will find that the network is no longer reachable.
This is because the /sbin/route add default gw 192.168.7.1
command you entered earlier did not survive a reboot. Just enter it again and the ping command should work.
ping google.com
The thing that translates names into IP addresses is called a nameserver and we might as well use googles public nameservers to translate names into IP addresses for us.
You can, of course, use your own local nameservers if you wish. Nameservers are set in the /etc/resolv.conf
file.
To add a few nameservers just edit the /etc/resolv.conf
file (as root) using a command like
nano /etc/resolv.conf
domain localdomain
search localdomain
nameserver 8.8.8.8
nameserver 8.8.4.4
Shift+Enter >>> Save & Exit
Once I did that (taking care to re-enter the route add default command after the restart) a command like
ping google.com
returned the following
PING google.com (31.55.167.150) 56(84) bytes of data.
64 bytes from 31.55.167.150: icmp_req=1 ttl=57 time=35.8 ms