Linux
在 beaglebone black 中使 ip 靜態後無法訪問網際網路
我試圖在我的 Beaglebone 黑色中使我的 IP 靜態。為此,我遵循本教程。根據教程進行更改後,我的 /etc/network/interfaces 文件如下所示:-
# 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 static address 192.168.24.38 network 192.168.24.0 broadcast 192.168.24.255 netmask 255.255.252.0 gateway 192.168.25.10 # Example to keep MAC address between reboots #hwaddress ether DE:AD:BE:EF:CA:FE # The secondary network interface #auto eth1 #iface eth1 inet dhcp # 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 iface usb0 inet static address 192.168.7.2 netmask 255.255.255.0 network 192.168.7.0 gateway 192.168.7.1
重新啟動我的 Beaglebone black 後,我可以使用 command 看到我的 IP 是靜態 ip
ifconfig
。這是命令的輸出ifconfig
eth0 Link encap:Ethernet HWaddr d0:39:72:3b:da:e8 inet addr:192.168.24.38 Bcast:192.168.24.255 Mask:255.255.252.0 inet6 addr: fe80::d239:72ff:fe3b:dae8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3352 errors:0 dropped:63 overruns:0 frame:0 TX packets:77 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:329055 (321.3 KiB) TX bytes:10701 (10.4 KiB) Interrupt:40 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:1 errors:0 dropped:0 overruns:0 frame:0 TX packets:1 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:79 (79.0 B) TX bytes:79 (79.0 B) usb0 Link encap:Ethernet HWaddr 66:b8:b3:7a:c3:19 inet addr:192.168.7.2 Bcast:192.168.7.3 Mask:255.255.255.252 inet6 addr: fe80::64b8:b3ff:fe7a:c319/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:88 errors:0 dropped:0 overruns:0 frame:0 TX packets:76 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:13642 (13.3 KiB) TX bytes:17130 (16.7 KiB)
但現在我無法訪問網際網路。所以。請告訴我設置中的錯誤在哪裡。謝謝
如建議的那樣,命令的輸出
ip route
是:-default via 192.168.25.10 dev eth0 192.168.7.0/30 dev usb0 proto kernel scope link src 192.168.7.2 192.168.24.0/22 dev eth0 proto kernel scope link src 192.168.24.38
命令的輸出
ping -c1 google.com
是ping:未知主機 google.com
命令的輸出
netstat -nr
Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.7.0 0.0.0.0 255.255.255.252 U 0 0 0 usb0
輸出 ping 和 netstat 命令確認路由一切正常。然而 DHCP 也提供 DNS/解析器設置數據。DNS 解析失敗。
請編輯您的 /etc/resolv.conf 並將其填寫為:
nameserver 8.8.8.8
ping google.com 應該可以正常工作。
稍後與您的公司交談,並詢問他們的內部域 (yourdomain.xx) 和他們的名稱伺服器的 IP (localnameserver)
並將其更改為:
search yourdomain.xx nameserver localnameserver