网卡启动报错
起因:
1.208这台机器用来做测试的zabbix环境,一直没有关过机,由于电脑开的东西比较多,有些卡慢,于是昨天下班的时候把虚拟机挂起,电脑关机了,今天早上来的时候打开虚拟机发现网卡起不来了,不能远程连接,于是登陆机器进行检查;
现象:
[root@Zabbix server ~]# /etc/init.d/network restart
1 /etc/sysconfig/network: line 2: server: command not found 2 /etc/sysconfig/network: line 2: server: command not found 3 Shutting down interface eth0: ../network: line 2: server: command not found 4 ../network: line 2: server: command not found 5 /etc/sysconfig/network: line 2: server: command not found 6 /etc/sysconfig/network: line 2: server: command not found 7 /etc/sysconfig/network: line 2: server: command not found 8 /etc/sysconfig/network: line 2: server: command not found 9 /etc/sysconfig/network: line 2: server: command not found 10 [ OK ] 11 Shutting down loopback interface: ../network: line 2: server: command not found 12 ../network: line 2: server: command not found 13 /etc/sysconfig/network: line 2: server: command not found 14 /etc/sysconfig/network: line 2: server: command not found 15 /etc/sysconfig/network: line 2: server: command not found 16 /etc/sysconfig/network: line 2: server: command not found 17 [ OK ] 18 /etc/sysconfig/network: line 2: server: command not found 19 /etc/sysconfig/network: line 2: server: command not found 20 /etc/sysconfig/network: line 2: server: command not found 21 Bringing up loopback interface: ../network: line 2: server: command not found 22 ../network: line 2: server: command not found 23 /etc/sysconfig/network: line 2: server: command not found 24 ../network: line 2: server: command not found 25 /etc/sysconfig/network: line 2: server: command not found 26 [ OK ] 27 Bringing up interface eth0: ../network: line 2: server: command not found 28 ../network: line 2: server: command not found 29 30 Determining IP information for eth0.../etc/sysconfig/network: line 2: server: command not found 31 /etc/sysconfig/network: line 2: server: command not found 32 Cannot find device "server" 33 failed. 34 [FAILED] 35 /etc/sysconfig/network: line 2: server: command not found
分析:
启动报错提示Determining IP information for eth0.../etc/sysconfig/network: line 2: server: command not found
/etc/sysconfig/network: line 2: server: command not found (之前疏忽看成是/etc/init.d/network文件有问题,从别的机器下载了一份配置文件通过diff对比没发现什么不通,还检查了network下所有文件的完整性,很尴尬...)
解决:
[root@Zabbix server ~]# vim /etc/sysconfig/network
1 NETWORKING=yes 2 HOSTNAME=Zabbix server (发现这里主机名Zabbix server这中间有一个空格,不符合规范,所以启动的时候不能识别)
把空格删除,重新启动 (成功)
[root@Zabbix server ~]# /etc/init.d/network restart
1 Shutting down interface eth0: [ OK ] 2 Shutting down loopback interface: [ OK ] 3 Bringing up loopback interface: [ OK ] 4 Bringing up interface eth0: 5 Determining IP information for eth0... done. 6 [ OK ]