Debian设备无法访问互联网

我试图在embedded式debain设备上访问互联网,但设备无法ping通LAN外的IP地址,但设备能ping通LAN的IP地址。

我试图通过route add default gw 192.168.1.1 eth0添加默认网关route add default gw 192.168.1.1 eth0但它说SIOCADDRT: No such process 。 还试过/sbin/route add -net 0.0.0.0 gw 192.168.1.1 eth0但是它也说SIOCADDRT: No such process

局域网的默认网关是192.168.1.1。

任何人都可以帮助我使这个设备能够ping通互联网地址?

这里有一些命令输出

 uname -a --> Linux debian 2.6.34.9 #1 PREEMPT Thu Sep 1 18:19:33 PHT 2011 armv5tel GNU/Linux 

ifconfig

 eth0 Link encap:Ethernet HWaddr 00:26:db:00:1a:18 inet addr:192.168.1.70 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::226:dbff:fe00:1a18/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4054 errors:0 dropped:0 overruns:0 frame:0 TX packets:502 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:445358 (434.9 KiB) TX bytes:124910 (121.9 KiB) Interrupt:11 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:16436 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:638 (638.0 B) TX bytes:638 (638.0 B) 

route -n

 Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 

cat /etc/resolv.conf

 nameserver 8.8.8.8 nameserver 8.8.4.4 

cat /etc/network/interfaces

 # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. auto lo iface lo inet loopback allow-hotplug eth0 iface eth0 inet dhcp 

 route add default gw 192.168.1.1 

这应该够了。 如果你想要指定接口,然后尝试

 route add default gw 192.168.1.1 dev eth0 

它看起来像你的DHCP服务器坏了。

根据你的问题,DHCP服务器不提供正确的网关到客户端。

尝试通过编辑/ etc / network / interfaces来设置静态IP地址

(你会在互联网上find正确的语法)。