本人需要在BBB下开发驱动程序,所以拿到BBB后首先需要将其联网,更新软件包和安装必要的头文件等。
因为一般开发的时候是将BBB通过USB连接到PC主机,所以有没有办法使得BBB通过USB联网呢? 答案是可以的。
在BBB端,你需要做如下事情:
1) 添加默认路由,命令如下:
[code language=”bash”]
route add default gw 192.168.7.1
[/code]
2) 添加DNS服务器,命令如下:
[code language=”bash”]
vi /etc/resolv.conf
[/code]
添加谷歌的DNS服务器地址:
[code language=”bash”]
nameserver 8.8.8.8
[/code]
在PC端,你需要这样子做:
[code language=”bash”]
sudo su
# eth0是PC的网络接口, eth1为PC连接BBB的USB接口
iptables –table nat –append POSTROUTING –out-interface eth0 -j MASQUERADE
iptables –append FORWARD –in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
[/code]
使用PING测试网络连接:
[code language=”bash”]
ping www.google.com
[/code]
返回结果:
[code language=”bash”]
PING www.google.com (130.206.193.46) 56(84) bytes of data.
64 bytes from 130.206.193.46: icmp_req=1 ttl=59 time=2.61 ms
64 bytes from 130.206.193.46: icmp_req=2 ttl=59 time=2.31 ms
64 bytes from 130.206.193.46: icmp_req=3 ttl=59 time=1.94 ms
64 bytes from 130.206.193.46: icmp_req=4 ttl=59 time=1.97 ms
64 bytes from 130.206.193.46: icmp_req=5 ttl=59 time=2.10 ms
^C
— www.google.com ping statistics —
5 packets transmitted, 5 received, 0% packet loss, time 20129ms
rtt min/avg/max/mdev = 1.942/2.189/2.617/0.255 ms
[/code]
本文链接:https://www.yunweipai.com/3879.html
没有办法使得BBB通过USB联网呢?