1、在Linux上,在ifcfg-eth0上设置IP地址等信息

详细配置信息如下已

[root@rac01 Desktop]#more/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

NM_CONTROLLED=yes

ONBOOT=no

TYPE=Ethernet

UUID=3d5f18d5-73e0-48db-acbb-67d3ee8b332f

IPADDR=192.168.171.150

PREFIX=24

2、IP地址不生效的情况

(1)ifconfig查看eth0网卡信息,发现IP地址并没有生效

[root@rac01 Desktop]# ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:0C:29:84:F2:24

inet6 addr: fe80::20c:29ff:fe84:f224/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:6 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 b) TX bytes:468 (468.0 b)

问题比较鬼异,明明在ifcfg-eth0文件中设置有IP地址192.168.171.150的,为什么会系统却获不到IP地址呢。

(2)ping别的IP地址报如下错误:

[root@rac01Desktop]# ping 192.168.171.180

connect:Network is unreachable

(3)重启网络服务提示网卡没有活动

[root@rac01 network-scripts]# service network restart

Shutting down interface eth0: Error: Device 'eth0' (/org/freedesktop/NetworkManager/Devices/0) disconnecting failed: This device is not active

[FAILED]

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: [ OK ]

3、问题分析

从第2节中的3点信息来判断,基本确定为网卡没有启动所致。

4、处理解决

[root@rac01 Desktop]# ifup ifcfg-eth0

Active connection state: activated

Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1

[root@rac01 Desktop]# ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:0C:29:84:F2:24

inet addr:192.168.171.150 Bcast:192.168.171.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fe84:f224/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:1 errors:0 dropped:0 overruns:0 frame:0

TX packets:44 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:82 (82.0 b) TX bytes:7277 (7.1 KiB)

到此,网卡已经正常工作。

Logo

更多推荐