这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » AT91RM9200网络问题

共2条 1/1 1 跳转至

AT91RM9200网络问题

菜鸟
2004-12-10 01:25:09     打赏
现在我在开发AT91RM9200的时候遇到一个网络问题: (1)如果我在RAMDisk中不指定开发板的IP地址,运行Kernel挂载文件系统后,敲ifconfig eth0查询会得到如下的结果: [root@AT91RM9200DK /]$ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 BROADCAST MULTICAST 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:100 Interrupt:24 Base address:0xc000 如果用ifconfig设定IP会提示出错,情况如下: [root@AT91RM9200DK mtd]$ifconfig eth0 159.99.211.23 SIOCSIFFLAGS: Cannot assign requested address 这时候,如果再查询会发现,IP还是设定上了 [root@AT91RM9200DK /]$ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 inet addr:159.99.211.23 Bcast:159.99.255.255 Mask:255.255.0.0 BROADCAST MULTICAST 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:100 Interrupt:24 Base address:0xc000 但使用这个IP无法Ping通外部服务器或者其他机器 [root@AT91RM9200DK /root]$ping 159.99.211.1 PING 159.99.211.1 (159.99.211.1): 56 data bytes ping: Network is unreachable ping wrote -1 chars; 64 expected (2)我现在改了内核的驱动,在init_net.c中添加了MAC地址,然后在RAMDisk中指定了IP地 址,在/etc/rc.d/rc.sysinit(和/etc/init.d/rcS功能一样)中添加指定IP的脚本: /sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.1 broadcast 127.255.255.255 /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo /sbin/ifconfig eth0 159.99.211.23 broadcast 159.99.211.63 netmask 255.255.255.192 /sbin/route add default gw 159.99.211.1 eth0 启动内核挂载文件系统后,发现MAC地址和指定的IP都有了,但还是无法使用 [root@AT91RM9200DK mtd]$ifconfig eth0 eth0 Link encap:Ethernet HWaddr 01:03:05:07:09:0B inet addr:159.99.211.23 Bcast:159.99.211.63 Mask:255.255.255.192 BROADCAST MULTICAST 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:100 Interrupt:24 Base address:0xc000 Ping自己可以Ping通。 [root@AT91RM9200DK /root]$ping 159.99.211.23 PING 159.99.211.23 (159.99.211.23): 56 data bytes Warning: unknown ICMP packet received (not echo-reply) 64 bytes from 159.99.211.23: icmp_seq=0 ttl=64 time=3.6 ms Warning: unknown ICMP packet received (not echo-reply) 64 bytes from 159.99.211.23: icmp_seq=1 ttl=64 time=0.5 ms Warning: unknown ICMP packet received (not echo-reply) 64 bytes from 159.99.211.23: icmp_seq=2 ttl=64 time=0.4 ms Ping外网,无法Ping通。 [root@AT91RM9200DK /root]$ping 159.99.211.1 PING 159.99.211.1 (159.99.211.1): 56 data bytes ping: Network is unreachable ping wrote -1 chars; 64 expected 设置网关有问题: [root@AT91RM9200DK mtd]$route add 159.99.211.1 eth0 SIOCADDRT: Network is down [root@AT91RM9200DK mtd]$ [root@AT91RM9200DK mtd]$route add default gw 159.99.211.1 eth0 SIOCADDRT: Network is unreachable



关键词: AT91RM9200     网络     问题     root@AT9    

菜鸟
2004-12-10 17:37:00     打赏
2楼
你用的是那个版本的Linux?还有,你用的是哪个Ramdisk?Atmel的吗?

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]