centos 7 查看网卡的mac地址(网卡无法启动的情况下)

1. 服务器启动了,网卡没起来

ifconfig看不到网卡。好吧,重启一下网络服务:

service network restart 

图示错误:

Restarting network (via systemctl):  Job for network.service failed. See 'systemctl status network.service' 
and 'journalctl -xn' for details.


输入:systemctl status network.service

提示信息:

network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network)
   Active: failed (Result: exit-code) since  2016-11-15 16:30:10 CST; 1min 5s ago
11月 15 16:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists
11月 15 16:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists
11月 15 16:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists
11月 15 16:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists
11月 15 16:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists
11月 15 16:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists
11月 15 16:30:10 localhost.localdomain network[2920]: RTNETLINK answers: File exists
11月 15 16:30:10 localhost.localdomain systemd[1]: network.service: control process exited, code=exited 
status=1
11月 15 16:30:10 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
11月 15 16:30:10 localhost.localdomain systemd[1]: Unit network.service entered failed state.

因为这个硬盘以前是用在其他机器上的,估计是网卡的mac地址不对,那怎么修改呢?

有人说先用ifconfig 来看网卡地址。

其实这个时候网卡还没起来,根本看不到。

2. ip addr

执行ip addr,可以查看mac地址。具体哪个 ?  猜一下吧,很容易的。

然后修改网卡的配置: vi /etc/sysconfig/network-scripts/ifcfg-eth0  网卡名称根据你自己的机器上的来。

修改其中的"HWADDR=xx:xx:xx:xx:xx:xx"

也可能是"MACADDR=xx:xx:xx:xx:xx:xx"

然后:ifconfig eth0 up

然后:systemctl start network

搞定。



你可能感兴趣的:(centos,7,问题解决)