我最近在Beagle Bone Black上安装了Ubuntu 13.04。这个图片:
https://rcn-ee.net/deb/flasher/raring/BBB-eMMC-flasher-ubuntu-13.04-2013-10-08.img.xz
该微控制器允许通过USB在主机PC(版本12.04(精确)(64位),内核Linux 3.2.0-56-通用)和BeagleBone之间共享Internet连接,因此我将其配置为如下所示:
BeagleBone黑色:
ifconfig usb0 192.168.7.2
route add default gw 192.168.7.1
主机电脑:
sudo su
#eth0 is my internet facing interface, eth3 is the BeagleBone USB connection
ifconfig eth2 192.168.7.1
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth2 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
在Internet连接正常工作之后,ping 8.8.8.8
我得到了以下结果:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=47 time=4.63 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=47 time=4.68 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=47 time=4.57 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=47 time=4.58 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 4.578/4.620/4.682/0.063 ms
为了也配置DNS,我也键入了,echo "nameserver 8.8.8.8" >> /etc/resolv.conf
但是不幸的是ping google.com
,经过几秒钟的计算后,我得到了ping: unknown host google.com
所以-我知道,这种解决方案不好,但是对于本届会议来说,它可能行得通,但行不通。而且,BBB和PC都使用resolvconf。老实说,我不知道如何使用该程序配置网络...我尝试/etc/network/interfaces
像这样在Beagle Bone Black上进行更改:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto eth0
iface eth0 inet dhcp
# Example to keep MAC address between reboots
#hwaddress ether DE:AD:BE:EF:CA:FE
# WiFi Example
#auto wlan0
#iface wlan0 inet dhcp
# wpa-ssid "essid"
# wpa-psk "password"
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
# Note on some boards, usb0 is automaticly setup with an init script
# in that case, to completely disable remove file [run_boot-scripts] from the boot partition
auto usb0
iface usb0 inet static
address 192.168.7.2
netmask 255.255.252.0
network 192.168.7.0
#broadcast 192.168.7.3
gateway 192.168.7.1
dns-nameservers 8.8.8.8 8.8.4.4
但这没有帮助。
我不知道该怎么办。请帮忙。
其他有用的信息:
Beagle Bone Black:ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
usb0 Link encap:Ethernet HWaddr ce:39:f3:4a:c7:94
inet addr:192.168.7.2 Bcast:192.168.7.3 Mask:255.255.255.252
inet6 addr: fe80::cc39:f3ff:fe4a:c794/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:608 errors:0 dropped:0 overruns:0 frame:0
TX packets:375 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:57484 (57.4 KB) TX bytes:63078 (63.0 KB)
路线
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.7.0 * 255.255.255.252 U 0 0 0 usb0
优名
Linux arm 3.8.13-bone28 #1 SMP Fri Sep 13 03:12:24 UTC 2013 armv7l armv7l armv7l GNU/Linux
/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
#domain localdomain
#search localdomain
#nameserver 192.168.1.1
电脑:
ifconfig
eth0 Link encap:Ethernet Hardware Adresse 00:17:31:8d:6a:a6
inet Adresse:141.3.81.154 Bcast:141.3.83.255 Maske:255.255.252.0
inet6-Adresse: fe80::217:31ff:fe8d:6aa6/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1
RX packets:30732 errors:0 dropped:0 overruns:0 frame:0
TX packets:5888 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX-Bytes:7266589 (7.2 MB) TX-Bytes:1286462 (1.2 MB)
Interrupt:19
eth1 Link encap:Ethernet Hardware Adresse 00:04:75:ca:98:ee
UP BROADCAST MULTICAST MTU:1500 Metrik:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX-Bytes:0 (0.0 B) TX-Bytes:0 (0.0 B)
Interrupt:21 Basisadresse:0xe400
eth2 Link encap:Ethernet Hardware Adresse c8:a0:30:ac:2c:95
inet Adresse:192.168.7.1 Bcast:192.168.7.3 Maske:255.255.255.252
inet6-Adresse: fe80::caa0:30ff:feac:2c95/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1
RX packets:418 errors:0 dropped:0 overruns:0 frame:0
TX packets:637 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX-Bytes:45704 (45.7 KB) TX-Bytes:88161 (88.1 KB)
lo Link encap:Lokale Schleife
inet Adresse:127.0.0.1 Maske:255.0.0.0
inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine
UP LOOPBACK RUNNING MTU:16436 Metrik:1
RX packets:840 errors:0 dropped:0 overruns:0 frame:0
TX packets:840 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:0
RX-Bytes:142988 (142.9 KB) TX-Bytes:142988 (142.9 KB)
路线
Ziel Router Genmask Flags Metric Ref Use Iface
default i60-gw-int.ipr. 0.0.0.0 UG 0 0 0 eth0
141.3.80.0 * 255.255.252.0 U 1 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth2
192.168.7.0 * 255.255.255.252 U 1 0 0 eth2
优名
Linux i60p354 3.2.0-56-generic #86-Ubuntu SMP Wed Oct 23 09:20:45 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
重要的是-与BBB共享Internet的PC可在大学网络中工作,该网络比普通的家庭网络复杂得多-会导致DNS解决问题吗?重要的是-如果我在resolv.conf.d / head中设置了一个有意义的名称服务器(它像8.8.8.8一样启动并运行),然后键入ping google.com,则机器会计算一段时间,然后返回错误未知主机。如果我设置了一个废话地址,那肯定是行不通的(即123.123.123.123),则会立即返回错误。