读书人

linux ifconfig 命令的疑问解决方案

发布时间: 2012-06-06 16:44:11 作者: rapoo

linux ifconfig 命令的疑问
PID USER VSZ STAT COMMAND
1 root 2144 S init
2 root 0 SW< [kthreadd]
3 root 0 SW< [migration/0]
4 root 0 SW< [ksoftirqd/0]
5 root 0 SW< [migration/2]
6 root 0 SW< [ksoftirqd/2]
7 root 0 SW< [events/0]
8 root 0 SW< [events/2]
9 root 0 SW< [khelper]
77 root 0 SW< [kblockd/0]
78 root 0 SW< [kblockd/2]
86 root 0 SW< [ata/0]
87 root 0 SW< [ata/2]
88 root 0 SW< [ata_aux]
97 root 0 SW< [khubd]
119 root 0 SW [pdflush]
120 root 0 SW [pdflush]
121 root 0 SW< [kswapd0]
168 root 0 SW< [aio/0]
169 root 0 SW< [aio/2]
179 root 0 SW< [cifsoplockd]
180 root 0 SW< [cifsdnotifyd]
188 root 0 SW [kcdfsd]
848 root 0 SW< [zd1211rw]
860 root 0 SW< [scsi_eh_0]
901 root 0 SW< [scsi_eh_1]
902 root 0 SW< [usb-storage]
929 root 0 SW< [mtdblockd]
956 root 0 SW< [kmmcd]
961 root 0 SW< [c2sd]
980 root 0 SW< [rpciod/0]
981 root 0 SW< [rpciod/2]
987 root 0 SW< [yaffs-bg-1]
988 root 0 SW< [yaffs-bg-1]
989 root 0 SW< [yaffs-bg-1]
1110 root 2160 S udhcpc -n --script=/sdroot/sbin/udhcpc.script
1117 root 3680 S /sdroot/usr/sbin/dropbear
1119 root 2160 S -/bin/sh
1139 root 0 SW< [galcore daemon ]
1154 root 2800 S //bin/dbus-daemon --fork --print-pid 4 --print-addres
1163 root 1792 S ./lircd
1205 root 2144 R ps
~ # ping 10.128.119.1
PING 10.128.119.1 (10.128.119.1): 56 data bytes
64 bytes from 10.128.119.1: seq=0 ttl=255 time=9.576 ms
64 bytes from 10.128.119.1: seq=1 ttl=255 time=0.771 ms
64 bytes from 10.128.119.1: seq=2 ttl=255 time=0.768 ms
64 bytes from 10.128.119.1: seq=3 ttl=255 time=0.758 ms
64 bytes from 10.128.119.1: seq=4 ttl=255 time=0.765 ms

--- 10.128.119.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.758/2.527/9.576 ms
~ # ifconfig eth0 down
~ # ping 10.128.119.1
PING 10.128.119.1 (10.128.119.1): 56 data bytes
ping: sendto: Network is unreachable
~ # ifconfig eth0 up
~ # ping 10.128.119.1
PING 10.128.119.1 (10.128.119.1): 56 data bytes
64 bytes from 10.128.119.1: seq=0 ttl=255 time=22.469 ms
64 bytes from 10.128.119.1: seq=1 ttl=255 time=0.826 ms
64 bytes from 10.128.119.1: seq=2 ttl=255 time=0.774 ms

--- 10.128.119.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.774/8.023/22.469 ms
~ # ifconfig eth0 10.128.119.123
~ # ifconfig eth0 down
~ # ifconfig eth0 up
Segmentation fault~ # 】

1、如上为什么 这样就段错误,系统死机了。

2、还有请问下,设备首先通过DHCP 获取了IP, 这个时候 可以ping 通外面的设备。 但是如果我通过ifconfig 来指定设备IP 后,就无法ping 通别的设备了?

3、再此的使用UDHCPC ,来获取地址 成功。但是ifconfig 来查看的时候,地址没有变成获取的地址?



[解决办法]
是虚拟机吗?配置不同的ip地址,结果不同,这和你的虚拟机的本身设置有关系。

系统死机可能是ifconfig这个工具有问题,或者网卡驱动有问题。
[解决办法]
自己通过ifconfig设置IP,如果不是之前DHCP获取到的,那么网关那边会把报文都丢掉,所以ping不通



估计是你机器的网卡比较偏,驱动不是很匹配导致的ifconfig异常
[解决办法]
你自己ifconfig指定了IP要通过dhclient告知dhcp server才行,否则路由器是不允许你上线的。
[解决办法]
路由那边只支持自动获取IP. 不支持手动分配,所以PING 不通。

关于自动获取IP 的问题,使用netstart 才可以。相当于运行udhcpc -q -n -s sbin/udhcpc.script -i eth0

读书人网 >UNIXLINUX

热点推荐