我有点迷失方向,无法解决这个问题。
这是一台在 Google Compute Engine 上即将推出的机器。
当我尝试访问网络时,它显示“网络无法访问”。
网络似乎正常运行,因为 eth0 具有从 Google DHCP 服务器获取的网络地址。以下是“ifconfig”和“route”的输出
Google 表示这台机器所在的网络是 10.240.0.0/16,网关是 10.240.0.1
route -n 的输出
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
127.0.0.1 * 255.255.255.255 UH 0 0 0 lo
ifconfig -a 的输出
dummy0 Link encap:Ethernet HWaddr 72:E6:19:7F:A1:8E
BROADCAST NOARP MTU:1500 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)
eth0 Link encap:Ethernet HWaddr 42:01:0A:F0:00:02
inet addr:10.240.0.2 Bcast:10.255.255.255 Mask:255.255.255.255
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1102 (1.0 KiB) TX bytes:342 (342.0 B)
ip_vti0 Link encap:UNSPEC HWaddr 00-00-00-00-FF-FF-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1364 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)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
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)
tunl0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1480 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)
答案1
以下有效:
sleep 10 (not sure if this line matters but it seems the system needs a few seconds for something to complete?)
sudo udhcpc
sudo route add -net 10.240.0.0 netmask 255.255.0.0 dev eth0
sudo route add default gw 10.240.0.1 eth0